Refund a paid payment link
/businesses/{bid}/payment-requests/{id}/refundRequires the documents scope.
Gives the money of a paid link back to the card that paid it, then issues the document that corrects its receipt: a negative קבלה (400) for a קבלה, or a חשבונית זיכוי (330) and the negative קבלה that records the money for a חשבונית מס/קבלה (320). In full by default; amount for a part, with a reason. Never more than was paid less what already went back. The invoice the receipt had closed is owed again by the refunded amount. Idempotency-Key is required: the same key is the same refund, wherever it stands. If the document fails after the money moved, the refund is refunded with documentError, and the same call issues it without asking the card company again. If the card company gives no answer the call is 409 and the refund is unknown: look in the terminal, then repeat with resolve. payment_request.refunded is sent once the document is issued. A payment on a real terminal answers 422 not_supported today (see refundable); the sandbox's simulated terminal refunds.
Path parameters
bidstringrequiredPOST /businesses.idstringrequiredHeaders
Idempotency-Keystringdeduped: true instead of creating a duplicate. Interchangeable with externalRef in the body.Body (optional)
amountintegerreasonstringresolvestringunknown: what the owner found in his terminal. One of: refunded, not_refunded.idempotencyKeystringIdempotency-Key header.Response
200: { "ok": true, … }
okbooleanrequiredpaymentRequestPaymentRequestrequiredstatusstringrefunded, withdrawn.refundobjectpaymentRequest.refunds.documentobjectShowHide 3 child attributes
document.idstringdocument.docTypeintegerdocument.docNumberintegerdedupedbooleanErrors: 400, 401, 403, 404, 409, 422, 429. Every failure answers { "error", "reason", "hint", "param", "doc_url", "retryable", "request_id" }: branch on reason, and read hint for what to change (https://docs.billos.co.il/errors.md).