Skip to 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/

It is only possible to refund 100% of the amount of a successful transaction, as long as the transaction has not been deposited to your bank account yet. Once initiated, a refund cannot be cancelled.

You can also refund a transaction directly from the Console.

Fields:

Parameter Description Type Required
amount Monto del reembolso string true
charge_id Identificador del Charge en cuestiĆ³n string true
reason duplicate, fraudulent o requested_by_customer string true

import Tabs from ‘theme/Tabs’; import TabItem from ‘theme/TabItem’;

Request:

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'

gpayments.Refund.create(
    charge_id='1BSt6hCqnAMAMqhvMGiBxOWe',
    amount=10.99,
    reason='requested_by_customer'
)

await gpApi.charges.create({
  amount: 90.32,
  description: 'Plan 1 service charge',
  entity_description: 'Plan 1',
  currency: 'usd',
  credit_card_number: 4242424242424242,
  credit_card_security_code_number: 123,
  exp_month: 11,
  exp_year: 2020
})

Response:

{
    "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.

Request:

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/

This endpoint returns all refunds generated.

Request:

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
    }
]