#blagi.connecto
1 messages · Page 1 of 1 (latest)
Hello, can you explain the amount_refunded behavior that you are asking about a bit more? Are you saying that the amount always shows the payment total? Or that it is missing for partial refunds?
We have often partially refund. For example, once 5 €, second 3 €. On second charge.refunded, amount refunded is 8. 3 is not 'mentioned' anywhere in paylod charge ocject.
amount refunded = amount_refunded field
Hi Pompeye thanks for helping.
Can you send me the ID of a charge.refunded event that you saw this with? (evt_123)
ch_3NSJXEHyMHmjD7NO1j5i9QyI
It's a test one. I'm testing changing from live refund to webhook based.
Thanks, looking in to the events for that charge
Sorry I added one letter to your nickname. 😦
Apologies the server is busy so it took me a bit to look in to this. It looks like we do include "amount_refunded": 500, on the charge object itself. The charge.refunded event is still for the full Charge object, so the amount is referring to the overall amount on the charge and amount_refunded is a field we provide to specifically talk about the refund https://dashboard.stripe.com/test/events/evt_3NSJXEHyMHmjD7NO1hElhbdI
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
So information about one particular refund is missing?
In timeline for related payment_intent on dashboard I can that amount, but how to retrieve it?
No it isn't missing
It is in the amount_refunded field
Which is present in the event that you got
3 € are on the timeline, but I do not have that amount in charge.refunded event payload!?
Am I missing some related event type?
I think for charge events you would need to calculate that amount
There is a refund.created event that will probably show you this amount more straightforwardly
I thought that all event types are included in test environment!? I didn't got refund.created event!?
My apologies, it looks like that event isn't for this kind of refund scenario:
Occurs whenever a refund from a customer’s cash balance is created.
So I think the best way would be to calculate this.
So in that second event, there is a previous_attributes hash, it tells you what has changed on the charge since the last event. This one says
"amount_refunded": 500,
...
}```
So your refund amount will be `amount_refunded` - `previous_attributes.amount_refunded`
Ex: On the first event previous_attributes.amount_refunded was 0 and amount_refunded was 500. So the refund amount was 500 - 0 = 500
Then on the second event previous_attributes.amount_refunded was 500 and amount_refunded was 800. So the refund amount was 800 - 500 = 300
In event data exists this:
[previous_attributes] => Stripe\StripeObject Object
(
[amount_refunded] => 500
[receipt_url] => https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xTXlDUUdIeU1IbWpEN05PKK__r6UGMgYvg98fEso6LBafmL9fC326yORuzJmruu-pIU3mvWpX1ET_ONmZ7bqHZhwXmwdeD3b4xwG7
)
API description:
data.previous_attributes
hash
Object containing the names of the updated attributes and their values prior to the event (only included in events of type *.updated). If an array attribute has any updated elements, this object contains the entire array. In Stripe API versions 2017-04-06 or earlier, an updated array attribute in this object includes only the updated array elements.
Can I use this data for calculating?
Yes
Ex: On the first event
previous_attributes.amount_refundedwas 0 andamount_refundedwas 500. So the refund amount was 500 - 0 = 500Then on the second event
previous_attributes.amount_refundedwas 500 andamount_refundedwas 800. So the refund amount was 800 - 500 = 300