Checkout API
POST /v1/checkout and GET /v1/checkout/:sessionId
llms.txtPOST /v1/checkout and GET /v1/checkout/:sessionId
Create checkout
POST /v1/checkout
Creates a checkout session, generates the first invoice, and returns the hosted payment URL.
Body (createCheckoutSchema):
| Field | Type | Required |
|---|---|---|
customerId | string (UUID) | Yes |
priceId | string (UUID) | Yes |
checkoutLinkId | string | No |
successUrl | string | No |
cancelUrl | string | No |
discountId | string | No |
metadata | object | No |
Response 201:
{
"sessionId": "uuid",
"checkoutUrl": "https://kwit.dev/checkout/...",
"invoice": { }
}Errors: 400 validation, 404 if customer/product not found, 500 otherwise.
Retrieve session
GET /v1/checkout/:sessionId
Response 200 - checkout session including status (OPEN, COMPLETE, EXPIRED).
const session = await kwit.checkout.sessions.retrieve(sessionId);