#Gesundheit-default-paymentmethod

1 messages · Page 1 of 1 (latest)

outer anvil
#

Hello! Do you have the customer ID that you're trying to get the default for?

tight elbow
#

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)

outer anvil
#

What's the customer ID (cus_xxx)?

tight elbow
#

hmm, i'm seeing that a customer object has both
default_source and invoice_settings.default_payment_method

#

ID: ||cus_KGNSSmcRwsp7xL||

tight elbow
outer anvil
#

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

tight elbow
#

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?

outer anvil
#

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)

tight elbow
#

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?

outer anvil
#

Ah, are you asking what takes precedence if both are set?

tight elbow
#

yep

#

(sorry for having so many questions haha)

outer anvil
#

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

tight elbow
#

I'l check that out momentarily!

#

so... based on your explanation, I feel like default_source is old stuff?

outer anvil
#

Yes, default_source is meant for use with our legacy APIs (which we still support, but no longer recommend for new integrations)

tight elbow
#

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)

outer anvil
#

Yeah our dashboard sometimes is built on top of our older apis and haven't been updated yet

tight elbow
#

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

outer anvil
tight elbow
#

Got it! thanks

tight elbow
#

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

crimson karma
#

Checking in to this...

#

Adding one for myself on the dashboard added it as a PaymentMethod. Where on the dashboard did you add this?

tight elbow
#

sorry for the late reply

#

Customers/[customer]/Payment Methods/+

crimson karma
#

Interesting, I used the same thing. Do you have the id for a customer you did that with?

tight elbow
crimson karma
#

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?

tight elbow
#

That's what karbi suggested, so I would want to do that yeah

tight elbow
#

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)

crimson karma
#

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

tight elbow
#

cool!

#

Yeah, how would I set that to customer's default?

#

Use SetupIntent?

crimson karma
#

SetupIntent would be the way to collect that info as a PaymentMethod which you can then set invoice_settings.default_payment_method to