Checkout Sessions

Create a hosted checkout session and redirect the customer to it. Ching renders branded checkout, collects the card if needed, runs 3DS, charges, and issues the invoice before returning them to your success_url.

Use cases: Outsource the entire payment UI, accept new customers with zero PCI scope, or let existing customers upgrade to a higher plan.
POST/v1/checkout_sessions

Create a checkout session for a price. Returns the hosted url and the expiry timestamp.

Checkout sessions expire after 30 minutes. Listen for the checkout_session.completed webhook to fulfill server-side.

Body Parameters

NameTypeDescription
customer
stringrequiredThe customer id completing checkout.
price
stringrequiredThe price id being sold. Can be one_time or recurring.
success_url
stringrequiredURL to redirect to after a successful payment or plan change.
cancel_url
stringrequiredURL to redirect to if the customer cancels.

Request

curl -X POST "https://api.ching.co.il/v1/checkout_sessions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "customer": "example_customer",
  "price": "example_price",
  "success_url": "example_success_url",
  "cancel_url": "example_cancel_url"
}'

Response

Response
{
  "success": true,
  "data": {
    "id": "co_rzHlhWSDAHIZ",
    "url": "https://secured.ching.co.il/checkout/co_rzHlhWSDAHIZ",
    "expires_at": "2026-04-19T09:46:40.000Z"
  }
}