Create a hosted Checkout Session
curl --request POST \
--url https://api.simplepay.mx/v1/hosted-checkout/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"currency": "<string>",
"line_items": [
{
"amount": 2,
"name": "<string>",
"quantity": 1
}
],
"success_url": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
currency: '<string>',
line_items: [{amount: 2, name: '<string>', quantity: 1}],
success_url: '<string>'
})
};
fetch('https://api.simplepay.mx/v1/hosted-checkout/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.simplepay.mx/v1/hosted-checkout/sessions"
payload = {
"currency": "<string>",
"line_items": [
{
"amount": 2,
"name": "<string>",
"quantity": 1
}
],
"success_url": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"amount_total": 123,
"id": "<string>",
"object": "<unknown>",
"pricing_snapshot": {},
"status": "<string>",
"url": "<string>"
}Create a hosted Checkout Session
Referencia detallada para POST /v1/hosted-checkout/sessions.
POST
https://api.simplepay.mx
/
v1
/
hosted-checkout
/
sessions
Create a hosted Checkout Session
curl --request POST \
--url https://api.simplepay.mx/v1/hosted-checkout/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"currency": "<string>",
"line_items": [
{
"amount": 2,
"name": "<string>",
"quantity": 1
}
],
"success_url": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
currency: '<string>',
line_items: [{amount: 2, name: '<string>', quantity: 1}],
success_url: '<string>'
})
};
fetch('https://api.simplepay.mx/v1/hosted-checkout/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.simplepay.mx/v1/hosted-checkout/sessions"
payload = {
"currency": "<string>",
"line_items": [
{
"amount": 2,
"name": "<string>",
"quantity": 1
}
],
"success_url": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"amount_total": 123,
"id": "<string>",
"object": "<unknown>",
"pricing_snapshot": {},
"status": "<string>",
"url": "<string>"
}Uso
Usalo para crear o consultar checkouts hospedados. La confirmacion operativa debe venir de webhooks o de una lectura de API, no del redirect.Antes de llamar
| Tema | Detalle |
|---|---|
| Metodo | POST |
| Ruta | /v1/hosted-checkout/sessions |
| Auth | Bearer API key del ambiente correcto. |
| Scope | No hay scope explicito en la spec publica; aplica el acceso del tenant y ambiente. |
| Idempotencia | Recomendada para cualquier retry. Usa una key deterministica por operacion de negocio. |
| Guia relacionada | Hosted Checkout |
Patron recomendado
- Ejecuta este endpoint desde backend o job seguro, nunca desde frontend con API keys.
- Manda
Idempotency-Keycuando el endpoint cree, convierta, reprograme, cancele, capture o reembolse estado. - Persiste IDs SimplePay (
spcs_...,sppi_...,splink_..., refund IDs o booking IDs) para reconciliacion. - Consulta el bloque OpenAPI de esta pagina para el shape exacto de parametros, body y respuestas.
Ejemplo minimo
terminal
curl -sS -X POST "https://api.simplepay.mx/v1/hosted-checkout/sessions" \
-H "Authorization: Bearer $SIMPLEPAY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: create-checkout-session_v1" \
-d '{ ... }'
Errores a manejar
400indica payload, parametros o estado invalido.401o403indican API key, ambiente o scopes incorrectos.409suele indicar conflicto de estado, duplicado o idempotencia incompatible.429y5xxse pueden reintentar con backoff; en writes conserva la misma idempotency key.
Contrato OpenAPI
El playground, parametros, body y respuestas de abajo salen de/openapi.json. Si el contrato cambia, actualiza la spec y regenera esta pagina.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Required string length:
8 - 255Body
application/json
Pattern:
^[a-z]{3}$Maximum string length:
255Hide child attributes
Hide child attributes
Required range:
x >= 0Available options:
3, 6, 9, 12, 18 Available options:
merchant_absorbed, payer_transparent, blended_price, pass_through_plus_margin Minimum array length:
1Available options:
card, oxxo, spei Last modified on July 8, 2026
⌘I