#krileon_api
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/1370445154061783163
π Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi hi! You can access it by expanding latest_invoice.payments.data.payment.payment_intent: https://docs.stripe.com/billing/subscriptions/overview#:~:text=latest_invoice.payments.data.payment.payment_intent
that's only if i have a subscription object a refund webhook doesn't have a subscription id only a charge id or payment intent id
basically i need to find the invoice object based off the charge id as in what invoice the charge belongs to
Which Refund event are you listening to?
charge.refunded
How is the refund being initiated?
from the stripe dashboard
the refund object and the charge object have no reference to their subscriptions nor do they inherit the metadata from their subscriptions it's a serious problem of disconnect going on and wasn't a problem when charge contained invoice id
basically there's no reverse lookup.. i would assume that'd be something that could easily be added to the search api via a query, but that's not supported either
i've got customers at a stand still here due to this mess because subscription future invoices don't send webhooks in the api version they were created with (we're using versioned headers) so we end up getting basil webhooks despite sending an older version.. you can see where this nightmare is beginning lol
π Taking over this thread, catching up now
I'm still checking how to find the subscription ID with a given Charge / Refund ID in basil
it's not subscription that i'm needing i need to get the invoice that the charge belongs to
so the chain that stripe has is basically subscription -> invoice -> charge.. subscription references invoice via latest_invoice.. invoice references subscription via parent.subscription_details.subscription... but charge no longer references invoice and it doesn't reference subscription either
so i've no way of knowing what invoice the charge came from
all your webhooks, except invoice webhooks, include charge or payment intent.. with no way of doing reverse lookup there is no way to find their invoice
this was never a problem before since charge contained invoice, which made perfect sense as a charge can be initiated by an invoice
Totally understand that. Before basil, it's possible to find the Payment Intent ID and Invoice ID with a given Charge ID before basil. I'm still check how this can be achieved in basil
Thanks for waiting! Stripe introduced the new API called Invoice Payment API, which you can retrieve the Invoice with a given Payment Intent ID: https://docs.stripe.com/api/invoice-payment/retrieve?api-version=2025-04-30.basil&lang=curl
So the flow will be:
- Find the
payment_intentID in the Charge object - Use Invoice Payment API to retrieve the invoice ID from the
payment_intentID in step 1
You will find Invoice ID in invoice field: https://docs.stripe.com/api/invoice-payment/object?api-version=2025-04-30.basil&lang=curl#invoice_payment_object-invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
that retrieves an invoice payment by invoice payment id so and id prefixed with inpay_
Sorry my bad
It should be this: https://docs.stripe.com/api/invoice-payment/list?api-version=2025-04-30.basil&lang=curl
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The Payment Intent ID can be set at payment.payment_intent field
We recently introduced a new API release process last year: https://stripe.com/blog/introducing-stripes-new-api-release-process
The idea is that twice a year we plan to release a new API version that contains breaking changes and in between we release an update to the latest API version that has only additive changes
we're already following api best practices by versioning our calls.. problem is Stripe doesn't honor them for webhooks lol
so when we create a subscription with basil all future webhooks for that subscription should be basil, but they're not.. the'll be versioned to the webhook version
our issues are 100% with webhooks rest of our code is 100% functional lol
Thanks for sharing the feedback! We will forward this to the relevant team on how we can improve the development experience
On the Webhook version, it's possible to set to a specific API version via API: https://docs.stripe.com/api/webhook_endpoints/create#create_webhook_endpoint-api_version
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
we'll look into adding support for automating webhook creation but for now they just copy our url into webhooks UI
i don't see a way to set the version in the update endpoint only create endpoint though so we wouldn't be able to update the version
API version can only be set at creation, but not update. This is expected
You'd need to create a new Webhook endpoint and delete the existing one if you would like to set to a specific version
well just another suggestion for the team i suppose lol this would let us entirely automate it.. delete and recreate would work yeah, but updating existing would be single call
the api is great, but sometimes the round trips are a bit much
We hear you! Thanks for sharing the feedback and this will be shared with the product team for future consideration
ok i can confirm the proposed solution works, thanks
No problem! Happy to help π
well i don't have any further questions.. not sure if i just leave the thread to close this out, but i hope ya have a great weekend!