Skip to content

Commit d864580

Browse files
committed
[server] Set Stripe customer country to credit card country when attaching a payment method
1 parent 6c669f7 commit d864580

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

components/server/ee/src/user/stripe-service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ export class StripeService {
115115
await this.getStripe().paymentMethods.attach(setupIntent.payment_method, {
116116
customer: customer.id,
117117
});
118+
const paymentMethod = await this.getStripe().paymentMethods.retrieve(setupIntent.payment_method);
118119
await this.getStripe().customers.update(customer.id, {
119120
invoice_settings: { default_payment_method: setupIntent.payment_method },
121+
...(paymentMethod.card?.country ? { address: { line1: "", country: paymentMethod.card.country } } : {}),
120122
});
121123
}
122124

0 commit comments

Comments
 (0)