Crear Refund de Transaction
Changed onDevuelve el dinero de un pago, total o parcialmente.
Se usa para reversar un pago ya cobrado. Toku registra la devolución como una Transaction propia de tipo REVERSED, ligada al pago original, y la aplica sobre las Invoices que ese pago había saldado.
Si se omite refund_amount, se devuelve el monto total del pago. Para devolver solo una parte, indica el monto; y si el pago saldó varias Invoices, usa invoice_refund_details para precisar cuánto corresponde a cada una.
Sin idempotency_key, cada llamada crea una devolución nueva y las parciales se acumulan sobre el mismo pago, así que reenviar la misma petición vuelve a devolver el monto mientras quede saldo; cuando ya no queda, la petición es rechazada con estado 400. Reenviar la petición con la misma idempotency_key devuelve la respuesta original, con el header Idempotent-Replayed, sin crear otra devolución.
Cuando la devolución se envía al gateway en línea, la respuesta ya trae el desenlace y el comprobante. En los productos que se devuelven por lote o de forma asíncrona, success llega en false con error en null: la devolución quedó iniciada y el gateway la confirma después.
Un pago con tarjeta de un solo cobro (payment_orchestration_onetime) o con wallet (wallet_mx) más antiguo que su plazo de devolución es rechazado con estado 400 antes de contactar al gateway.
Request
- Base URLhttps://api.trytoku.com
- URLhttps://api.trytoku.com/refund/transaction
- AuthAPI key in header x-api-key
Headers
Llave de API de una Account, para operar sobre esa Account en lugar de la principal.
Request body
Example request
{
"id_transaction": "trs_pBf2NL0d0gvBM7Ei_1E3HIWnTN4W93_O",
"idempotency_key": "5f1c2e0a-8d3b-4c1e-9a7f-2b6d4e8c1a90",
"invoice_refund_details": [
{
"id_invoice": "in_pBf2NL0d0gvBM7Ei_1E3HIWnTN4W93_O"
}
]
}Response
Successful Response
Example response
{
"id": "trs_pBf2NL0d0gvBM7Ei_1E3HIWnTN4W93_O"
}Changes
- breaking
request body became required
- breaking
the request property
//became required - breaking
removed the media type
application/jsonfor the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - info
api operation id
ejecutar-una-devoluciónremoved and replaced withrefund_transaction_public - info
api tag
Refundsadded - info
added the new optional
headerrequest parameterx-account-key - info
added the new optional request property
- info
added the new optional request property
- info
the
//request property format was generalized fromfloatto no format - info
the
request property format was generalized fromfloatto no format - info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
the response property
became required for the status - info
the response property
became required for the status - info
the
response's property default valuetruewas removed for the status
- breaking