PayAgency Logo

Refund API

The Refund API allows you to initiate a refund for a specific transaction using the `transaction_id`. This endpoint processes the refund and provides real-time confirmation of the refund status.


API Endpoint

POST https://backend.pay.agency/api/v1/live/refund

Request Parameters

ParameterTypeRequiredDescription
transaction_idStringYesThe unique ID of the transaction to be refunded.
reasonStringYesThe reason for the refund request.

Headers

Header NameDescription
Content-TypeSpecifies the content type. Always set to application/json.
AuthorizationBearer token for authentication.

Success Response

If the refund request is successful, the API will return the following response:

{
    "status": "SUCCESS",
    "message": "Transaction marked as refunded.",
    "data": {
        "amount": 10,
        "currency": "USD",
        "order_id": null,
        "transaction_id": "PA5098432548233125",
        "customer": {
            "first_name": "Aryan",
            "last_name": "Trivedi",
            "email": "test@gmail.com"
        },
        "refund": {
            "status": true,
            "refund_date": "2025-03-29T10:02:16.525Z"
        },
        "chargeback": {
            "status": false,
            "chargeback_date": null
        }
    }
}

Failed Response

{
  "message": "Transaction has already been refunded."
}
{
  "message": "Transaction has already been charged back."
}

On this page