POST /api/mercado-pago/create-preference
Creates a new Mercado Pago payment preference and initializes a payment record in the database. This endpoint is used when users book virtual English classes.Authentication
Requires user authentication via session.Request Body
Response
The Mercado Pago preference ID used to identify this payment
The Mercado Pago checkout URL where users complete the payment
Payment Status Values
The payment can have one of the following statuses:approved- Payment was successfully processedpending- Payment is awaiting confirmationrejected- Payment was declined or failed
Example Request
Example Response
Error Responses
Error message describing what went wrong
Payment Configuration
The payment preference includes:- Installments: Up to 12 monthly installments
- Currency: ARS (Argentine Peso)
- Auto Return: Automatically redirects on approval
- Callback URLs:
- Success:
/checkout/callback/success - Failure:
/checkout/callback/failure - Pending:
/checkout/callback/pending
- Success:
Database Record
Creates aPaymentMercadoPago record with the following fields:
ID of the authenticated user making the payment
Unique Mercado Pago preference identifier
Payment amount in ARS
Class type:
individual or grupalMaximum number of participants for the class
Payment status (defaults to
pending)