#dingkai031
1 messages · Page 1 of 1 (latest)
Yes, you can retrieve the invoice with payment_intent expanded, and check its last_payment_error (https://stripe.com/docs/api/payment_intents/object#payment_intent_object-last_payment_error)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ah, thank you will try that
hello, I was listen to invoice.payment_failed on webhook and got the payment_intent id in the event data.
After that I use paymentIntents->retrive with the payment_intent ID. But the last_payment_error doesn't show anything
Can you share with me the event ID?
evt_1MAA63BBuNcFsmgMaZf4CIPB
hello, this is my event ID
Thanks for the waiting. I was with another user, let me take a look.
OK, since there's no default_payment_method in either the customer's invoice_settings or in the subscription itself, there's no payment attempts and thus no payment errors.
sorry, isn't a charge_automatically is attempting a payment?
But there's no default_payment_method attached to attempt a payment
how to add it? because this is a second payment attempt. the previous is using a stripe elements... I thought it's added automatically
and in test mode, I'm using a test clock.. it ran without a problem..
by second payment attempt, I mean a user is subscribed to a service... when starting the service... the user pay using payment elements
and it failed on the next invoive
To automatically set payment_method that's used in the first payment as the default_payment_method, you should set the payment_settings.save_default_payment_method to on_subscription, you can find example code here (https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#create-subscription)
ah okey thanks, is there a way to set it in ongoing subscription?
Sure, you can update an existing subscription's default_payment_method through update API (https://stripe.com/docs/api/subscriptions/update#update_subscription-default_payment_method)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I have update it, but in the dashboard it still requires_payment_method is that normal?
The PaymentIntent ID?
pi_3MAA62BBuNcFsmgM0aGiL8SI
this is it
The default_payment_method was attached on 2022-12-02 04:07:36 UTC, but this payment_intent was created 2022-11-30 09:32:18 UTC, which is before the default_payment_method was attached.
The default_payment_method will be used in the next payment retry, as well as the upcoming invoice. If you are using test clocks, you can advance the test clock and see how it works.
okay understand, thank you