Stripe customers with attached cards, but no default payment method

Viewed 997

I am doing a migration for a customer from one platform to another both of which use a Stripe account.

Both platforms only support card payments. I have noticed, however, that the customers of the existing platform all have a card attached on the Stripe dashboard, but it is not marked as their default payment source. If I retrieve the customers from the API, both their default_source, invoice_settings. default_payment_method and sources.data attributes are null or empty array respectively.

It doesn't sound likely that I'll be able to charge a customer without a default source. I would like to run some tests on data that looks like the production environment, but no matter how I attach a card to a customer, it automatically gets registered as the customer's default source (if they don't already have another). I have in fact no idea how the previous platform manages to end up in a state where a customer has a card attached on the dashboard, but an empty sources-array.

Do any of you know how I can replicate this behaviour using either the API or the dashboard?

1 Answers

When working with Payment Methods, such as attaching a payment method, you must set the customer invoice_settings.default_payment_method explicitly (API ref). With the older Sources API, the default_source was set automatically.

If you attached one of the test payment methods, you can recreate the behaviour you describe: you'd have an attached payment method but no defaults set.

Related