#Kalluste
1 messages · Page 1 of 1 (latest)
you'd mostly just have to call https://stripe.com/docs/api/refunds/list#list_refunds-payment_intent and look for refunds that way.
if you hit the 4 limit in expansion you just have to make a separate retrieve call to the ID that is 5 deep instead
My goal is this:
When a new payout is created and stripe sends me a webhook about this I'll save the payout to my DB and create relations so that the refunds and paymentIntents in my database will have a foreign key pointing to a specific payout.
Is there no possiblity to access refund metadata through balance transactions?
well it depends. The Refund object exists on the platform account, not the connected account(assuming you're using Destination charges as your question implies). It won't even create any BT on the connected account unless you use for example reverse_transfer when creating the refund
we are using reverse transfer for all refunds
if it does, the the chan is balance_transaction -> source -> source_refund
i.e. on the connected account you have a BT linked to the transfer getting reversed in a TransferReversal object and then : https://stripe.com/docs/api/transfer_reversals/object#transfer_reversal_object-source_refund to get back to the platform's refund object
yep, with this data.source.transfer_reversal.source_refund I'm almost there
"source_refund": {
"id": "pyr_1N1SDZJu5s15laGC5JBOcVQ7",
"object": "refund",
"amount": 1000,
"balance_transaction": "txn_1N1SDaJu5s15laGCf6p0OuYG",
"charge": "py_3N15q4Ju5s15laGC0cDlrhmX",
"created": 1682591909,
"currency": "pln",
"metadata": {},
"payment_intent": "pi_3N15q4Ju5s15laGC0UumfLED",
"reason": null,
"receipt_number": null,
"source_transfer_reversal": null,
"status": "succeeded",
"transfer_reversal": "trr_1N1SDZJu5s15laGCd1oKWD4q"
},
ah I missed a step, since that's the refund of the incoming 'payment' that represents the transfer arriving.