Referencia de APICheckout sessions

Checkout sessions

/v1/checkout-sessions — checkout hospedado para suscripciones recurrentes. Ver también el concepto Checkout y la guía Checkout hospedado.

El objeto Checkout Session

{
  "id": "cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  "status": "open",
  "subscription_id": null,
  "url": "https://checkout.rekurra.dev/cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  "expires_at": "2026-08-25T15:00:00Z"
}
CampoTipo
idstring
statusopen | complete | expired
subscription_idstring | null
urlstring
expires_atdatetime

Crear una sesión de checkout

POST /v1/checkout-sessions

Request body

{
  "plan_id": "plan_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  "cycle": "monthly",
  "customer": { "email": "cliente@ejemplo.com", "name": "María Pérez" },
  "success_url": "https://tuapp.com/gracias",
  "cancel_url": "https://tuapp.com/checkout",
  "metadata": { "origen": "landing" }
}
CampoRequerido
plan_id
cycleSí (monthly | annual)
customerSí, o customer_id si el cliente ya existe
success_url
cancel_url
metadataNo
curl
curl -X POST https://api.rekurra.dev/v1/checkout-sessions \
  -H "Authorization: Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX" \
  -H "Content-Type: application/json" \
  -d '{
    "plan_id": "plan_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
    "cycle": "monthly",
    "customer": { "email": "cliente@ejemplo.com", "name": "María Pérez" },
    "success_url": "https://tuapp.com/gracias",
    "cancel_url": "https://tuapp.com/checkout"
  }'
JavaScript (fetch)
const res = await fetch("https://api.rekurra.dev/v1/checkout-sessions", {
  method: "POST",
  headers: {
    Authorization: "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    plan_id: "plan_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
    cycle: "monthly",
    customer: { email: "cliente@ejemplo.com", name: "María Pérez" },
    success_url: "https://tuapp.com/gracias",
    cancel_url: "https://tuapp.com/checkout",
  }),
});
const session = await res.json();
Python (requests)
import requests
 
res = requests.post(
    "https://api.rekurra.dev/v1/checkout-sessions",
    headers={
        "Authorization": "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX",
        "Content-Type": "application/json",
    },
    json={
        "plan_id": "plan_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
        "cycle": "monthly",
        "customer": {"email": "cliente@ejemplo.com", "name": "María Pérez"},
        "success_url": "https://tuapp.com/gracias",
        "cancel_url": "https://tuapp.com/checkout",
    },
)
session = res.json()

Response — 201 Created

{
  "id": "cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  "url": "https://checkout.rekurra.dev/cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2"
}

Errores posibles

Statuserror.typeCausa
400invalid_requestFaltan success_url/cancel_url o plan_id inválido
404invalid_requestplan_id no existe

Obtener una sesión de checkout

GET /v1/checkout-sessions/{id}

curl
curl https://api.rekurra.dev/v1/checkout-sessions/cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2 \
  -H "Authorization: Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX"
JavaScript (fetch)
const res = await fetch(
  "https://api.rekurra.dev/v1/checkout-sessions/cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  { headers: { Authorization: "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX" } }
);
const session = await res.json();
Python (requests)
import requests
 
res = requests.get(
    "https://api.rekurra.dev/v1/checkout-sessions/cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
    headers={"Authorization": "Bearer rk_live_XXXXXXXXXXXXXXXXXXXXXXXX"},
)
session = res.json()

Response — 200 OK

{
  "id": "cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  "status": "complete",
  "subscription_id": "sub_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  "url": "https://checkout.rekurra.dev/cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  "expires_at": "2026-08-25T15:00:00Z"
}

Errores posibles

Statuserror.typeCausa
404invalid_requestLa sesión no existe