Refunds

Initiating a Refund Transaction

This documentation explains how to initiate a refund transaction using the Facilero API. By making a POST request, you can process a refund for a previously completed transaction. Once the request is processed, a callback (webhook) containing the refund details will be sent to your specified URL.

API Endpoint

Live

POST https://live.facilero.com/v1/refunds/card

Sandbox

POST https://sandbox.facilero.com/v1/refunds/card

Request Headers:

  • Content-Type: application/json
  • Authorization: Bearer <AUTH_TOKEN>
    Replace <AUTH_TOKEN> with the access token obtained from the Authorization Service.

Request Body:

The request should be in JSON format and include the following parameters:

FieldTypeRequiredDescription
requestIdStringYesUnique identifier for the refund request.
midStringYesMerchant ID associated with the refund.
transactionIdStringYesThe ID of the transaction to be refunded.
amountStringYesThe amount to refund, following currency precision rules.
reasonStringYesA description of the reason for the refund.
callbackUrlStringNoURL to receive the status update of the refund.
metadataMap<String, String>NoAdditional key-value metadata for custom use.

Example Request

curl -X POST "https://live.facilero.com/v1/refunds/card" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <AUTH_TOKEN>" \
  -d '{
    "requestId": "req12345",
    "mid": "uds939fbskq23pd0vjop1"
    "transactionId": "txn67890",
    "amount": "50.00",
    "reason": "Customer returned the product",
    "callbackUrl": "https://yourserver.com/callback",
    "metadata": {
      "customKey1": "customValue1",
      "customKey2": "customValue2"
    }
  }'

Response Details

The refund endpoint provides a structured response indicating the success or failure of the request.

Response Body

FieldTypeRequiredDescription
refundIdStringYesUnique identifier for the refund transaction.
transactionStatusStringYesCurrent status of the transaction (e.g., NEW, PENDING, FAILED, etc.).
declineCodeIntNoDecline code if the transaction fails.

Example Successful Response

HTTP Status: 200 OK
Response Body:

{
  "refundId": "ref12345",
  "transactionStatus": "PENDING",
  "declineCode": null
}

Example Failed Response

HTTP Status: 200 OK
Response Body:

{
  "refundId": "ref12345",
  "transactionStatus": "FAILED",
  "declineCode": 101
}

Callback: Merchant Refund DTO

Once the refund is processed, a webhook will be sent to the callbackUrl specified in the request. The callback provides details about the refund and its status.

Refund Callback DTO

The callback object includes the following fields:

FieldTypeRequiredDescription
transactionIdStringYesThe ID of the original transaction being refunded.
refundIdStringYesUnique identifier for the refund.
requestIdStringYesThe original request ID provided when initiating the refund.
midStringYesMerchant ID associated with the refund.
transactionStatusEnumYesThe status of the refund transaction (e.g., PENDING, SUCCEED, FAILED).
declineCodeIntegerNoCode indicating the reason for failure (if applicable).
totalAmountDoubleYesThe total amount refunded.
callbackUrlStringNoThe URL where the callback was sent.
createdAtStringYesTimestamp when the refund was processed.

Example Callback Object

{
  "transactionId": "txn67890",
  "refundId": "ref12345",
  "requestId": "req12345",
  "mid": "merchant001",
  "transactionStatus": "SUCCEED",
  "declineCode": null,
  "totalAmount": 50.0,
  "callbackUrl": "https://yourserver.com/callback",
  "createdAt": "2024-01-01T12:00:00Z"
}