#mrredline-invoicepay-api
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- mrr3dl1ne, 17 hours ago, 32 messages
My thoughts are - for more immediate feedback for the user, if stripe.Invoice.pay returns true I will consider that successful. If it returns false, I would then lookup the invoice, then the paymentintent to return to them the reason of the decline
let me know if there's a better pattern
I'd actually say check the status of the invoice that you get back https://stripe.com/docs/api/invoices/object#invoice_object-status
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If it is paid then the invoice is paid successfully
if it is open you will want to also check the status of the invoice's payment intent as it may be processing if you are using a payment method like ACH
ok thank you will do
And for that second one you can use expansion to get the status for both of them in the response to your pay call https://stripe.com/docs/api/expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
thats awesome! thank you
last question - i notice when the payment fails, the invoice.pay call throws an exception so I'm not able to capture the invoice. i have to make a manual call to the invoice.
is there a way to make it not exception and just return the invoice?
HI 👋
I'm stepping in as my colleague had to go. There isn't a way to change how the API responds (200 vs 4xx) so you would need to catch that exception and perform the handling in your code.
ok thank you