Checkout API

await accend.checkout.createSession({
  mode: "payment",
  customerId: "cus_123",
  productId: "prod_123",
  amount: "97.00",
  currency: "BRL"
});

Endpoints

  • POST /v1/checkout/sessions
  • GET /v1/checkout/sessions/{sessionId}

POST /v1/checkout/sessions

Scopes: write or checkout:write
Idempotency-Key: required
Request - one-time payment
{
  "mode": "payment",
  "customerId": "cus_abc123",
  "productId": "prod_abc123",
  "successUrl": "https://yourapp.com/success",
  "cancelUrl": "https://yourapp.com/cancel"
}
Request - subscription
{
  "mode": "subscription",
  "customerId": "cus_abc123",
  "productId": "prod_abc123",
  "successUrl": "https://yourapp.com/success"
}
Request - credits
{
  "mode": "credits",
  "customerId": "cus_abc123",
  "amount": "5000",
  "currency": "BRL",
  "successUrl": "https://yourapp.com/credits/success"
}
  • mode enum required: payment | subscription | credits
  • customerId string conditional (required if no externalCustomerId)
  • externalCustomerId string conditional (required if no customerId)
  • productId string conditional (required for payment and subscription)
  • amount string conditional (required for credits)
  • currency enum conditional: BRL | USDC (required when amount is set)
  • successUrl string optional
  • cancelUrl string optional
  • metadata object optional
Response 201
{
  "data": {
    "id": "cs_abc123",
    "mode": "payment",
    "status": "open",
    "checkoutUrl": "https://accend.now/pay/cs_abc123",
    "customerId": "cus_abc123",
    "productId": "prod_abc123",
    "amount": "9700",
    "currency": "BRL",
    "successUrl": "https://yourapp.com/success",
    "cancelUrl": "https://yourapp.com/cancel",
    "expiresAt": "2025-01-15T11:00:00Z",
    "createdAt": "2025-01-15T10:00:00Z"
  },
  "error": null,
  "success": true
}
Errors:
  • 404 customer_not_found no customer found with the provided id
  • 404 product_not_found no product found with the provided id

GET /v1/checkout/sessions/

Scopes: read Response 200
{
  "data": {
    "id": "cs_abc123",
    "mode": "payment",
    "status": "paid",
    "checkoutUrl": "https://accend.now/pay/cs_abc123",
    "customerId": "cus_abc123",
    "productId": "prod_abc123",
    "amount": "9700",
    "currency": "BRL",
    "paidAt": "2025-01-15T10:04:23Z",
    "expiresAt": "2025-01-15T11:00:00Z",
    "createdAt": "2025-01-15T10:00:00Z"
  },
  "error": null,
  "success": true
}
Status values:
  • open: waiting for payment
  • paid: payment confirmed
  • expired: expired without payment
  • canceled: canceled