#.aliciant
1 messages · Page 1 of 1 (latest)
Hi there, since you are using the legacy Charges API, Stripe will look for the default_source of this customer and use it to charge the customer, However, this customer doesn't have a default_source set.
Oh ok. How can I set the default_source? I did set the card as the default card in the Stripe dashboard.
Thank you for the very fast response btw. One of my favorite things about stripe is the ability to get dev help quickly!
Thanks for the kind words.
You can set the default_source programmatically (https://stripe.com/docs/api/customers/update#update_customer-default_source), or through Dashboard. The Dashboard is currently still using Sources API but it might change to PaymentMethods API in the future.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Also I'd strongly suggest you to migrate to PaymentIntents API (https://stripe.com/docs/payments/payment-intents/migration), it offers much more features than Charges API and it's our recommended integration.
Yes - migration is already in progress. We should be done soon.
awesome, thanks for the guidance.
Happy to help. Since you are still on Charges API now, you can also specify a source (https://stripe.com/docs/api/charges/create#create_charge-source) when creating a charge if the customer doesn't have a default_source, or if you want to use a different source rather than the default_source .
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Just to confirm, do I use the pm id as the default_source?
No, a pm_xxx is a PaymentMethod, a Source has a resource ID that starts with src_
Ok, so if the card is already attached to the customer, can I create a new source from the same card using the CLI? I'm asking because I don't have the credit card information.