Crear un enlace de pago
Crea una URL de checkout alojada por Therius para un pago único o una suscripción. De un solo uso por defecto, o reutilizable con un tope opcional.
POST /payment-link crea una página de checkout alojada que puedes enviar al pagador por correo, chat o código QR, sin integrar el SDK. La respuesta contiene la url para compartir.
Tipos de enlace
- Pago único, monto fijo — defines
amount(amountMode: "fixed", el valor por defecto). Úsalo para facturas y boletos. - Pago único, monto ingresado por el pagador — define
amountMode: "customer_entered"y unacurrency. El pagador escribe el monto, acotado opcionalmente poramountMinyamountMax(unidades menores). - Suscripción — define
type: "subscription"y unsubscriptionPlanId. El plan fija el precio. Si omitessubscriptionPlanId, el pagador elige entre tus planes activos. No envíesamounten enlaces de suscripción.
Enlaces de un solo uso y reutilizables
Por defecto un enlace es de un solo uso: pasa aused tras el primer pago exitoso. Los intentos fallidos no lo consumen, así que el pagador puede reintentar.
Define reusable: true para aceptar muchos pagos. Agrega maxUses para limitar la cantidad de pagos exitosos; el enlace pasa a used al alcanzar el tope. Sin maxUses, un enlace reutilizable sigue active hasta que expira o lo cancelas. maxUses requiere reusable: true, y los enlaces de suscripción no pueden ser reutilizables.
Entorno y vencimiento
Un enlace toma el entorno de la clave que lo creó: las clavesprv_sandbox_ crean enlaces de sandbox y las prv_production_ crean enlaces de producción. Los enlaces vencen a los 7 días salvo que definas expiresInDays (1–365) o expiresAt (YYYY-MM-DD, fin de ese día en UTC).
Referencia y URL de retorno
reference es tu propio identificador (por ejemplo, un número de factura). Se convierte en el orderCode del pago resultante. returnUrl debe ser una URL https (en sandbox se acepta http).
Ejemplo
Idempotency-Key para que una solicitud reintentada devuelva el enlace original en lugar de crear uno segundo. Consulta Idempotencia.Autorizaciones
Your secret API key: Bearer prv_production_xxx (production) or Bearer prv_sandbox_xxx (sandbox).
Encabezados
A UUID you generate per operation. Required in production. Retrying with the same key returns the original response.
Cuerpo
one-time, subscription Your merchant account identifier. Required if the key maps to more than one merchant account.
One-time links only.
fixed, customer_entered Required for one-time links. value is required when amountMode is fixed; for customer_entered only currency is needed. Not allowed on subscription links.
customer_entered only. Minimum amount the payer may enter, minor units.
customer_entered only. Maximum amount the payer may enter, minor units.
Subscription links only. Omit to let the payer choose among your active plans.
Checkout Builder configuration to style the page.
2552000Your own reference (invoice number, PNR). It becomes the orderCode of the resulting payment.
128Where to send the payer after paying. Must be https (sandbox also allows http).
1 <= x <= 365Expiry date, YYYY-MM-DD (end of that day, UTC). Takes precedence over expiresInDays.
Accept many payments instead of one. One-time links only.
Cap on successful payments for a reusable link. Requires reusable: true.
x >= 1Respuesta
Payment link created
The hosted checkout URL to share with the payer.
one-time, subscription used once a single-use link takes its first successful payment, or a reusable link reaches maxUses.
active, used, expired, cancelled fixed, customer_entered Absent on subscription links. For customer_entered links only currency and exponent are set.
Minimum payer-entered amount, minor units.
Maximum payer-entered amount, minor units.
Number of successful payments taken through this link.
production, sandbox 
