Skip to main content
POST
/
charges
/
{charge_id}
/
resolve
curl https://api.onepay.la/v1/charges/9e02966f-2ddf-4ee7-a391-5b5b7653e232/resolve \
  -X POST \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "approve"
  }'
const chargeId = '9e02966f-2ddf-4ee7-a391-5b5b7653e232';

const response = await fetch(`https://api.onepay.la/v1/charges/${chargeId}/resolve`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_test_xxx',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    action: 'approve'
  })
});

const data = await response.json();
console.log(data.status); // "paid"
import requests

charge_id = "9e02966f-2ddf-4ee7-a391-5b5b7653e232"
url = f"https://api.onepay.la/v1/charges/{charge_id}/resolve"

response = requests.post(url, headers={
    "Authorization": "Bearer sk_test_xxx",
    "Content-Type": "application/json"
}, json={
    "action": "approve"
})

data = response.json()
print(data["status"])  # "paid"
<?php
$chargeId = "9e02966f-2ddf-4ee7-a391-5b5b7653e232";
$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => "https://api.onepay.la/v1/charges/{$chargeId}/resolve",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer sk_test_xxx",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "action" => "approve"
    ])
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data["status"]; // "paid"

curl_close($ch);
?>
{
  "id": "9e02966f-2ddf-4ee7-a391-5b5b7653e232",
  "status": "paid",
  "remarks": null,
  "paid_at": "2026-02-20T17:14:00.000000Z"
}
{
  "id": "9e02966f-2ddf-4ee7-a391-5b5b7653e232",
  "status": "failed",
  "remarks": {
    "code": "RISK_CONTROL",
    "description": "La transacción ha sido bloqueada por el control de riesgo del banco.",
    "customer_description": "La transacción ha sido bloqueada por el banco. Comunícate con tu banco para resolver el problema."
  },
  "paid_at": null
}
{
  "message": "This endpoint is only available for test charges."
}
{
  "message": "Only charges in processing or created status can be resolved."
}
{
  "message": "The remarks field is required when action is reject.",
  "errors": {
    "remarks": ["The remarks field is required when action is reject."]
  }
}
Este endpoint solo funciona con cargos de prueba (is_test: true). Si intentas resolver un cargo de producción, recibirás un error 403.
Permite simular la respuesta de un gateway de pago para cargos que quedaron en estado processing o created en ambiente de pruebas.

¿Cuándo usarlo?

Cuando creas un cargo en sandbox y el resultado es processing (por ejemplo, con cuentas bancarias que no tienen un patrón de auto-aprobación), puedes usar este endpoint para completar el flujo manualmente — simulando que el gateway responde aprobando o rechazando la transacción.
charge_id
string
required
ID del cargo o source_id del cargo a resolver. Debe estar en estado processing o created.
action
string
required
Acción a ejecutar sobre el cargo. Valores válidos:
  • approve - Aprueba el cargo (transición a paid)
  • reject - Rechaza el cargo (transición a failed)
remarks
string
Motivo del rechazo. Requerido cuando action es reject.Acepta cualquier código de los escenarios de prueba, por ejemplo:
  • INSUFFICIENT_FUNDS - Fondos insuficientes
  • RISK_CONTROL - Bloqueado por control de riesgo
  • CARD_EXPIRED - Tarjeta expirada
  • TRANSACTION_REJECTED - Rechazado por el banco
Consulta la lista completa en escenarios de prueba.

Aprobar un cargo

curl https://api.onepay.la/v1/charges/9e02966f-2ddf-4ee7-a391-5b5b7653e232/resolve \
  -X POST \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "approve"
  }'
const chargeId = '9e02966f-2ddf-4ee7-a391-5b5b7653e232';

const response = await fetch(`https://api.onepay.la/v1/charges/${chargeId}/resolve`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk_test_xxx',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    action: 'approve'
  })
});

const data = await response.json();
console.log(data.status); // "paid"
import requests

charge_id = "9e02966f-2ddf-4ee7-a391-5b5b7653e232"
url = f"https://api.onepay.la/v1/charges/{charge_id}/resolve"

response = requests.post(url, headers={
    "Authorization": "Bearer sk_test_xxx",
    "Content-Type": "application/json"
}, json={
    "action": "approve"
})

data = response.json()
print(data["status"])  # "paid"
<?php
$chargeId = "9e02966f-2ddf-4ee7-a391-5b5b7653e232";
$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => "https://api.onepay.la/v1/charges/{$chargeId}/resolve",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer sk_test_xxx",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "action" => "approve"
    ])
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data["status"]; // "paid"

curl_close($ch);
?>

Rechazar un cargo con motivo

curl https://api.onepay.la/v1/charges/9e02966f-2ddf-4ee7-a391-5b5b7653e232/resolve \
  -X POST \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "reject",
    "remarks": "RISK_CONTROL"
  }'
{
  "id": "9e02966f-2ddf-4ee7-a391-5b5b7653e232",
  "status": "paid",
  "remarks": null,
  "paid_at": "2026-02-20T17:14:00.000000Z"
}
{
  "id": "9e02966f-2ddf-4ee7-a391-5b5b7653e232",
  "status": "failed",
  "remarks": {
    "code": "RISK_CONTROL",
    "description": "La transacción ha sido bloqueada por el control de riesgo del banco.",
    "customer_description": "La transacción ha sido bloqueada por el banco. Comunícate con tu banco para resolver el problema."
  },
  "paid_at": null
}
{
  "message": "This endpoint is only available for test charges."
}
{
  "message": "Only charges in processing or created status can be resolved."
}
{
  "message": "The remarks field is required when action is reject.",
  "errors": {
    "remarks": ["The remarks field is required when action is reject."]
  }
}