#app-afterpay-events
1 messages · Page 1 of 1 (latest)
Hello 👋
PaymentIntent creates Charge object underneath for each payment attempt. In case one of the payment attempts fail, the PaymentIntent ID would still be the same, there would multiple charges linked to it.
For fulfilment, you can rely on payment_intent.* events
great, correct me if I'm wrong, the charge.succeeded is the actual event that indicates the the payment was done successfully
Correct, that's for the underlying charge succeeding
ok, and when I run an Alipay payment method and fail it (in test mode), why I don't get charge.failed, and I only get 'payment_intent.payment_failed'?
Huh strange.. Can you share the example PaymentIntent?
app-afterpay-events
the charge.succeeded is the actual event that indicates the the payment was done successfully
that's not really correct. You'd also getpayment_intent.payment_succeeded. Really thecharge.*Events are more here for legacy reasons for older integrations.
In your case you should focus on PaymentIntent specific Events
great, thank you, but there are missing details on the payment_intent_succeeded compared to the charge.succeeded. for example when using card as payment method, in the returned object in the charge.succeeded I've payment_method_details with descriptive details about the payment, e.g., brand name (like visa), where in the payment_intent.payment_succeeded it does not exist..
so, how can I get those details from the payment_intent.payment_succeeded?
a PaymentIntent has the latest_charge: 'ch_123' (or py_123 in this case) and then your code can call the Retrieve Charge API https://stripe.com/docs/api/charges/retrieve to get to that info
ok, great, can I find a similar field like latest_charge in the payment_intent.failed?
yes
But not all failures will create a Charge, you also want to look at last_payment_error
is there any other way to extract the payment_method_details on success rather than sending another request with the latest_charge: 'ch_123' (or py_123 in this case)?
you can listen for the charge.* Events then, I just wouldn't, I'd do what I recommended instead but you're welcome to listen to all Events related to this and then do the reconciliation
ok, can you please show me an example on how to send request with the latest charge id so that I could get back the payment details?