> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stablegenius.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Payment Intent

> Cancel an awaiting payment intent

# Cancel Payment Intent

Cancels a payment intent that is in `awaiting_payment` status. Cannot cancel intents that have already been confirmed, expired, or settled.

## Path Parameters

<ParamField path="id" type="string" required>
  The payment intent ID (format: `pi_*`).
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.stablegenius.co/v1/payment-intents/pi_xyz789/cancel \
    -H "Authorization: Bearer sk_test_abc123"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.stablegenius.co/v1/payment-intents/pi_xyz789/cancel',
    {
      method: 'POST',
      headers: { Authorization: 'Bearer sk_test_abc123' },
    }
  );

  const cancelledIntent = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "id": "pi_xyz789",
    "object": "payment_intent",
    "status": "cancelled",
    "amount": 4.50,
    "currency": "usd",
    "merchant_id": "mer_abc123",
    "cancelled_at": "2026-04-01T20:02:30Z",
    "metadata": { "order_id": "order_456" },
    "created_at": "2026-04-01T20:00:00Z"
  }
  ```

  ```json 409 Conflict theme={null}
  {
    "error": {
      "type": "invalid_request_error",
      "message": "Cannot cancel a payment intent with status 'confirmed'",
      "code": "intent_not_cancellable"
    }
  }
  ```
</ResponseExample>
