取引を払い戻す
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": "金額が正常に払い戻されました。",
"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"
}
}サーバー間通信
返金API
返金APIは、成功した購入またはキャプチャ取引後に顧客に資金を返金するために使用されます。
POST
/
api
/
v1
/
server-to-server-interface
/
refund
取引を払い戻す
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": "金額が正常に払い戻されました。",
"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"
}
}注意:以下の決済方法では返金はサポートされていません:PayPay、Pay-Easy、Konbini。
重要なポイント
- 返金APIは、加盟店が取引を取り消し、資金を顧客の支払い方法に返金することを可能にします。
- このAPIは、注文キャンセル、商品返品、または顧客が請求に異議を唱える場合などのシナリオで一般的に使用されます。
- 返金は、返金リクエストに指定された金額に応じて部分的または全額で行うことができます。部分的に返金された場合でも、元の取引の残高は有効です。
フローダイアグラム
APIパラメータ
承認
認証のためのAPIキー。形式:'Basic YOUR_API_KEY_HERE'
x-api-key専用のAPIキー。
ボディ
application/json
取引を払い戻すためのリクエストペイロード。
承認された取引の元の取引ID。
Maximum string length:
36例:
"9dfd39ec-eb4a-4f8b-a526-17abf140a717"
払い戻される金額。これはキャプチャまたは購入した金額を超えてはいけません。金額の制限は銀行によって異なります。
例:
1000
加盟店ID(DASMID)。
Maximum string length:
10例:
"< Merchant ID >"
払い戻し取引の参照(オプション)。
Maximum string length:
128例:
"Refund amount captured/purchased"
レスポンス
201 - application/json
取引が正常に払い戻されました。
取引が成功した場合はtrue、失敗した場合はfalse。
例:
true
取引のステータスコード。
例:
201
本番取引の場合はtrue、テスト取引の場合はfalse。
例:
false
取引タイプ(例:REFUND)。
例:
"REFUND"
ゲートウェイからの応答を含むJSONオブジェクト。
Show child attributes
Show child attributes
加盟店の詳細を含むJSONオブジェクト。
Show child attributes
Show child attributes
取引の支払い詳細を含むJSONオブジェクト。
Show child attributes
Show child attributes
取引の詳細を含むJSONオブジェクト。
Show child attributes
Show child attributes
⌘I