Settle, reject or return a test payment
POST/test-helpers/payments/{id}/resolveProbar
La llamada la hace tu navegador, contra el servidor que elijas arriba. Si la documentación no está servida desde el mismo origen que la API, el navegador puede bloquear la respuesta por CORS: en ese caso abre estas páginas desde la propia API (/docs) o usa el curl de arriba.
const url = 'http://localhost:3000/v1/test-helpers/payments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/resolve';const options = { method: 'POST', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"outcome":"settled","reason":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/v1/test-helpers/payments/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/resolve \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "outcome": "settled", "reason": "example" }'Scope payments:write; without it, 403 insufficient_scope. Otherwise, the same conditions as /test-helpers/seed. Only for a payment of YOURS that went through the simulated bank: it arrives as in production (signed event to ingestion) and fires the outcome webhook.
settled: settles asubmittedorunknownpayment (payment.settled). With an own account, a payment without a scenario settles on its own in about 20 s: no need to resolve it.failed: the network rejects a payment it had in progress (submittedorunknown); it is reverted (payment.failed). Returns 409 if the network already paid it (scenarioTEST:TIMEOUT_AFTER_SUBMIT).returned: returns asettledpayment; it endsreversed(payment.reversed), fully reverted, fee included.
To reach submitted or unknown, use the reference of POST /payouts (TEST:SUBMITTED, TEST:UNKNOWN, TEST:TIMEOUT_AFTER_SUBMIT).
Authorizations
Sección titulada «Authorizations»Parameters
Sección titulada «Parameters»Path Parameters
Sección titulada «Path Parameters»Request Bodyrequired
Sección titulada «Request Bodyrequired»object
Opcional, para failed o returned (3 a 120 caracteres)
Responses
Sección titulada «Responses»El pago con su estado nuevo
object
Example
{ "outcome": "settled"}test_account_required (la key no es sk_test_ de una cuenta de pruebas) o insufficient_scope (la key no tiene payments:write)
El pago no existe (o es de otra cuenta), o la ruta no existe en este entorno
El pago no salió por el banco simulado, su estado no admite ese resultado, o (con failed) la red ya lo pagó