Refunds
POST /transactions/{transactionId}/refund gives money back on a paid payment.
- With a secret key, the key must have Can refund ticked in the dashboard.
- A connected app needs the
refunds.createscope, and can refund only payments its own connection created.
Refund in full or in part
Section titled “Refund in full or in part”Send nothing to refund everything still refundable:
curl -X POST https://api.spleetz.com/transactions/$TRANSACTION_ID/refund \ -H "Authorization: ApiKey $SPLEETZ_KEY" \ -H "Content-Type: application/json" \ -d '{}'Or say how much, and why:
curl -X POST https://api.spleetz.com/transactions/$TRANSACTION_ID/refund \ -H "Authorization: ApiKey $SPLEETZ_KEY" \ -H "Content-Type: application/json" \ -d '{ "amountMinor": 1200, "reason": "One dish sent back", "reference": "RF-0098" }'| Field | |
|---|---|
amountMinor |
How much to refund, in minor units. Leave it out to refund everything still refundable. |
reason |
Why, up to 500 characters. Recorded with the refund and passed to the card provider. |
reference |
Your own reference for this refund, up to 120 characters, returned in the response. |
legId |
On a split bill, refund only this person’s share. See below. |
A payment can be refunded several times, until the whole of it has been.
The response
Section titled “The response”The refund is made before the response comes back:
{ "transactionId": "...", "reference": "RF-0098", "status": "PartiallyRefunded", "refundedAmountMinor": 1200, "totalRefundedAmountMinor": 1200, "remainingRefundableAmountMinor": 3600, "currency": "GBP", "legs": []}status is PartiallyRefunded or, once everything has gone back, Refunded. Each refund also
sends transaction.refunded, with refundAmountMinor, totalRefundedMinor and
isFullRefund.
Several cards, and split bills
Section titled “Several cards, and split bills”- One person paid on several of their own cards: the refund goes to the smallest card that can take all of it.
- A split bill: the refund is spread across everyone who paid, in proportion to what each
paid, and
legsreports each person’s part. - One person’s share: pass
legId, theshareIdfrom that share’ssplit.*webhook.
{ "legs": [ { "legId": 88121, "memberName": "Ada", "refundedAmountMinor": 600, "totalRefundedAmountMinor": 600, "errorMessage": null }, { "legId": 88122, "memberName": "Sam", "refundedAmountMinor": 600, "totalRefundedAmountMinor": 600, "errorMessage": null } ]}A split bill that expired with only some shares paid can still be refunded: the money that was collected can go back.
When a refund is refused
Section titled “When a refund is refused”| Status | errorCode |
Meaning |
|---|---|---|
400 |
4014 |
More than is left to refund. The message says how much is left. |
400 |
4015 |
The amount must be more than zero. |
403 |
1009 |
This key can’t refund. Tick Can refund for it in the dashboard. |
404 |
4001 |
No such payment for this business, or for an app, this connection. |
409 |
4013 |
The payment isn’t paid, or is already fully refunded. |
409 |
4016 |
Another refund of this payment is under way. Wait for it and try again. |
409 |
4022 |
The payment was made in a way Spleetz can’t refund, such as cash or a bank transfer. Give the money back another way. |
502 |
4006 |
The card provider refused the refund. The message says why. |
Two refunds of one payment never run at once, and a refund can never take back more than was
paid. But a retried refund is a new refund. If a refund request timed out, check
refundedAmountMinor on GET /transactions/{id} to see whether it went through before you
send it again.