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"
}| Campo | Tipo |
|---|---|
id | string |
status | open | complete | expired |
subscription_id | string | null |
url | string |
expires_at | datetime |
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" }
}| Campo | Requerido |
|---|---|
plan_id | Sí |
cycle | Sí (monthly | annual) |
customer | Sí, o customer_id si el cliente ya existe |
success_url | Sí |
cancel_url | Sí |
metadata | No |
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
| Status | error.type | Causa |
|---|---|---|
400 | invalid_request | Faltan success_url/cancel_url o plan_id inválido |
404 | invalid_request | plan_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
| Status | error.type | Causa |
|---|---|---|
404 | invalid_request | La sesión no existe |