curl https://api.onepay.la/v1/customers/session/charges \
-X POST \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi" \
-H "x-customer-token: 83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp" \
-H "x-idempotency: 550e8400-e29b-41d4-a716-446655440000" \
-H "Content-Type: application/json" \
-d '{
"payment_method_id": "bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5",
"amount": 50000,
"currency": "COP",
"description": "Pago mensualidad marzo"
}'
const response = await fetch('https://api.onepay.la/v1/customers/session/charges', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'X-Customer-Token': '83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp',
'X-Idempotency': '550e8400-e29b-41d4-a716-446655440000',
'Content-Type': 'application/json'
},
body: JSON.stringify({
payment_method_id: 'bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5',
amount: 50000,
currency: 'COP',
description: 'Pago mensualidad marzo'
})
});
const charge = await response.json();
import requests
response = requests.post(
'https://api.onepay.la/v1/customers/session/charges',
headers={
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'X-Customer-Token': '83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp',
'X-Idempotency': '550e8400-e29b-41d4-a716-446655440000',
'Content-Type': 'application/json'
},
json={
'payment_method_id': 'bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5',
'amount': 50000,
'currency': 'COP',
'description': 'Pago mensualidad marzo'
}
)
charge = response.json()
{
"charge_id": "9e02966f-2ddf-4ee7-a391-5b5b7653e232",
"status": "created",
"message": "Solicitud de aprobación enviada al cliente vía WhatsApp.",
"expires_at": "2026-03-16T22:35:00+00:00"
}
{
"message": "Ya existe un cobro pendiente para este método de pago."
}
{
"message": "El método de pago está expirado."
}
Crear cargo
Crea un cargo a una tarjeta del cliente autenticado. Requiere aprobación del cliente vía WhatsApp.
POST
/
customers
/
session
/
charges
curl https://api.onepay.la/v1/customers/session/charges \
-X POST \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi" \
-H "x-customer-token: 83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp" \
-H "x-idempotency: 550e8400-e29b-41d4-a716-446655440000" \
-H "Content-Type: application/json" \
-d '{
"payment_method_id": "bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5",
"amount": 50000,
"currency": "COP",
"description": "Pago mensualidad marzo"
}'
const response = await fetch('https://api.onepay.la/v1/customers/session/charges', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'X-Customer-Token': '83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp',
'X-Idempotency': '550e8400-e29b-41d4-a716-446655440000',
'Content-Type': 'application/json'
},
body: JSON.stringify({
payment_method_id: 'bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5',
amount: 50000,
currency: 'COP',
description: 'Pago mensualidad marzo'
})
});
const charge = await response.json();
import requests
response = requests.post(
'https://api.onepay.la/v1/customers/session/charges',
headers={
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'X-Customer-Token': '83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp',
'X-Idempotency': '550e8400-e29b-41d4-a716-446655440000',
'Content-Type': 'application/json'
},
json={
'payment_method_id': 'bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5',
'amount': 50000,
'currency': 'COP',
'description': 'Pago mensualidad marzo'
}
)
charge = response.json()
{
"charge_id": "9e02966f-2ddf-4ee7-a391-5b5b7653e232",
"status": "created",
"message": "Solicitud de aprobación enviada al cliente vía WhatsApp.",
"expires_at": "2026-03-16T22:35:00+00:00"
}
{
"message": "Ya existe un cobro pendiente para este método de pago."
}
{
"message": "El método de pago está expirado."
}
Crea un cargo (débito) a una tarjeta del cliente autenticado. Se envía una solicitud de aprobación al cliente vía WhatsApp. El cargo se ejecuta cuando el cliente aprueba, o expira automáticamente en 5 minutos.
Usa GET /customers/session/charges/ para consultar el estado del cargo mientras esperas la aprobación.
Solo se permite un cargo pendiente por tarjeta. Si ya existe un cargo en estado
created, el endpoint retornará error 422.Headers
string
required
Token de idempotencia único (UUID) para evitar cargos duplicados. Obligatorio en este endpoint.
string
required
Bearer token de tu empresa.
string
required
Token de sesión del cliente obtenido en /customers/login/verify.
Body
string
required
ID de la tarjeta del cliente. Debe pertenecer al cliente autenticado y coincidir con el modo (test/live).
integer
required
Monto del cargo en centavos. Mínimo:
100 (equivale a $1 COP).string
required
Moneda del cargo. Valores válidos:
COP, USD.string
required
Descripción del cargo. Máximo 255 caracteres.
Flujo de aprobación
curl https://api.onepay.la/v1/customers/session/charges \
-X POST \
-H "Authorization: Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi" \
-H "x-customer-token: 83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp" \
-H "x-idempotency: 550e8400-e29b-41d4-a716-446655440000" \
-H "Content-Type: application/json" \
-d '{
"payment_method_id": "bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5",
"amount": 50000,
"currency": "COP",
"description": "Pago mensualidad marzo"
}'
const response = await fetch('https://api.onepay.la/v1/customers/session/charges', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'X-Customer-Token': '83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp',
'X-Idempotency': '550e8400-e29b-41d4-a716-446655440000',
'Content-Type': 'application/json'
},
body: JSON.stringify({
payment_method_id: 'bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5',
amount: 50000,
currency: 'COP',
description: 'Pago mensualidad marzo'
})
});
const charge = await response.json();
import requests
response = requests.post(
'https://api.onepay.la/v1/customers/session/charges',
headers={
'Authorization': 'Bearer sk_test_KjbE0Vobf5Lg1yNZ4HoKawDItDs3Rod9VXNBWrEYmGn06tkesPIi',
'X-Customer-Token': '83|i7Cs8TpuDXOLOsDmEKSUPPW3GiFaz83bzFg73yFp',
'X-Idempotency': '550e8400-e29b-41d4-a716-446655440000',
'Content-Type': 'application/json'
},
json={
'payment_method_id': 'bb02b2fd-154c-4c90-9fdf-cec3a0b25cf5',
'amount': 50000,
'currency': 'COP',
'description': 'Pago mensualidad marzo'
}
)
charge = response.json()
{
"charge_id": "9e02966f-2ddf-4ee7-a391-5b5b7653e232",
"status": "created",
"message": "Solicitud de aprobación enviada al cliente vía WhatsApp.",
"expires_at": "2026-03-16T22:35:00+00:00"
}
{
"message": "Ya existe un cobro pendiente para este método de pago."
}
{
"message": "El método de pago está expirado."
}
Was this page helpful?
⌘I