> Solana Developer Platform docs, served as Markdown. The [docs index](https://platform.solana.com/docs.md) lists every page and [llms.txt](https://platform.solana.com/docs/ai/llms.txt) the key ones; [SKILL.md](https://platform.solana.com/SKILL.md) has the rules for building on SDP.

# Cancel payment request

Cancels an open payment request, so its payment link stops building and sponsoring transactions.

`POST /v1/payments/requests/{paymentRequestId}/cancel`

Requires `payment_requests.manage`. Canceling a request that is already canceled returns it unchanged. A paid or expired request returns 409, and so does one whose fee-sponsored transaction can still land: retry once that transaction's blockhash expires. A payer who signed before the cancel can still land the payment; SDP records it as paid, with `paidLate` set when it landed after the cancel.

Requires an [API key](/docs/developing-with-sdp/authentication) with the `payment_requests.manage` action.

## Path parameters

- **`paymentRequestId`** · `string` · required · min length 1 · example `preq_example`

  SDP payment request ID.

## Headers

- **`x-project-id`** · `string` · min length 1 · example `prj_example`

  Required for dashboard sessions. API keys use their assigned project.

- **`Idempotency-Key`** · `string`

  Use a unique 1–255 printable ASCII key per operation. Reuse it with the same request on retries. An in-flight attempt returns `409`; a changed request returns `422`. [Retry and recovery rules](/docs/developing-with-sdp/idempotency).

## Responses

- **`200`** Payment request canceled

  - **`data`** · `object` · required

    A payment request. Reads never carry its link token.

    - **`id`** · `string` · required · example `preq_example`

      SDP payment request ID.

    - **`organizationId`** · `string` · required

      Organization ID.

    - **`projectId`** · `string | null` · required

      Project ID.

    - **`walletId`** · `string` · required

      Receiving custody wallet's provider ID.

    - **`destinationAddress`** · `string` · required · min length 32 · max length 44 · example `So11111111111111111111111111111111111111112`

      Address the payment is sent to.

    - **`token`** · `string` · required

      Token mint address.

    - **`amount`** · `string` · required · example `100.00`

      Token amount in UI units (decimal string).

    - **`reference`** · `string` · required · min length 32 · max length 44 · example `So11111111111111111111111111111111111111112`

      Solana Pay reference account that identifies the payment on chain.

    - **`status`** · `string` · required · one of `awaiting_payment`, `paid`, `canceled`, `expired` · example `canceled`

      Payment request status. `awaiting_payment` is open; `paid` was settled by an on-chain payment; `canceled` and `expired` closed without one.

    - **`expiresAt`** · `string | null` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

      Expiry, if any.

    - **`fulfilledByTransferId`** · `string | null` · required

      The inbound transfer that paid the request.

    - **`paidLate`** · `boolean` · required

      Whether the payment landed after the request expired or was canceled. A payer who signed before then can still pay.

    - **`lastCheckedAt`** · `string | null` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

      When SDP last read the chain for the payment.

    - **`canceledByApiKeyId`** · `string | null` · required

      The API key that canceled the request; null when a member did, or it is not canceled.

    - **`canceledByUserId`** · `string | null` · required

      User ID of the member who canceled the request; null when an API key did, or it is not canceled.

    - **`canceledAt`** · `string | null` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

      When it was canceled.

    - **`lifecycle`** · `object[]` · required

      Every status the request entered, oldest first.

      - **`status`** · `string` · required · one of `awaiting_payment`, `paid`, `canceled`, `expired` · example `canceled`

        Payment request status. `awaiting_payment` is open; `paid` was settled by an on-chain payment; `canceled` and `expired` closed without one.

      - **`at`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

        ISO 8601 timestamp.

    - **`createdBy`** · `string | null` · required

      User ID of the member, or of the API key's creator, who created it.

    - **`createdAt`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

      ISO 8601 timestamp.

    - **`updatedAt`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

      ISO 8601 timestamp.

  - **`meta`** · `object` · required

    Response metadata.

    - **`requestId`** · `string` · required · min length 1 · example `req_example`

      Request identifier for tracing.

    - **`timestamp`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

      ISO 8601 timestamp.

- **`400`** Bad Request

  - **`error`** · `object` · required

    Standard error payload.

    - **`code`** · `string` · required

      Machine-readable error code.

    - **`message`** · `string` · required

      Human-readable error message.

    - **`details`** · `object`

      Optional error details for debugging.

      - **`*`** · `any`

  - **`meta`** · `object`

    - **`requestId`** · `string` · min length 1 · example `req_example`

      Request identifier for tracing.

- **`401`** Unauthorized

  Same fields as `400`.

- **`403`** Forbidden. Requires the `payment_requests.manage` action: an API key must hold it (a module's `manage` or `execute` also covers its `read`), and a signed-in member's organization role must include it. Without it the error is INSUFFICIENT_PERMISSIONS and `error.details.action` names the action. Any other 403 names its own reason.

  Same fields as `400`.

- **`404`** Not Found

  Same fields as `400`.

- **`409`** Conflict

  Same fields as `400`.

- **`422`** Unprocessable Entity

  Same fields as `400`.

- **`500`** Internal Server Error

  Same fields as `400`.

- **`502`** Bad Gateway

  Same fields as `400`.

## Example request

```bash tab="cURL"
curl -X POST 'https://api.solana.com/v1/payments/requests/preq_example/cancel' \
  -H "Authorization: Bearer $SDP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

```ts tab="TypeScript"
const res = await fetch("https://api.solana.com/v1/payments/requests/preq_example/cancel", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SDP_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID()
  }
});
```

```python tab="Python"
import os, requests, uuid

r = requests.post("https://api.solana.com/v1/payments/requests/preq_example/cancel",
  headers={"Authorization": f"Bearer {os.environ['SDP_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())})
```

## Example responses

```json tab="200"
{
  "data": {
    "id": "preq_example",
    "organizationId": "organization_example",
    "projectId": "project_example",
    "walletId": "wallet_example",
    "destinationAddress": "So11111111111111111111111111111111111111112",
    "token": "example",
    "amount": "100.00",
    "reference": "So11111111111111111111111111111111111111112",
    "status": "canceled",
    "expiresAt": "2025-01-01T00:00:00.000Z",
    "fulfilledByTransferId": "fulfilledbytransfer_example",
    "paidLate": false,
    "lastCheckedAt": "2025-01-01T00:00:00.000Z",
    "canceledByApiKeyId": "canceledbyapikey_example",
    "canceledByUserId": "canceledbyuser_example",
    "canceledAt": "2025-01-01T00:00:00.000Z",
    "lifecycle": [
      {
        "status": "canceled",
        "at": "2025-01-01T00:00:00.000Z"
      }
    ],
    "createdBy": "example",
    "createdAt": "2025-01-01T00:00:00.000Z",
    "updatedAt": "2025-01-01T00:00:00.000Z"
  },
  "meta": {
    "requestId": "req_example",
    "timestamp": "2025-01-01T00:00:00.000Z"
  }
}
```

```json tab="403"
{
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "Missing action: payment_requests.manage",
    "details": {
      "action": "payment_requests.manage"
    }
  },
  "meta": {
    "requestId": "req_example"
  }
}
```

Error responses use the [standard error shape](/docs/reference/conventions/errors).
