#nicolas-m_webhooks
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/1318329491386404934
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
You can expand the Invoice associated with the charge and check if there's a not null subscription parameter under the invoice object - https://docs.stripe.com/api/charges/object#charge_object-invoice
https://docs.stripe.com/api/invoices/object#invoice_object-subscription
So, the two charges we are seeing (recurring and non-recurring) are these:
which the first one is the non recurring charge
but there is (in non-rec. billing) a subscription parameter, with just an ID, but it is not null
what's the ID?
the charge id?
the not null subscription parameter
I got confused, sorry, it's not the subscription id, but an invoice id, so in this case there is no invoice object, but just an id, on both occasions
Correct. Invoice can be of one-off or recurring type.
You can retrieve the charge object and expand invoice property to see if there's a subscription parameter under invoice - https://docs.stripe.com/api/expanding_objects
OR You can retrieve the invoice using the API to see if the returned object has a subscription parameter - https://docs.stripe.com/api/invoices/retrieve
If subscription is null then its a one-off payment. Otherwise, it is recurring payment.
get it, just one more question, can we expand the invoice object on the webhook response? (just as the object sent on Non Rec Stripe(1).txt)
Webhook responses can't be expanded. You'd need to make a separate API request to retrieve the object
okay, perfect, thank you for the patience and collaboration!