Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an equivalent to the default source, when using SetupIntent & PaymentIntent?

With the Sources API, every customer had a default_source, but when using SetupIntent (in order to be compliant with the PSD2/SCA directive), there doesn't seem to be any direct equivalent.

So my question is, how this can be properly represented API-side (without using metadata)?

The payment_methods listing seems to have a property called preferred for the card (which seems to be what I am looking for), but so far I have not found out, how to get/set this property.

like image 939
Martin Zeitler Avatar asked Nov 26 '25 09:11

Martin Zeitler


2 Answers

There is no direct equivalent to the default_source for Payment Methods and the newer APIs like Setup Intents and Payment Intents. The closest thing is invoice_settings.default_payment_method, but it only applies to Invoices.

To answer your question directly, you have three choices:

  1. Set and use the value of invoice_settings.default_payment_method, specifying the Payment Method stored there explicitly for each Setup and Payment Intent
  2. Specify the default Payment Method in metadata as you suggested
  3. Store the default on your end in your own database

Regarding the preferred property, if you're referring to card.networks.preferred that is the preferred card network of the card in question and is not relevant to your question.

like image 166
Justin Michael Avatar answered Nov 28 '25 16:11

Justin Michael


If you use Webhooks, you can listen for payment_method.attached or setup_intent.succeeded events and set it as default when they are fired.

For more info: https://stripe.com/docs/api/events/types

Payment method object can be set to update Customer invoice_settings property with a default payment method.

https://stripe.com/docs/api/customers/update#update_customer-invoice_settings

like image 38
Howarto Avatar answered Nov 28 '25 17:11

Howarto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!