Payments
Refund a payment
Give money back, in part or in full, and know when it has actually gone.
A refund is a thing, not a verb. It has its own identifier, its own status and its own settlement date, so you refund by creating a refund that names the payment, rather than by sending a command to the payment.
Name the transaction in subject. Omit amount to refund everything not already refunded, which is the common case and safer than computing the remainder yourself.
Request
curl -X POST "https://api.tst.au.apgpay.dev/bezel/refunds" \
-H "Authorization: Bearer $API_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"subject": {
"transactionId": "tran_9mK2xQvR4bYtL7pD",
"type": "RfndSubjectTransaction"
},
"amount": {
"minorCurrencyUnits": 2500,
"currency": "AUD"
},
"metadata": {
"reason": "returned goods"
},
"type": "RfndCmdCreate"
}'This is the acquiring side. A refund of a card the platform issued is a different thing with a different lifecycle, and it is read on the issuer transaction itself rather than created here.
A created refund is not a settled refund. The refund carries its own settlement date, and until then the money has left your balance but not arrived.
Request
curl -X GET "https://api.tst.au.apgpay.dev/bezel/refunds/<useRefundIdFromStep1>" \
-H "Authorization: Bearer $API_SECRET_KEY"The transaction embeds its refunds, so you can check what is already refunded before creating another.
Request
curl -X GET "https://api.tst.au.apgpay.dev/bezel/transactions/<useTransactionIdFromSeed>/refunds" \
-H "Authorization: Bearer $API_SECRET_KEY"See reconcile a payout.
