curl --request POST \
--url https://api-dev.paymentoptions.com/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"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund"
payload = {
"transactionId": "9dfd39ec-eb4a-4f8b-a526-17abf140a717",
"amount": 1000,
"merchant_id": "< Merchant ID >",
"notes": "Refund amount captured/purchased"
}
headers = {
"Authorization": "<api-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
transactionId: '9dfd39ec-eb4a-4f8b-a526-17abf140a717',
amount: 1000,
merchant_id: '< Merchant ID >',
notes: 'Refund amount captured/purchased'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'transactionId' => '9dfd39ec-eb4a-4f8b-a526-17abf140a717',
'amount' => 1000,
'merchant_id' => '< Merchant ID >',
'notes' => 'Refund amount captured/purchased'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund"
payload := strings.NewReader("{\n \"transactionId\": \"9dfd39ec-eb4a-4f8b-a526-17abf140a717\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Refund amount captured/purchased\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transactionId\": \"9dfd39ec-eb4a-4f8b-a526-17abf140a717\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Refund amount captured/purchased\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transactionId\": \"9dfd39ec-eb4a-4f8b-a526-17abf140a717\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Refund amount captured/purchased\"\n}"
response = http.request(request)
puts response.read_body{
"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": "29"
},
"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"
}
}Refund API
The Refund API is used to return funds to the customer after a successful purchase or capture transaction.
curl --request POST \
--url https://api-dev.paymentoptions.com/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"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund"
payload = {
"transactionId": "9dfd39ec-eb4a-4f8b-a526-17abf140a717",
"amount": 1000,
"merchant_id": "< Merchant ID >",
"notes": "Refund amount captured/purchased"
}
headers = {
"Authorization": "<api-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
transactionId: '9dfd39ec-eb4a-4f8b-a526-17abf140a717',
amount: 1000,
merchant_id: '< Merchant ID >',
notes: 'Refund amount captured/purchased'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'transactionId' => '9dfd39ec-eb4a-4f8b-a526-17abf140a717',
'amount' => 1000,
'merchant_id' => '< Merchant ID >',
'notes' => 'Refund amount captured/purchased'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund"
payload := strings.NewReader("{\n \"transactionId\": \"9dfd39ec-eb4a-4f8b-a526-17abf140a717\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Refund amount captured/purchased\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transactionId\": \"9dfd39ec-eb4a-4f8b-a526-17abf140a717\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Refund amount captured/purchased\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transactionId\": \"9dfd39ec-eb4a-4f8b-a526-17abf140a717\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Refund amount captured/purchased\"\n}"
response = http.request(request)
puts response.read_body{
"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": "29"
},
"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
Api Parameters
Authorizations
API Key for Authorization. Format: 'Basic YOUR_API_KEY_HERE'
API Key specific to x-api-key.
Body
The request payload to refund a transaction.
The original transaction ID of the authorized transaction.
36"9dfd39ec-eb4a-4f8b-a526-17abf140a717"
The amount to be refunded. This should not exceed the amount captured or purchased. Amount limit depends on the bank.
1000
The merchant ID (DASMID).
10"< Merchant ID >"
The reference of the refund transaction (optional).
128"Refund amount captured/purchased"
Response
Transaction refunded successfully
True on successful transaction, false on failure.
true
The status code of the transaction.
201
True if live transaction, false if test transaction.
false
The transaction type (e.g., REFUND).
"REFUND"
A JSON object containing the response from the gateway.
Show child attributes
Show child attributes
A JSON object containing the details of the merchant.
Show child attributes
Show child attributes
A JSON object containing the payment details of the transaction.
Show child attributes
Show child attributes
A JSON object containing details of the transaction.
Show child attributes
Show child attributes