#!undefined-paymentmethod

1 messages · Page 1 of 1 (latest)

tidal inlet
#

Hi! Can you share the customer ID, and how you are currently trying to retrieve the default payment method?

brittle palm
#

cus_id: cus_K1snuv1TnTWR5p
I use the SubscriptionService.GetAsync method in the .Net SDK

tidal inlet
brittle palm
#

Yes

tidal inlet
#

The customer you shared does have a default payment method, but I'm guessing the subscription doesn't. That why it's not working.

brittle palm
#

How can I set it to be the same one as the customer one >

#

cause the payment method is shown on the subscription page as well

tidal inlet
brittle palm
#

Can't I do this from the web page ?

#

But it's already saying this

tidal inlet
#

Setting the default payment method on the subscription needs to be done with the API. But I'm not sure to understand why you need to do this. If the default payment method is set on the customer, then the subscription will automatically use that and it should work.

brittle palm
#

Yup that's correct

#

But the issue is that when I get the subscription, the default payment method is null

tidal inlet
#

Yes that's expected since it wasn't set there, in your case the default payment method is set on the customer.

brittle palm
#

But I don't why it's changed now

#

It used to fetch the default payment method for the customer when I pass the subscription id

tidal inlet
#

Can you share the subscription ID you are looking at?

brittle palm
#

sub_1KBdE3I1aLYfeD6WTFAEjizM

silk niche
#

Thank you. soma had to step out but I am catching up and checking in to your subscription

#

Is fetching that payment ID not working for you now? I do see it on the customer object

brittle palm
#

I'm using the SubscriptionService.GetAsync(subscriptionId)

#

But then the DefaultPaymentMethodId is always null

silk niche
#

Right, that is expected here. That field is set on the Customer not the Subscription, so you will need to retrieve the Customer here.

#

What behavior has changed here for you?

brittle palm
#

It's passing it the subscriptionId

#

It's used to be the actual payment method

sweet reef
#

The customer invoice settigns default PM will be used to pay their subscription invoices, but the value wont be returned on the subscription object, that's not expected

#

That field is for when you're setting an explicit default PM for that individual subscription (where eg you want it to be different than the customer default)

#

The PM will still be reflected on each paid invoice, so you could for example look at the latest_invoice

brittle palm
#

Then how do I get the default payemnt method of a customer ?

sweet reef
#

You would examine the customer object

#

If you want, you can use expansion when retrieving the subscription to have the customer object included in teh response:
https://stripe.com/docs/api/expanding_objects https://stripe.com/docs/expand
ie add expand[]=customer to your subscription retrieval

Learn how to reduce the number of requests you make to the Stripe API by expanding objects in responses.