GuíasCheckout hospedado

Checkout hospedado

El checkout hospedado de Rekurra crea el Customer, el PaymentMethod y la Subscription en un solo flujo, en una página alojada por Rekurra que tokeniza la tarjeta sobre tu cuenta de Wompi.

Crea la sesión de checkout

curl
curl -X POST https://api.rekurra.dev/v1/checkout-sessions \
  -H "Authorization: Bearer rk_test_XXXXXXXXXXXXXXXXXXXXXXXX" \
  -H "Content-Type: application/json" \
  -d '{
    "plan_id": "plan_01HZ...",
    "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" }
  }'
JavaScript (fetch)
const res = await fetch("https://api.rekurra.dev/v1/checkout-sessions", {
  method: "POST",
  headers: {
    Authorization: "Bearer rk_test_XXXXXXXXXXXXXXXXXXXXXXXX",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    plan_id: "plan_01HZ...",
    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 { id, url } = await res.json();
Python (requests)
import requests
 
res = requests.post(
    "https://api.rekurra.dev/v1/checkout-sessions",
    headers={
        "Authorization": "Bearer rk_test_XXXXXXXXXXXXXXXXXXXXXXXX",
        "Content-Type": "application/json",
    },
    json={
        "plan_id": "plan_01HZ...",
        "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()
201 Created
{
  "id": "cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2",
  "url": "https://checkout.rekurra.dev/cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2"
}

Redirige a tu cliente

Envía a tu cliente a la url devuelta (por ejemplo, window.location.href = url). Ahí Wompi tokeniza su tarjeta usando la configuración de tu cuenta.

Recibe el resultado

Al completar el pago, Rekurra redirige a success_url; si el cliente abandona o expira la sesión, redirige a cancel_url. En paralelo, dispara el webhook subscription.created (ver Webhooks) — usa el webhook, no solo la redirección, como fuente de verdad.

Consulta el estado si lo necesitas

curl
curl https://api.rekurra.dev/v1/checkout-sessions/cs_01HZXK7QJ5M8Z9X2R3TVQ7A1B2 \
  -H "Authorization: Bearer rk_test_XXXXXXXXXXXXXXXXXXXXXXXX"

Ver el detalle completo en API → Checkout sessions.