Skip to content

Cancel a contract

POST/v1/contracts/{reference}/cancel

Ends an active layaway plan. No further installments will be collected, and nothing is refunded: what happens to money already paid is between you and your customer.

Authentication — X-Client-Id and X-Api-Key, with the contracts:write scope.

On success the plan moves to cancelled, contract.cancelled is delivered to your subscribed webhook endpoints, and both you and the customer receive an email.

Request

Parameter In Notes
reference path The agreement's public reference.

The request has no body.

curl -X POST "$SHOTPAY_URL/v1/contracts/LAY-8F2KQ0MZXA/cancel" \
  -H "X-Client-Id: $SHOTPAY_CLIENT_ID" \
  -H "X-Api-Key: $SHOTPAY_API_KEY"
$contract = Http::withHeaders([
    'X-Client-Id' => config('shotpay.client_id'),
    'X-Api-Key' => config('shotpay.api_key'),
])->post(config('shotpay.url')."/v1/contracts/{$reference}/cancel")->json('data');
$contract = $client->contracts->cancel($reference);
const contract = await client.contracts.cancel(reference);

Response

200 OK — the Contract, now cancelled, with its schedule.

{
  "data": {
    "reference": "LAY-8F2KQ0MZXA",
    "order_reference": "SO-2026-0042",
    "status": "cancelled",
    "cancelled_at": "2026-08-26T09:12:00+00:00",
    "…": "…"
  }
}

Errors

Status When
401 The header pair did not authenticate.
403 The key is missing the contracts:write scope, or the account is not active.
404 No agreement of yours, in this mode, has that reference.
422 The plan already completed or defaulted.
429 Rate limited. Back off for Retry-After seconds.

See Error Handling.