#!undefined-paymentmethod
1 messages · Page 1 of 1 (latest)
Hi! Can you share the customer ID, and how you are currently trying to retrieve the default payment method?
cus_id: cus_K1snuv1TnTWR5p
I use the SubscriptionService.GetAsync method in the .Net SDK
So you are trying to retrieve the default payment method of the subscription, not of the customer?
https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method
Yes
The customer you shared does have a default payment method, but I'm guessing the subscription doesn't. That why it's not working.
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
There are two place where you can set a default payment method for a subscription: on the customer object (which you are doing) or on the subscription object. Either will work.
If you want to set it at the subscription level, then you can update the default_payment_method of the subscription: https://stripe.com/docs/api/subscriptions/update#update_subscription-default_payment_method
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.
Yup that's correct
But the issue is that when I get the subscription, the default payment method is null
Yes that's expected since it wasn't set there, in your case the default payment method is set on the customer.
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
Can you share the subscription ID you are looking at?
sub_1KBdE3I1aLYfeD6WTFAEjizM
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
I'm using the SubscriptionService.GetAsync(subscriptionId)
But then the DefaultPaymentMethodId is always null
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?
But if you take a look on here:
https://stripe.com/docs/api/subscriptions/retrieve?lang=dotnet
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
It's passing it the subscriptionId
It's used to be the actual payment method
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
Then how do I get the default payemnt method of a customer ?
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