Skip to main content

Refunds API

Refunds API is a tool that allows businesses to initiate and manage refunds for transactions made through their payment processing system. When a customer requests a refund, the Refunds API enables the business to process the refund quickly and easily, without having to manually handle the refund process.

This API handles the communication with the payment processor to ensure that the refund is processed correctly and in compliance with any relevant regulations.

Create a refund​

Endpoint

POST /v1/refunds/

Sólo es posible reembolsar el 100% del monto de una transacción satisfactoria, siempre y cuando ésta transacción no haya sido depositada a tu cuenta de banco aún. Una vez iniciado, un reembolso no se puede cancelar.

También puedes reembolsar una transacción directamente desde la Consola.

Fields:

ParameterDescriptionTypeRequired
amountMonto del reembolsostringtrue
charge_idIdentificador del Charge en cuestiónstringtrue
reasonduplicate, fraudulent o requested_by_customerstringtrue
curl -X POST \
https://api.4geeks.io/v1/refunds/ \
-H 'Authorization: bearer GZe5XDYlwPEk4OW1o5XCjqIOFnVABk' \
-F 'amount=10' \
-F 'charge_id=1BSt6hCqnAMAMqhvMGiBxOWe' \
-F 'reason=requested_by_customer'

Retorna:

{
"refund_id": "1BiPhgCqnAMsdzqhvCTntF7aD",
"charge_id": "1BSt6hCqnAMAasd3vMGiBxOWe",
"amount": "10.99",
"currency": "usd",
"reason": "requested_by_customer",
"status": "succeeded",
"test": true
}

Get a refund​

Endpoint

GET /v1/refunds/<refund_id>/

This endpoint return a refund object.

curl https://api.4geeks.io/v1/refunds/1BiPhgCqnAMsdzqhvCTntF7aD \
-X GET \
-H 'authorization: bearer PdSKf04xi9LEcvcwIAdbWAXVg380Kz' \

Response

{
"refund_id": "1BiPhgCqnAMsdzqhvCTntF7aD",
"charge_id": "1BSt6hCqnAMAasd3vMGiBxOWe",
"amount": "10.00",
"currency": "usd",
"reason": "duplicate",
"status": "succeeded",
"test": true
}

List refunds​

Endpoint

GET /v1/refunds/

Este endpoint devuelve todos los reembolsos generados.

curl https://api.4geeks.io/v1/refunds/ \
-X GET \
-H 'authorization: bearer PdSKf04xi9LEcvcwIAdbWAXVg380Kz' \

Response:

[
{
"refund_id": "1BiOrQCqNertMqhvvUMhJajE",
"charge_id": "1BSt5sCqnAMAMqhvd871C1Vl",
"amount": "10.00",
"currency": "usd",
"reason": "duplicate",
"status": "succeeded",
"test": true
},
{
"refund_id": "1BiPDoCqnNerAMqhvSzxyFXl2",
"charge_id": "1BSt5sCqnAMAMqhvd871C1Vl",
"amount": "40.00",
"currency": "usd",
"reason": "fraudulent",
"status": "succeeded",
"test": true
},
{
"refund_id": "1BiPeNCqnANerMqhvc4QUDeeK",
"charge_id": "1BSt6hCqnAMAMqhvMNerxOWe",
"amount": "10.00",
"currency": "usd",
"reason": "requested_by_customer",
"status": "succeeded",
"test": true
},
{
"refund_id": "1BiPhgNernAMAMqhvCTntF7aD",
"charge_id": "1BSt6hCqnAMAMqhvMGiBNerWe",
"amount": "10.00",
"currency": "usd",
"reason": "null",
"status": "succeeded",
"test": true
}
]