#vitorleitao_unexpected
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1389576454131679273
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
A few things I wrote wrong
I then paid the card, which saved the payment method in the customer, but it did change the subscriptions payment method => should be => I then paid the invoice, which saved the payment method in the customer, but it did change the subscriptions payment method
๐ happy to help
Hey tarzan
Sorry if this is stupid and explained somewhere I missed, I just found it odd and wanted to confirm the behaviour
yes you need to manually update the DPM https://docs.stripe.com/api/subscriptions/update#update_subscription-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.
Cool cool
What would be the best webhook to do this on?
The Invoice.Paid one?
yes
Let me go and see the webhook data we receive to see if the payment method is there
one sec
looks like its not
What would be the best way to get the payment method id? Via the Charge or the Payment Intent?
we don't recommend using the data that you receive from the event, instead you should retrieve the object back from our API and expand on whatever properties you need
what API version are you using?
Which property would be the best to expand on?
Currently I am expanding on payments.data to get the payment intent
I am using the Stripe.net library. Version 48.2.0 which I believe is the api version 2025-05-28.basil
yes you'd need to expand the payments.data.payment.payment_intent
which should give you the PM used on that PI
So would my expand look like this?
Invoice fullInvoice = await invoiceService.GetAsync(
invoice.Id,
new InvoiceGetOptions()
{
Expand = new List<string>() {
"payments.data",
"payments.data.payment.payment_intent"
}
}
);
(Sorry we are not used to using the expands yet)
or do I need to also expand payments.data.payment ?
Perfect, let me go and try that out
Thanks @rocky galleon
let me know if you need any more help