取引をキャプチャする
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/capture \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"transactionId": "e0b0731e-7170-4b64-8a21-7d835eebd641",
"amount": 1000,
"merchant_id": "< Merchant ID >",
"notes": "Capturing authorised amount"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/capture"
payload = {
"transactionId": "e0b0731e-7170-4b64-8a21-7d835eebd641",
"amount": 1000,
"merchant_id": "< Merchant ID >",
"notes": "Capturing authorised amount"
}
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: 'e0b0731e-7170-4b64-8a21-7d835eebd641',
amount: 1000,
merchant_id: '< Merchant ID >',
notes: 'Capturing authorised amount'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/capture', 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/capture",
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' => 'e0b0731e-7170-4b64-8a21-7d835eebd641',
'amount' => 1000,
'merchant_id' => '< Merchant ID >',
'notes' => 'Capturing authorised amount'
]),
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/capture"
payload := strings.NewReader("{\n \"transactionId\": \"e0b0731e-7170-4b64-8a21-7d835eebd641\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Capturing authorised amount\"\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/capture")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transactionId\": \"e0b0731e-7170-4b64-8a21-7d835eebd641\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Capturing authorised amount\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/capture")
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\": \"e0b0731e-7170-4b64-8a21-7d835eebd641\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Capturing authorised amount\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status_code": 201,
"is_live": false,
"transaction_type": "CAPTURE",
"gateway_response": {
"version": "1",
"type": "INFO",
"message": "金額が正常にキャプチャされました。",
"code": "INFO0001"
},
"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": "9dfd39ec-eb4a-4f8b-a526-17abf140a717",
"ref": 74819,
"timestamp": "2024-11-25T08:41:15.000Z",
"merchant_txn_ref": "qwe"
}
}サーバー間通信
キャプチャAPI
キャプチャAPIは、以前に認証APIを通じて認可された資金を転送することにより、支払いを完了させます。
POST
/
api
/
v1
/
server-to-server-interface
/
capture
取引をキャプチャする
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/capture \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"transactionId": "e0b0731e-7170-4b64-8a21-7d835eebd641",
"amount": 1000,
"merchant_id": "< Merchant ID >",
"notes": "Capturing authorised amount"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/capture"
payload = {
"transactionId": "e0b0731e-7170-4b64-8a21-7d835eebd641",
"amount": 1000,
"merchant_id": "< Merchant ID >",
"notes": "Capturing authorised amount"
}
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: 'e0b0731e-7170-4b64-8a21-7d835eebd641',
amount: 1000,
merchant_id: '< Merchant ID >',
notes: 'Capturing authorised amount'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/capture', 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/capture",
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' => 'e0b0731e-7170-4b64-8a21-7d835eebd641',
'amount' => 1000,
'merchant_id' => '< Merchant ID >',
'notes' => 'Capturing authorised amount'
]),
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/capture"
payload := strings.NewReader("{\n \"transactionId\": \"e0b0731e-7170-4b64-8a21-7d835eebd641\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Capturing authorised amount\"\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/capture")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"transactionId\": \"e0b0731e-7170-4b64-8a21-7d835eebd641\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Capturing authorised amount\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/capture")
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\": \"e0b0731e-7170-4b64-8a21-7d835eebd641\",\n \"amount\": 1000,\n \"merchant_id\": \"< Merchant ID >\",\n \"notes\": \"Capturing authorised amount\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status_code": 201,
"is_live": false,
"transaction_type": "CAPTURE",
"gateway_response": {
"version": "1",
"type": "INFO",
"message": "金額が正常にキャプチャされました。",
"code": "INFO0001"
},
"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": "9dfd39ec-eb4a-4f8b-a526-17abf140a717",
"ref": 74819,
"timestamp": "2024-11-25T08:41:15.000Z",
"merchant_txn_ref": "qwe"
}
}重要なポイント
- キャプチャAPIは、顧客のアカウントから加盟店のアカウントに認可された資金を移動させることにより、決済プロセスを完了させます。
- このAPIは通常、認証後に最終金額が確認された後(商品発送後やサービス提供後など)に使用されます。
- 以前に認可された金額のみがキャプチャできます。キャプチャ金額が少ない場合、残りの資金は返金されます。
フローダイアグラム
APIパラメータ
承認
認証のためのAPIキー。形式:'Basic YOUR_API_KEY_HERE'
x-api-key専用のAPIキー。
ボディ
application/json
取引をキャプチャするためのリクエストペイロード。
承認された取引の元の取引ID。
Maximum string length:
36例:
"e0b0731e-7170-4b64-8a21-7d835eebd641"
キャプチャする金額。これは承認された金額を超えてはなりません。金額の制限は銀行によって異なります。
例:
1000
加盟店ID(DASMID)。
Maximum string length:
10例:
"< Merchant ID >"
キャプチャ取引の参照(オプション)。
Maximum string length:
128例:
"Capturing authorised amount"
レスポンス
201 - application/json
取引が正常にキャプチャされました。
取引が成功した場合はtrue、失敗した場合はfalse。
例:
true
取引のステータスコード。
例:
201
本番取引の場合はtrue、テスト取引の場合はfalse。
例:
false
取引タイプ(例:CAPTURE)。
例:
"CAPTURE"
ゲートウェイからの応答を含む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