RevKeenDocs

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

FieldDescription
invoiceIdStart checkout for an existing invoice
productIdStart checkout for a specific product
amountMinorSet a custom amount in minor units
currencyCurrency code for custom-amount sessions
successUrlRedirect after successful payment
cancelUrlRedirect if the customer cancels
allowedMethodsAllowed methods for the session: card and/or in_store
companionDeviceIdLink 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 url returned 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 session
  • POST /v2/checkout-sessions/{id}/expire to 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"]
  }'