Skip to content

Commit 212b0a5

Browse files
committed
[server] Set Stripe customer country when attaching a payment method
1 parent 480e97b commit 212b0a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,12 @@ 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.billing_details.address?.country
122+
? { address: { line1: "", country: paymentMethod.billing_details.address?.country } }
123+
: {}),
120124
});
121125
}
122126

0 commit comments

Comments
 (0)