#shpatak
1 messages · Page 1 of 1 (latest)
Hello! The status on a Charge object indicates the status of the payment: https://stripe.com/docs/api/charges/object#charge_object-status
Refund objects have a separate status: https://stripe.com/docs/api/refunds/object#refund_object-status
interesting
I am using this card to test pending -> succeeded charge refund
however after charge.succeded on refunding the money, I get the following 2 statuses events with statuses: 1) event: charge.refunded, status: succeeded, object: charge 2) event: charge.refund.updated, status: succeeded, object: refund
Yeah, the payment succeeded. The status of the original payment success won't change.
You need to look at the associated Refund object, which is not inside the charge.* Events sent to your Webhook Endpoint.
I am listening to all webhook events.
here is charge.refunded object:
{"id":"ch_3MekLaK1mDNK4xVY0Se65Aue","object":"charge","amount":10946,"amount_captured":10946,"amount_refunded":10946,"application":null,"application_fee":null,"application_fee_amount":null,"balance_transaction":"txn_3MekLaK1mDNK4xVY0DCi6kMC","billing_details":{"address":{"city":null,"country":"US","line1":null,"line2":null,"postal_code":"12312","state":null},"email":null,"name":null,"phone":null},"calculated_statement_descriptor":"WWW.MYCLOTHESARETHEBES","captured":true,"created":1677180062,"currency":"usd","customer":"cus_NHfbLqdl118zzZ","description":null,"destination":null,"dispute":null,"disputed":false,"failure_balance_transaction":null,"failure_code":null,"failure_message":null,"fraud_details":{},"invoice":null,"livemode":false,"metadata":{"orderOfferId":"63f6a32a0e8a56088d305124","orderId":"63cb101f65315784404591af","customerId":"6335fd43454eac16b502ccbc","travelerId":"6335fd1f454eac16b502ccb8"},"on_behalf_of":null,"order":null,"outcome":{"network_status":"approved_by_network","reason":null,"risk_level":"normal","risk_score":33,"seller_message":"Payment complete.","type":"authorized"},"paid":true,"payment_intent":"pi_3MekLaK1mDNK4xVY0wmpPjBU","payment_method":"pm_1MekLiK1mDNK4xVYtBcj3QjO","payment_method_details":{"card":{"brand":"visa","checks":{"address_line1_check":null,"address_postal_code_check":"pass","cvc_check":"pass"},"country":"US","exp_month":12,"exp_year":2031,"fingerprint":"nl50EvfeV7Tvd4bt","funding":"credit","installments":null,"last4":"7726","mandate":null,"network":"visa","three_d_secure":null,"wallet":null},"type":"card"},"receipt_email":null,"receipt_number":null,"receipt_url":"https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xS1ViT0dLMW1ETks0eFZZKPT53p8GMgaQmJVJHo46LBZIHyIdVO5DvJbipS-O_iNwQgkTU6104G5B7eo779SHOsIrJfvUxbigG3GU","refunded":true,"review":null,"shipping":null,"source":null,"source_transfer":null,"statement_descriptor":null,"statement_descriptor_suffix":null,"status":"succeeded","transfer_data":null,"transfer_group":null}
and here is charge.refund.updated {"id":"re_3MekLaK1mDNK4xVY02zih4vL","object":"refund","amount":10946,"balance_transaction":"txn_3MekLaK1mDNK4xVY0aBX3kAJ","charge":"ch_3MekLaK1mDNK4xVY0Se65Aue","created":1677180147,"currency":"usd","metadata":{},"payment_intent":"pi_3MekLaK1mDNK4xVY0wmpPjBU","reason":null,"receipt_number":null,"source_transfer_reversal":null,"status":"succeeded","transfer_reversal":null}
according to image from the documentation I've sent you above, the charge.refunded should have pending status somewhere
Right. Those Events contain the Charge object. You need to fetch the Refund object from the API to get the status of the Refund.
The Refund ID is re_3MekLaK1mDNK4xVY02zih4vL and you can retrieve it using this endpoint: https://stripe.com/docs/api/refunds/retrieve
Yes, i get it
as I understand, based on documentation of this image, i have charge.succeeded then charge.refunded then charge.refund.updated with the following statuses: charge succeeded then refund pending then refund succeeded
That is not correct.
however the second object is of type charge which doesn't have refund id which means I cannot check the pending status of the refund
The status of the Charge itself does not change. The status of the Refund is what changes.
You can fetch the Charge from the API and expand the refunds property to get the Refund detail: https://stripe.com/docs/api/charges/object#charge_object-refunds
I am testing 4th time and cannot catch pending status
the refund object always has succeeded status
When you get the charge.refunded event (eg: https://dashboard.stripe.com/test/events/evt_3MekLaK1mDNK4xVY0mAOmj23 ) you need to retrieve the charge and expand the refunds property as my colleague explained
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
The object in that event is the charge not the refund
You need to get the refund object
The later refund updated event is the refund object
hm, interesting, charge.refunded is already an charge, and I have to retrieve it again but expand
let my try
You're trying to get the refund object status, so you need to get the refund object
Oh I actually remember, somewhere in documentation is mentioned that data which arrives in events is not expanded by default - so we need to do by ourselves
Yes this is noted in the Charge object API reference as expandable meaning you need to retreive it
NP!
and sorry for miscommunication