Create a refund
POST/v1/orders/{id}/refunds
Records a refund you already made to the guest's card, so unPLUG takes back the points the refunded part earned. Send one call per refund, partial or full.
Permissions: Secret key with checkout:write.
Guide
Checkout and ordersRequest headers#
Idempotency-KeystringRequiredRequired on this endpoint. Any string up to 255 characters; use a UUID v4. Missing returns400 idempotency_key_required.Max Length 255
Path parameters#
idstring (uuid)Required
Request body#
external_refund_idstringRequiredYour refund id.amount_centsintegerFor a partial refund: the part of the subtotal after discounts that you refunded. Leave out tax and tip. Send this orfull.Min 1fullbooleantrueto refund everything not yet refunded.reasonstringYour reason, for examplerequested_by_customer.
Response fields#
Returns 201 with Refund
idstring (uuid)order_idstring (uuid)external_refund_idstringYour refund id.amount_centsintegerThe part of the subtotal after discounts that was refunded. For a full refund, everything not refunded before.Min 0fullbooleantruefor a full refund.reasonstringNullableAs you sent it.points_reversedintegerEarned points taken back.points_shortfallintegerPoints that couldn't be taken back because the member had already spent them. The balance stops at zero.order_statusstringThe order's status after this refund:partially_refundedorrefunded.One ofpartially_refunded,refundedmember_idstring (uuid)NullableThe order's member.nullfor a guest order.memberobjectNullable{ "points_balance" }after the refund.nullfor a guest order.Show attributesHide attributes
points_balanceinteger
created_atstring (date-time)
What a refund does#
- Earned points are reversed in proportion:
points_earned×amount_cents÷ the order's subtotal after discounts, rounded down. The member gets areverseactivity entry. - Partial refunds keep the redemption
captured. The guest keeps the reward. - A full refund also reverses the redemption: points spent on a points reward come back, and a wallet item or unique code returns to the member if it hasn't expired.
- The balance never goes below zero. If the member already spent the points, the part that can't be taken back is reported in
points_shortfall.
Maya's latte was made with the wrong milk, and you refund $5.00:
The order earned 90 Beans on $9.00, so $5.00 reverses 90 × 500 ÷ 900 = 50 Beans. Maya goes from 510 to 460. The pastry stays used. If you later send "full": true, the other $4.00 and 40 Beans are reversed, the redemption becomes reversed, and the pastry goes back to her wallet if it hasn't expired. The Checkout guide shows a full refund with a points_shortfall.
Warning Send every refund you make. If you skip them, guests keep points for food they got back, and the program's reports overstate sales.
Error descriptions#
The Idempotency-Key header is missing.
Both or neither of amount_cents and full were sent.
No order with this id in your brand.
This refund plus earlier ones would be more than the order's subtotal after discounts, or the order is already fully refunded.
This key was used with a different body.
Any endpoint can also return the common errors.