Skip to main content
POST
/
checkout
/
{checkout_session_id}
/
cancel
Cancel checkout session before payment processing
curl --request POST \
  --url https://api.zenskar.com/checkout/{checkout_session_id}/cancel \
  --header 'Content-Type: application/json' \
  --header 'organisation: <api-key>' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "reason": "Customer decided to upgrade to a different plan",
  "reason_type": "customer_requested",
  "reference_id": "TICKET-12345"
}
'
{
  "checkout_session_status": "cancelled",
  "payment_status": "not_started",
  "cancelled_at": "2023-01-01T12:34:56",
  "cancellation_details": {
    "reason_type": "customer_requested",
    "reason": "Customer decided to upgrade to Enterprise plan instead of Professional plan",
    "reference_id": "SUPPORT-12345",
    "cancelled_at": "2023-01-01T12:34:56"
  },
  "estimates": {
    "estimation_id": "123e4567-e89b-12d3-a456-426614179999",
    "current_invoice": {
      "id": "123e4567-e89b-12d3-a456-426614179998",
      "invoice_number": "EST-0001",
      "status": "estimated",
      "customer": {
        "customer_id": "123e4567-e89b-12d3-a456-426614174001"
      },
      "line_items": [],
      "features": [],
      "subtotal": 0,
      "total": 0
    },
    "future_invoices": [],
    "amount_due": 0,
    "credit_notes": []
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs2.zenskar.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

x-api-key
string
header
default:<your-api-key>
required
organisation
string
header
default:<your-organisation-id>
required

Path Parameters

checkout_session_id
string<uuid>
required

Body

application/json

Schema for cancelling a checkout session

This schema defines the parameters for cancelling a checkout session, including an optional reason for the cancellation and additional metadata.

reason_type
enum<string> | null

Standard categorization of the cancellation reason

Available options:
customer_requested,
payment_failed,
expired,
duplicate,
fraudulent,
other
reason
string | null

Detailed explanation for why the checkout session is being cancelled. This will be stored for audit purposes.

Maximum string length: 500
reference_id
string | null

External reference ID related to this cancellation (e.g., support ticket number)

Response

Checkout session successfully cancelled

Schema for checkout session cancellation response

This schema defines the response format for a cancelled checkout session, including updated status information and any relevant session data.

payment_status
enum<string>
required

Current status of the payment after cancellation (typically 'not_started')

Available options:
not_started,
pending,
paid,
failed,
no_payment_required
checkout_session_status
enum<string>
required

Updated status of the checkout session (should be 'cancelled')

Available options:
open,
processing,
completed,
closed,
cancelled
contract
ContractResponseSchema · object

Associated contract data if a contract was already created

checkout_session_redirect_url
string | null

URL to redirect the customer to after cancellation (if applicable)

estimates
EstimationResponseSchema · object

Price estimates that were calculated for this checkout session

cancelled_at
string<date-time> | null

Timestamp when the checkout session was cancelled

cancellation_details
Cancellation Details · object

Details about the cancellation including reason and reference information