Issue a refund
harbor_issue_refundRefund part or all of a paid invoice using a two-step flow: preview changes, then confirm with a token to execute.
Instructions
Refund part or all of a paid invoice. Requires two calls.
Call 1 — omit confirm_token. Returns a preview of exactly what would change, plus a token valid for 5 minutes. Call 2 — pass that token with identical arguments. The refund is written.
Args:
invoice_id (string): exact id, format inv_00123
amount_cents (number): 1 to 50000
reason (string): 4-200 chars, stored in the audit log
confirm_token (string, optional): omit first, then supply
Returns for the preview call: { "stage": "preview", "confirm_token": string, "expires_in_seconds": number, "invoice": { id, customer_id, amount_cents, already_refunded_cents, status }, "would_refund_cents": number, "resulting_refunded_cents": number }
Returns for the execute call: { "stage": "executed", "invoice_id": string, "refunded_cents": number, "total_refunded_cents": number }
Refuses when: the invoice does not exist, is not paid, or the refund would exceed the amount actually charged.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | Yes | Why this refund is being issued. Stored in the audit log. | |
| invoice_id | Yes | Exact invoice id to refund against. | |
| amount_cents | Yes | Amount to refund, in cents. Maximum 50000. | |
| confirm_token | No | Omit on the first call to get a preview. Pass the returned token to execute. |