#app-afterpay-events

1 messages · Page 1 of 1 (latest)

opal spireBOT
desert raven
#

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

silver oasis
#

great, correct me if I'm wrong, the charge.succeeded is the actual event that indicates the the payment was done successfully

desert raven
#

Correct, that's for the underlying charge succeeding

silver oasis
#

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'?

desert raven
#

Huh strange.. Can you share the example PaymentIntent?

opal spireBOT
ocean wraith
#

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 get payment_intent.payment_succeeded. Really the charge.* Events are more here for legacy reasons for older integrations.
In your case you should focus on PaymentIntent specific Events

silver oasis
#

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?

ocean wraith
silver oasis
#

ok, great, can I find a similar field like latest_charge in the payment_intent.failed?

ocean wraith
#

yes

#

But not all failures will create a Charge, you also want to look at last_payment_error

silver oasis
#

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)?

ocean wraith
#

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

silver oasis
#

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?