取引を無効にする
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/void \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"transactionId": "ab8444e7-fec0-40dd-994d-0ad813785f74",
"merchant_id": "< Merchant ID >"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/void"
payload = {
"transactionId": "ab8444e7-fec0-40dd-994d-0ad813785f74",
"merchant_id": "< Merchant ID >"
}
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: 'ab8444e7-fec0-40dd-994d-0ad813785f74',
merchant_id: '< Merchant ID >'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/void', 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/void",
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' => 'ab8444e7-fec0-40dd-994d-0ad813785f74',
'merchant_id' => '< Merchant ID >'
]),
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/void"
payload := strings.NewReader("{\n \"transactionId\": \"ab8444e7-fec0-40dd-994d-0ad813785f74\",\n \"merchant_id\": \"< Merchant ID >\"\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/void")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transactionId\": \"ab8444e7-fec0-40dd-994d-0ad813785f74\",\n \"merchant_id\": \"< Merchant ID >\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/void")
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\": \"ab8444e7-fec0-40dd-994d-0ad813785f74\",\n \"merchant_id\": \"< Merchant ID >\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status_code": 201,
"is_live": false,
"transaction_type": "VOID",
"gateway_response": {
"version": "1",
"type": "INFO",
"message": "承認が正常にキャンセルされました。",
"code": "INFO0003"
},
"merchant_details": {
"legal_name": "Tink15 Factory",
"mid": "< Merchant ID >",
"merchant_txn_ref": "qwe"
},
"payment_details": {
"amount": 1000,
"response_code": 0,
"auth_code": "917290",
"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": "9e9255f5-d3dc-423e-9026-6e4da194bab5",
"ref": 74813,
"timestamp": "2024-11-25T08:33:48.000Z",
"merchant_txn_ref": "qwe"
}
}サーバー間通信
認証無効化API
認証無効化APIは、資金がキャプチャされる前に、以前に認証された支払いをキャンセルし、顧客のアカウントでの保留を解除するために使用されます。
POST
/
api
/
v1
/
server-to-server-interface
/
void
取引を無効にする
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/void \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"transactionId": "ab8444e7-fec0-40dd-994d-0ad813785f74",
"merchant_id": "< Merchant ID >"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/void"
payload = {
"transactionId": "ab8444e7-fec0-40dd-994d-0ad813785f74",
"merchant_id": "< Merchant ID >"
}
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: 'ab8444e7-fec0-40dd-994d-0ad813785f74',
merchant_id: '< Merchant ID >'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/void', 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/void",
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' => 'ab8444e7-fec0-40dd-994d-0ad813785f74',
'merchant_id' => '< Merchant ID >'
]),
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/void"
payload := strings.NewReader("{\n \"transactionId\": \"ab8444e7-fec0-40dd-994d-0ad813785f74\",\n \"merchant_id\": \"< Merchant ID >\"\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/void")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transactionId\": \"ab8444e7-fec0-40dd-994d-0ad813785f74\",\n \"merchant_id\": \"< Merchant ID >\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/void")
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\": \"ab8444e7-fec0-40dd-994d-0ad813785f74\",\n \"merchant_id\": \"< Merchant ID >\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status_code": 201,
"is_live": false,
"transaction_type": "VOID",
"gateway_response": {
"version": "1",
"type": "INFO",
"message": "承認が正常にキャンセルされました。",
"code": "INFO0003"
},
"merchant_details": {
"legal_name": "Tink15 Factory",
"mid": "< Merchant ID >",
"merchant_txn_ref": "qwe"
},
"payment_details": {
"amount": 1000,
"response_code": 0,
"auth_code": "917290",
"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": "9e9255f5-d3dc-423e-9026-6e4da194bab5",
"ref": 74813,
"timestamp": "2024-11-25T08:33:48.000Z",
"merchant_txn_ref": "qwe"
}
}重要なポイント
- 認証無効化APIは、認証されたがまだキャプチャされていない取引を進めない決定がなされた場合に非常に重要です。
- 認証が無効化されると、顧客のアカウントで保留されていた資金が解放され、再び顧客が使用できるようになります。
- このAPIは、注文が履行前にキャンセルされた場合や、取引詳細の変更により再認証が必要な場合に一般的に使用されます。
フローダイアグラム
APIパラメータ
承認
認証のためのAPIキー。形式:'Basic YOUR_API_KEY_HERE'
x-api-key専用のAPIキー。
ボディ
application/json
取引を無効にするためのリクエストペイロード。
レスポンス
201 - application/json
取引が正常に無効化されました。
取引が成功した場合はtrue、失敗した場合はfalse。
例:
true
取引のステータスコード。
例:
201
本番取引の場合はtrue、テスト取引の場合はfalse。
例:
false
取引タイプ(例:VOID)。
例:
"VOID"
ゲートウェイからの応答を含む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