fix: customer

This commit is contained in:
Nevo David 2025-12-29 02:59:17 +07:00
parent 00caa7ddc4
commit ca941aed85
1 changed files with 14 additions and 6 deletions

View File

@ -376,14 +376,22 @@ export class StripeService {
apiVersion: '2025-03-31.basil',
});
if (body.dub) {
const user = await this._userService.getUserById(userId);
try {
await stripeCustom.customers.update(customer, {
metadata: {
dubCustomerExternalId: userId,
dubClickId: body.dub,
},
email: user.email,
...(body.dub
? {
metadata: {
dubCustomerExternalId: userId,
dubClickId: body.dub,
},
}
: {}),
});
}
} catch (err) {}
const isUtm = body.utm ? `&utm_source=${body.utm}` : '';
// @ts-ignore
const { client_secret } = await stripeCustom.checkout.sessions.create({