#Gesundheit-default-paymentmethod
1 messages · Page 1 of 1 (latest)
yep
I'm using CustomerService.GetAsync(cus_id)
through debugging and breakpointing I can see that it has indeed fetched the a customer and the correct customer
however, the InvoiceSettings.DefaultPaymentMethod is null
(InvoiceSettings.DefaultPaymentMethodId is also null)
What's the customer ID (cus_xxx)?
hmm, i'm seeing that a customer object has both
default_source and invoice_settings.default_payment_method
ID: ||cus_KGNSSmcRwsp7xL||
so yeah, this. Which one should I use if I am certain that a user will always have only one card on file?
It really depends on your integration - if you're relying on default_source in other parts of your integration (like with charges) then you should continue to use it. Otherwise, it's better to use invoice_settings.default_payment_method
what are the typical use cases of these two?
i guess it's just me but it's confusing as to imagine what these two methods are for
like, which one pays for subscriptions? which one pays for one-time products?
default_source is meant for use with our older APIs (sources, charges) and will automatically be used when a Charge is created for the customer. This includes if a subscription is made.
invoice_settings.default_payment_method is meant to be used with our newer APIs (Payment intents, payment methods) and will only be automatically used for Billing payments (subscriptions, invoices)
Well, I guess my first question to your answer will be why there are two ways to pay for a subscription? Which one will be used?
You said default_source will be used when a Charge is created for a customer, including when a subscription is made
then, is.dpm (apologies for the shorthand) will be automatically used for billing subscriptions
Is there something that I'm not getting?
Ah, are you asking what takes precedence if both are set?
No worries at all (and I know this bit is confusing). So for billing subscriptions this is the order in which things are used: subscription.default_payment_method -> subscription.default_source -> customer.default_payment_method -> customer.default_source
We talk about this here: https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'l check that out momentarily!
so... based on your explanation, I feel like default_source is old stuff?
Yes, default_source is meant for use with our legacy APIs (which we still support, but no longer recommend for new integrations)
gotcha! That leads to my next question though
earlier when I was setting up our test customer, I used the dashboard to setup the payment method (a test card). It populates default_source with the card, not is.dpm
so... if I were to use the new stuff, how should i set it up? (from both dashboard and through API)
Yeah our dashboard sometimes is built on top of our older apis and haven't been updated yet
got it. So yeah, I'll have to set it up by manually calling the API (which is fine, since we're doing it anyways)
I noticed that there is SetupIntent and there's PaymentMethodService I can use?
I imagine Stripe allows customers to have a default payment method for a particular subscription that's different than is.dpm, which will not happen in our case (i.e. everything will be paid using the same card), so we will only need to set the customer's is.dpm
So if you want to save a card that is intended for use with future payments, that's something you could do with SetupIntents (https://stripe.com/docs/payments/save-and-reuse). Alternatively, you can collet payment information during the subscription flow and save it to your customer after it's been created (https://stripe.com/docs/billing/subscriptions/elements). It really just depends on your integration. I'd recommend reading both of those docs through
Got it! thanks
Well this is weird
Sorry, but I guess the dashboard will only populate the new card into default_source?
no matter which way I try
Checking in to this...
Adding one for myself on the dashboard added it as a PaymentMethod. Where on the dashboard did you add this?
Interesting, I used the same thing. Do you have the id for a customer you did that with?
here!
Interesting. I see that yours was added as a Source and mine a PaymentMethod. Still looking in to why that may be
So you need to be able to attach this card as a PaymentMethod to that specific customer?
That's what karbi suggested, so I would want to do that yeah
Did you enter address details and all that (other than card deets?)
Also, slightly unrelated question but when a user subscribes with a new card, does the card go under the subscription's default payment method or the user's default payment method? (We want the latter to happen)
I did not on the first but can test that in a second. And I will check in to that second question but off of the top of my head I think it is the subscription's default
But I will have to check
You will be setting the customer's invoice_settings.default_payment_method https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
SetupIntent would be the way to collect that info as a PaymentMethod which you can then set invoice_settings.default_payment_method to