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.
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:
invoice_settings.default_payment_method, specifying the Payment Method stored there explicitly for each Setup and Payment Intentmetadata as you suggestedRegarding 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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With