← All errors · StripeStripe payments & webhook errors

This customer has no attached payment source or default payment method

Exact error

Error: This customer has no attached payment source or default payment method.

What it means

Stripe tried to charge a customer (usually the first invoice of a new subscription created with the API) but there is no payment method it is allowed to use. A card being attached to the customer is not enough: it must be set as the default, or passed for that subscription.

Likely causes

How to fix it

  1. Simplest fix: let Stripe Checkout create the subscription. In subscription mode Checkout collects the card and sets it on the subscription for you:

    const session = await stripe.checkout.sessions.create({
      mode: 'subscription',
      customer: customerId,
      line_items: [{ price: 'price_123', quantity: 1 }],
      success_url: `${origin}/success?session_id={CHECKOUT_SESSION_ID}`,
      cancel_url: `${origin}/pricing`,
    });
  2. If you build the subscription with the API, create it as incomplete and save the card when the first payment is confirmed in your frontend (Stripe Elements):

    const subscription = await stripe.subscriptions.create({
      customer: customerId,
      items: [{ price: 'price_123' }],
      payment_behavior: 'default_incomplete',
      payment_settings: { save_default_payment_method: 'on_subscription' },
    });
  3. If the customer already has a saved card (pm_...), make it the default before creating the subscription, or pass it directly:

    await stripe.customers.update(customerId, {
      invoice_settings: { default_payment_method: paymentMethodId },
    });
    // or
    await stripe.subscriptions.create({ customer: customerId, items: [{ price: 'price_123' }], default_payment_method: paymentMethodId });
  4. If a one-time Checkout payment should also save the card for future charges, set setup_future_usage:

    payment_intent_data: { setup_future_usage: 'off_session' }

Prevent this next time

FAQ

What does "This customer has no attached payment source or default payment method" mean?

Stripe tried to charge a customer (usually the first invoice of a new subscription created with the API) but there is no payment method it is allowed to use. A card being attached to the customer is not enough: it must be set as the default, or passed for that subscription.

What usually causes it?

Creating a subscription with stripe.subscriptions.create() for a customer who never entered a card. The PaymentMethod was attached to the customer but never set as invoice_settings.default_payment_method or passed as default_payment_method. A one-time Checkout payment (mode: 'payment') was used first; by default it does not save the card for later charges.

How do I fix it?

1. Simplest fix: let Stripe Checkout create the subscription. In subscription mode Checkout collects the card and sets it on the subscription for you: 2. If you build the subscription with the API, create it as incomplete and save the card when the first payment is confirmed in your frontend (Stripe Elements): 3. If the customer already has a saved card (pm_...), make it the default before creating the subscription, or pass it directly: 4. If a one-time Checkout payment should also save the card for future charges, set setup_future_usage:

Related errors

More Stripe errors and fixes →

Get new fixes weekly

No spam. Unsubscribe anytime. Privacy