PilotFoxDocs

Refund a recorded payment

POST
/api/v1/sites/{siteId}/payments/{paymentId}/refund

Sets the refunded total of a payment recorded through this API (not a synced provider's): the whole amount by default (the body may be left out), or refunded_amount (the total so far, so sending it again changes nothing). 404 when no such payment was recorded. 300 requests a minute per API key.

Requires an API key holding revenue:write on the site. Session cookies and share links: 401.

Authorization

headerx-api-key<token>

An organization API key (ak_…), with the permissions and the sites it was created with. For servers and scripts: no cookie and no Origin check. Also accepted as Authorization: Bearer ak_… (apiKeyBearer). A request carries one credential: a key sent with a share token or a live session cookie is 400 (details.reason: ambiguous_credentials).

Scope: revenue:write

Path Parameters

siteId*string
paymentId*string

Your billing system's id of the payment (order, transaction or invoice id), unique within the site

Match^[!-~]{1,255}$

Request Body

application/json
  1. body
refunded_amount?|

The total refunded so far (not this refund's part), 0 to amount; default: the whole amount

Response Body

OK

application/json
  1. response
data*
Example Request
curl -X POST 'https://pilotfox.app/api/v1/sites/string/payments/string/refund' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response200
{  "data": {    "payment_id": "string",    "provider": "custom",    "ts": "string",    "amount": 0,    "currency": "string",    "refunded_amount": 0,    "status": "paid",    "attribution": "checkout_ref"  }}