Skip to Content

Cancel Checkout

POST/checkouts/:checkoutId/cancel

Description

Cancel a pending checkout. Once cancelled, the checkout can no longer be used for payment. This is useful when a customer decides not to proceed with a purchase, or when you need to invalidate a checkout link.

⚠️

Only checkouts with a pending status can be cancelled. Completed or already cancelled checkouts will return an error.

Headers

HeaderDescriptionRequired
AuthorizationBearer token with your API keyyes

Path Parameters

NameTypeDescriptionRequired
checkoutIdstringThe unique identifier of the checkout to cancel.yes

Example Request

const response = await fetch(
  'https://checkout.exodus.com/checkouts/chk_1234567890abcdef/cancel',
  {
    method: 'POST',
    headers: {
      Authorization: 'Bearer sk_live_xxxxxxxxxxxxxxxx',
    },
  }
);

Response

SUCCESSFUL CANCELLATION
{
  "id": "chk_1234567890abcdef",
  "object": "checkout",
  "amount": 5000,
  "currency": "USD",
  "description": "Premium Plan - Monthly",
  "status": "cancelled",
  "checkout_url": "https://checkout.exodus.com/pay/chk_1234567890abcdef",
  "success_url": "https://yoursite.com/success",
  "cancel_url": "https://yoursite.com/cancel",
  "customer_email": "[email protected]",
  "metadata": {
    "order_id": "12345"
  },
  "expires_at": "2024-01-16T12:00:00Z",
  "created_at": "2024-01-15T12:00:00Z",
  "cancelled_at": "2024-01-15T13:00:00Z"
}

Error Responses

INVALID STATUS
{
  "error": {
    "type": "invalid_request",
    "message": "Checkout cannot be cancelled because it is not in pending status"
  }
}
NOT FOUND
{
  "error": {
    "type": "not_found",
    "message": "Checkout not found"
  }
}

Start building

XO

Request Demo

Schedule a call with our team

Select a product
Arrow right

Start building
Grateful

Contact Us

We're here to help