POST
/
api
/
v1
/
server-to-server-interface
/
refund
Refund a Transaction
curl --request POST \
  --url https://api-dev.paymentoptions.com/api/v1/api/v1/server-to-server-interface/refund \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "transactionId": "9dfd39ec-eb4a-4f8b-a526-17abf140a717",
  "amount": 1000,
  "merchant_id": "< Merchant ID >",
  "notes": "Refund amount captured/purchased"
}'
{
  "success": true,
  "status_code": 201,
  "is_live": false,
  "transaction_type": "REFUND",
  "gateway_response": {
    "version": "1",
    "type": "INFO",
    "message": "Amount successfully refunded.",
    "code": "INFO0002"
  },
  "merchant_details": {
    "legal_name": "Tink15 Factory",
    "mid": "< Merchant ID >",
    "merchant_txn_ref": "qwe"
  },
  "payment_details": {
    "amount": 1000,
    "response_code": 0,
    "auth_code": "264302",
    "currency": "JPY",
    "payment_method": "ECMC-SSL",
    "scheme": "MASTERCARD",
    "card": {
      "name": "John Doe",
      "number": "5200000000001005",
      "exp_month": "12",
      "exp_year": "24"
    },
    "additional_data": {
      "payment_data_source": {
        "type": "card"
      }
    }
  },
  "transaction_details": {
    "id": "626fa81d-9819-4947-bb9b-b0f11e00a50e",
    "ref": 74824,
    "timestamp": "2024-11-25T08:51:52.000Z",
    "merchant_txn_ref": "qwe"
  }
}

Key Points

  • The Refund API allows the merchant to reverse a transaction, sending the funds back to the customer’s payment method.
  • This API is typically used in scenarios such as order cancellations, product returns, or when a customer disputes a charge.
  • Refunds can be partial or full, depending on the amount specified in the refund request. If a partial amount is refunded, the remaining balance of the original transaction is still valid.

Flow diagram

Flow diagram image

Api Parameters

Authorizations

Authorization
string
header
required

API Key for Authorization. Format: 'Basic YOUR_API_KEY_HERE'

x-api-key
string
header
required

API Key specific to x-api-key.

Body

application/json

The request payload to refund a transaction.

transactionId
string
required

The original transaction ID of the authorized transaction.

Maximum length: 36
Example:

"9dfd39ec-eb4a-4f8b-a526-17abf140a717"

amount
integer
required

The amount to be refunded. This should not exceed the amount captured or purchased. Amount limit depends on the bank.

Example:

1000

merchant_id
string
required

The merchant ID (DASMID).

Maximum length: 10
Example:

"< Merchant ID >"

notes
string

The reference of the refund transaction (optional).

Maximum length: 128
Example:

"Refund amount captured/purchased"

Response

201 - application/json

Transaction refunded successfully

success
boolean

True on successful transaction, false on failure.

Example:

true

status_code
integer

The status code of the transaction.

Example:

201

is_live
boolean

True if live transaction, false if test transaction.

Example:

false

transaction_type
string

The transaction type (e.g., REFUND).

Example:

"REFUND"

gateway_response
object

A JSON object containing the response from the gateway.

merchant_details
object

A JSON object containing the details of the merchant.

payment_details
object

A JSON object containing the payment details of the transaction.

transaction_details
object

A JSON object containing details of the transaction.