#dahri_code
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/1282929102944469023
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- dahri_code, 21 hours ago, 6 messages
Hi there, so you want to refund the first invoice created by the subscription?
Heyy,
Not first invoice just regular subscription.
Can you elaborate?
I did not get the first invoice, like what its mean? user can have multiple subscriptions
I just want to know which payment you want to refund. A subscription would generate invoices, and each invoice is associated with a payment.
Or do you mean you want to refund all inoivces generated by a subscritpion?
can you please share which invoices should be returned and which to keep?
because i just have to refund the payment, dont have idea regarding invoices
https://docs.stripe.com/api/invoices/list#list_invoices-subscription you can use this API to retrieve all inovices associated with a subscription.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
https://docs.stripe.com/api/invoices/object#invoice_object-payment_intent for each invoice, you can retrieve its payment_intent ID from the inboice object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
https://docs.stripe.com/api/refunds/create#create_refund-payment_intent and use the payment_intent ID to create a refund
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
thank you jack for helping,
But im using stripe.checkout.sessions.create not payment_intent, there i cant find payment_intent_id in the webhook event
Is it a subscription mode checkout? If it's is, you can listen to checkout.session.completed and get the subscription ID from the checkout session object. https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hmm, I thought I've answered this. You can't refund a subscription directly, but you can refund the paymentIntents associated with the invoices that the subscription created.
Can you take a look at the information that I shared earlier?
But the thing is we can not get paymentIntents through checkout.session.completed, so how i can refund?
In case you missed my earlier messages.
https://docs.stripe.com/api/invoices/list#list_invoices-subscription you can use this API to retrieve all invoice associated with a subscription.
https://docs.stripe.com/api/invoices/object#invoice_object-payment_intent for each invoice, you can retrieve its payment_intent ID from the invoice object
https://docs.stripe.com/api/refunds/create#create_refund-payment_intent and use the payment_intent ID to create a refund
let me go through this
getting this error while subscriptionId is correct,
{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such subscription: 'sub_1PxLqSS4f9sxCRXIeeJEzPfi'",
"param": "id",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_OnVSjismKucs8Q?t=1725947023",
"type": "invalid_request_error"
}
}
this is happening while retrieving invoices by subscriptionID