Si vendes productos o servicios creados en Onflay, usa listingId y opcionalmente variantId.
Listing simple
const session = await onflay.checkoutSessions.create(
{
listingId: 'lst_...',
customerEmail: 'comprador@ejemplo.com',
successUrl: 'https://tu-app.com/gracias',
cancelUrl: 'https://tu-app.com/cancelado',
},
{ idempotencyKey: 'checkout:lst_123:buyer_456' }
);
Variante
const session = await onflay.checkoutSessions.create({
listingId: 'lst_...',
variantId: 'var_...',
customerEmail: 'comprador@ejemplo.com',
successUrl: 'https://tu-app.com/gracias',
cancelUrl: 'https://tu-app.com/cancelado',
});
Cuándo usar variantId
- Básico / Pro / Premium;
- archivo individual / bundle completo;
- sesión de 30 min / 60 min;
- entrada general / VIP;
- diferentes entregables o duraciones.
La disponibilidad y los campos requeridos dependen del tipo de listing y de cómo esté configurado en Onflay.