主动发起扣款
curl --request POST \
--url https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct \
--header 'Content-Type: application/json' \
--header 'X-GatePay-Certificate-ClientId: <x-gatepay-certificate-clientid>' \
--header 'X-GatePay-Nonce: <x-gatepay-nonce>' \
--header 'X-GatePay-Signature: <x-gatepay-signature>' \
--header 'X-GatePay-Timestamp: <x-gatepay-timestamp>' \
--data '
{
"merchantDeductNo": "DEDUCT_20260420_001",
"amount": 10.5,
"currency": "USDT"
}
'import requests
url = "https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct"
payload = {
"merchantDeductNo": "DEDUCT_20260420_001",
"amount": 10.5,
"currency": "USDT"
}
headers = {
"X-GatePay-Certificate-ClientId": "<x-gatepay-certificate-clientid>",
"X-GatePay-Signature": "<x-gatepay-signature>",
"X-GatePay-Timestamp": "<x-gatepay-timestamp>",
"X-GatePay-Nonce": "<x-gatepay-nonce>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-GatePay-Certificate-ClientId': '<x-gatepay-certificate-clientid>',
'X-GatePay-Signature': '<x-gatepay-signature>',
'X-GatePay-Timestamp': '<x-gatepay-timestamp>',
'X-GatePay-Nonce': '<x-gatepay-nonce>',
'Content-Type': 'application/json'
},
body: JSON.stringify({merchantDeductNo: 'DEDUCT_20260420_001', amount: 10.5, currency: 'USDT'})
};
fetch('https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct', 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://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct",
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([
'merchantDeductNo' => 'DEDUCT_20260420_001',
'amount' => 10.5,
'currency' => 'USDT'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-GatePay-Certificate-ClientId: <x-gatepay-certificate-clientid>",
"X-GatePay-Nonce: <x-gatepay-nonce>",
"X-GatePay-Signature: <x-gatepay-signature>",
"X-GatePay-Timestamp: <x-gatepay-timestamp>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct")
.header("X-GatePay-Certificate-ClientId", "<x-gatepay-certificate-clientid>")
.header("X-GatePay-Signature", "<x-gatepay-signature>")
.header("X-GatePay-Timestamp", "<x-gatepay-timestamp>")
.header("X-GatePay-Nonce", "<x-gatepay-nonce>")
.header("Content-Type", "application/json")
.body("{\n \"merchantDeductNo\": \"DEDUCT_20260420_001\",\n \"amount\": 10.5,\n \"currency\": \"USDT\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct"
payload := strings.NewReader("{\n \"merchantDeductNo\": \"DEDUCT_20260420_001\",\n \"amount\": 10.5,\n \"currency\": \"USDT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-GatePay-Certificate-ClientId", "<x-gatepay-certificate-clientid>")
req.Header.Add("X-GatePay-Signature", "<x-gatepay-signature>")
req.Header.Add("X-GatePay-Timestamp", "<x-gatepay-timestamp>")
req.Header.Add("X-GatePay-Nonce", "<x-gatepay-nonce>")
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))
}require 'uri'
require 'net/http'
url = URI("https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-GatePay-Certificate-ClientId"] = '<x-gatepay-certificate-clientid>'
request["X-GatePay-Signature"] = '<x-gatepay-signature>'
request["X-GatePay-Timestamp"] = '<x-gatepay-timestamp>'
request["X-GatePay-Nonce"] = '<x-gatepay-nonce>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchantDeductNo\": \"DEDUCT_20260420_001\",\n \"amount\": 10.5,\n \"currency\": \"USDT\"\n}"
response = http.request(request)
puts response.read_body{
"code": "0",
"message": "",
"data": {
"deductOrderNo": "70778338049917033",
"merchantDeductNo": "DEDUCT_20260420_001",
"status": "SUCCESS",
"amount": "10.50000000",
"currency": "USDT",
"totalDeducted": "10.50000000",
"remainingAmount": "89.50000000",
"deductTime": 1773989575000
},
"success": true
}扣款
主动发起扣款
商户主动对订阅单发起扣款;subscriptionOrderNo 与 merchantSubscriptionOrderNo 须二选一传入。merchantDeductNo 在商户侧全局唯一,用于幂等。
POST
/
pay-subscription
/
open
/
institution
/
v1
/
order
/
deduct
主动发起扣款
curl --request POST \
--url https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct \
--header 'Content-Type: application/json' \
--header 'X-GatePay-Certificate-ClientId: <x-gatepay-certificate-clientid>' \
--header 'X-GatePay-Nonce: <x-gatepay-nonce>' \
--header 'X-GatePay-Signature: <x-gatepay-signature>' \
--header 'X-GatePay-Timestamp: <x-gatepay-timestamp>' \
--data '
{
"merchantDeductNo": "DEDUCT_20260420_001",
"amount": 10.5,
"currency": "USDT"
}
'import requests
url = "https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct"
payload = {
"merchantDeductNo": "DEDUCT_20260420_001",
"amount": 10.5,
"currency": "USDT"
}
headers = {
"X-GatePay-Certificate-ClientId": "<x-gatepay-certificate-clientid>",
"X-GatePay-Signature": "<x-gatepay-signature>",
"X-GatePay-Timestamp": "<x-gatepay-timestamp>",
"X-GatePay-Nonce": "<x-gatepay-nonce>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-GatePay-Certificate-ClientId': '<x-gatepay-certificate-clientid>',
'X-GatePay-Signature': '<x-gatepay-signature>',
'X-GatePay-Timestamp': '<x-gatepay-timestamp>',
'X-GatePay-Nonce': '<x-gatepay-nonce>',
'Content-Type': 'application/json'
},
body: JSON.stringify({merchantDeductNo: 'DEDUCT_20260420_001', amount: 10.5, currency: 'USDT'})
};
fetch('https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct', 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://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct",
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([
'merchantDeductNo' => 'DEDUCT_20260420_001',
'amount' => 10.5,
'currency' => 'USDT'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-GatePay-Certificate-ClientId: <x-gatepay-certificate-clientid>",
"X-GatePay-Nonce: <x-gatepay-nonce>",
"X-GatePay-Signature: <x-gatepay-signature>",
"X-GatePay-Timestamp: <x-gatepay-timestamp>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct")
.header("X-GatePay-Certificate-ClientId", "<x-gatepay-certificate-clientid>")
.header("X-GatePay-Signature", "<x-gatepay-signature>")
.header("X-GatePay-Timestamp", "<x-gatepay-timestamp>")
.header("X-GatePay-Nonce", "<x-gatepay-nonce>")
.header("Content-Type", "application/json")
.body("{\n \"merchantDeductNo\": \"DEDUCT_20260420_001\",\n \"amount\": 10.5,\n \"currency\": \"USDT\"\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct"
payload := strings.NewReader("{\n \"merchantDeductNo\": \"DEDUCT_20260420_001\",\n \"amount\": 10.5,\n \"currency\": \"USDT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-GatePay-Certificate-ClientId", "<x-gatepay-certificate-clientid>")
req.Header.Add("X-GatePay-Signature", "<x-gatepay-signature>")
req.Header.Add("X-GatePay-Timestamp", "<x-gatepay-timestamp>")
req.Header.Add("X-GatePay-Nonce", "<x-gatepay-nonce>")
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))
}require 'uri'
require 'net/http'
url = URI("https://openplatform.gateapi.io/pay-subscription/open/institution/v1/order/deduct")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-GatePay-Certificate-ClientId"] = '<x-gatepay-certificate-clientid>'
request["X-GatePay-Signature"] = '<x-gatepay-signature>'
request["X-GatePay-Timestamp"] = '<x-gatepay-timestamp>'
request["X-GatePay-Nonce"] = '<x-gatepay-nonce>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchantDeductNo\": \"DEDUCT_20260420_001\",\n \"amount\": 10.5,\n \"currency\": \"USDT\"\n}"
response = http.request(request)
puts response.read_body{
"code": "0",
"message": "",
"data": {
"deductOrderNo": "70778338049917033",
"merchantDeductNo": "DEDUCT_20260420_001",
"status": "SUCCESS",
"amount": "10.50000000",
"currency": "USDT",
"totalDeducted": "10.50000000",
"remainingAmount": "89.50000000",
"deductTime": 1773989575000
},
"success": true
}概述
本页说明POST /pay-subscription/open/institution/v1/order/deduct 接口。完整的请求参数、响应结构与示例由上方关联的 OpenAPI 定义渲染。
说明
- 鉴权使用 GatePay 标准签名请求头。
- 本页为机构开放平台路径说明。
- 签名与验签规则见 /api-reference/version/100/cn/common/securityAndSignature。
请求头
商户客户端ID,在 GatePay 平台申请获得
示例:
"4186d0c6-6a35-55a9-8dc6-5312769dbff8"
HMAC-SHA256签名,用于验证请求合法性
示例:
"672d5650dcc9bb22ebf25fa16c28d03c0e159d742a9176d4340a5da326d75dc8a2ec24c97fa6fc5d1533dd6e968863747e1d86a45e562cbe899f9ed7e9ca7f77"
毫秒级时间戳,与服务端时间偏差不得超过30秒
示例:
"1672905655498"
随机数,用于防止重放攻击
示例:
"9578"
请求体
application/json
主动扣款请求体
商户扣款编号,全局唯一,用于幂等控制
扣款金额,须大于 0,且须与订阅单约定一致
扣款币种,须与订阅单一致
平台订阅订单编号(与 merchantSubscriptionOrderNo 二选一必填)
商户订阅订单编号(与 subscriptionOrderNo 二选一必填)
扣款说明,展示给用户,最多 100 字符
Maximum string length:
100⌘I

