Checkout Sessions
Create hosted checkout flows dynamically from your backend
Checkout sessions are API-created hosted checkout flows. Your backend creates a session for a specific purchase, RevKeen returns a hosted checkout url, and you redirect the customer there.
Best For
- Dynamic purchases created at runtime
- Checkout tied to a specific invoice
- Product-specific server-side flows
- Choosing allowed payment methods per checkout
- Card-present handoff scenarios using a companion device
Supported Create Parameters
| Field | Description |
|---|---|
invoiceId | Start checkout for an existing invoice |
productId | Start checkout for a specific product |
amountMinor | Set a custom amount in minor units |
currency | Currency code for custom-amount sessions |
successUrl | Redirect after successful payment |
cancelUrl | Redirect if the customer cancels |
allowedMethods | Allowed methods for the session: card and/or in_store |
companionDeviceId | Link the session to a specific in-store companion device |
TypeScript Example
const session = await client.checkoutSessions.create({
invoiceId: 'inv_123',
successUrl: 'https://example.com/success',
cancelUrl: 'https://example.com/cancel',
allowedMethods: ['card'],
});
return redirect(session.data.url);Example Response Shape
{
"data": {
"id": "cs_123",
"url": "https://pay.revkeen.com/p/rvk_cs_example",
"status": "open",
"publicToken": "rvk_cs_example",
"currency": "USD",
"allowed_methods": ["card"],
"expires_at": "2026-04-21T15:30:00Z"
}
}Notes on Session Usage
- Always redirect to the
urlreturned by the API. Do not construct checkout URLs manually. - Checkout sessions are best for one purchase flow at a time.
- If you want a reusable sales URL, use a checkout link.
- If your flow depends on card-present routing or per-checkout payment-method control, checkout sessions are the correct API.
Retrieve or Expire a Session
RevKeen also supports:
GET /v2/checkout-sessions/{id}to retrieve a sessionPOST /v2/checkout-sessions/{id}/expireto expire an open session
cURL Example
curl -X POST "https://api.revkeen.com/v2/checkout-sessions" \
-H "x-api-key: $REVKEEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"invoiceId": "inv_123",
"successUrl": "https://example.com/success",
"cancelUrl": "https://example.com/cancel",
"allowedMethods": ["card"]
}'Related
- Checkout Links -- Reusable hosted checkout URLs
- Terminal -- Card-present and in-store payment flows