Authentication
Requires a valid JWT token in the Authorization header.Request Body
The plan to subscribe to. Must be “BASIC” or “PRO”. The FREE plan doesn’t require a checkout session.
Billing frequency: “monthly” or “annual”. Annual billing provides a discount.
Optional promotion/discount code to apply to the subscription. Must be 3-50 characters.
Response
The Stripe checkout session ID.
The URL to redirect the user to complete the checkout. This URL expires after 24 hours.
Success message.
Trial Period
New users are eligible for a 30-day free trial on BASIC and PRO plans. The trial period can also be extended through promotion codes.Example Request (Monthly)
cURL
Example Request (Annual with Promo Code)
cURL
Example Response
Error Responses
Unauthorized - Invalid or missing JWT token.
Bad request - Invalid plan, already subscribed to this plan, or invalid promotion code.Possible error messages:
- “Plan inválido” - Plan must be BASIC or PRO
- “El plan FREE no requiere suscripción”
- “Ya tienes este plan activo”
- “Código de descuento inválido” - Promotion code is invalid or expired
Internal server error or Stripe API error.
After successful payment, the user will be redirected to the success URL with the session ID. The webhook will handle updating the subscription in the database.