diff --git a/backend/src/features/subscriptions/external/stripe/stripe.client.ts b/backend/src/features/subscriptions/external/stripe/stripe.client.ts index cf1050f..1105f1b 100644 --- a/backend/src/features/subscriptions/external/stripe/stripe.client.ts +++ b/backend/src/features/subscriptions/external/stripe/stripe.client.ts @@ -75,6 +75,14 @@ export class StripeClient { try { logger.info('Creating Stripe subscription', { customerId, priceId, paymentMethodId }); + // Attach payment method to customer before creating subscription + if (paymentMethodId) { + await this.stripe.paymentMethods.attach(paymentMethodId, { + customer: customerId, + }); + logger.info('Payment method attached to customer', { customerId, paymentMethodId }); + } + const subscriptionParams: Stripe.SubscriptionCreateParams = { customer: customerId, items: [{ price: priceId }],