#vitorleitao_unexpected

1 messages ยท Page 1 of 1 (latest)

frank sorrelBOT
#

๐Ÿ‘‹ 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.

silent hollow
#

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

frank sorrelBOT
rocky galleon
#

๐Ÿ‘‹ happy to help

silent hollow
#

Hey tarzan

Sorry if this is stupid and explained somewhere I missed, I just found it odd and wanted to confirm the behaviour

rocky galleon
silent hollow
#

Cool cool

What would be the best webhook to do this on?
The Invoice.Paid one?

rocky galleon
#

yes

silent hollow
#

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?

rocky galleon
#

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

rocky galleon
silent hollow
#

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

rocky galleon
#

which should give you the PM used on that PI

silent hollow
#

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 ?

rocky galleon
#

you only need the latter

#

it would work for both

silent hollow
#

Perfect, let me go and try that out

Thanks @rocky galleon

rocky galleon
#

let me know if you need any more help

silent hollow
#

will do

#

Nice that worked perfectly

Thanks for that @rocky galleon