订阅申请
curl --request POST \
--url https://api.example.com/subscription/apply \
--header 'Content-Type: application/json' \
--data '
{
"country": "USA",
"website": "https://test.com",
"amount": "0.5",
"callBackUrl": "https://www.google.com",
"appId": 10245,
"partnerUserId": "123456",
"currency": "USD",
"name": "John Doe",
"phone": "1234567890",
"email": "test@gmail.com",
"subscriptionOrderId": "202506181112003554578260",
"subject": "VIP会员",
"body": "VIP会员月付",
"inBankCode": "CREDIT_CARD",
"payType": "SUBSCRIPTION",
"notifyUrl": "https://www.google.com",
"recurringInterval": "M",
"recurringIntervalCount": 1,
"recurringMaxNumber": 12,
"retryTimes": 3,
"sign": "EA66451051A2A96D3284D09DE4A5B78D"
}
'import requests
url = "https://api.example.com/subscription/apply"
payload = {
"country": "USA",
"website": "https://test.com",
"amount": "0.5",
"callBackUrl": "https://www.google.com",
"appId": 10245,
"partnerUserId": "123456",
"currency": "USD",
"name": "John Doe",
"phone": "1234567890",
"email": "test@gmail.com",
"subscriptionOrderId": "202506181112003554578260",
"subject": "VIP会员",
"body": "VIP会员月付",
"inBankCode": "CREDIT_CARD",
"payType": "SUBSCRIPTION",
"notifyUrl": "https://www.google.com",
"recurringInterval": "M",
"recurringIntervalCount": 1,
"recurringMaxNumber": 12,
"retryTimes": 3,
"sign": "EA66451051A2A96D3284D09DE4A5B78D"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
country: 'USA',
website: 'https://test.com',
amount: '0.5',
callBackUrl: 'https://www.google.com',
appId: 10245,
partnerUserId: '123456',
currency: 'USD',
name: 'John Doe',
phone: '1234567890',
email: 'test@gmail.com',
subscriptionOrderId: '202506181112003554578260',
subject: 'VIP会员',
body: JSON.stringify('VIP会员月付'),
inBankCode: 'CREDIT_CARD',
payType: 'SUBSCRIPTION',
notifyUrl: 'https://www.google.com',
recurringInterval: 'M',
recurringIntervalCount: 1,
recurringMaxNumber: 12,
retryTimes: 3,
sign: 'EA66451051A2A96D3284D09DE4A5B78D'
})
};
fetch('https://api.example.com/subscription/apply', 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.example.com/subscription/apply",
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([
'country' => 'USA',
'website' => 'https://test.com',
'amount' => '0.5',
'callBackUrl' => 'https://www.google.com',
'appId' => 10245,
'partnerUserId' => '123456',
'currency' => 'USD',
'name' => 'John Doe',
'phone' => '1234567890',
'email' => 'test@gmail.com',
'subscriptionOrderId' => '202506181112003554578260',
'subject' => 'VIP会员',
'body' => 'VIP会员月付',
'inBankCode' => 'CREDIT_CARD',
'payType' => 'SUBSCRIPTION',
'notifyUrl' => 'https://www.google.com',
'recurringInterval' => 'M',
'recurringIntervalCount' => 1,
'recurringMaxNumber' => 12,
'retryTimes' => 3,
'sign' => 'EA66451051A2A96D3284D09DE4A5B78D'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.example.com/subscription/apply"
payload := strings.NewReader("{\n \"country\": \"USA\",\n \"website\": \"https://test.com\",\n \"amount\": \"0.5\",\n \"callBackUrl\": \"https://www.google.com\",\n \"appId\": 10245,\n \"partnerUserId\": \"123456\",\n \"currency\": \"USD\",\n \"name\": \"John Doe\",\n \"phone\": \"1234567890\",\n \"email\": \"test@gmail.com\",\n \"subscriptionOrderId\": \"202506181112003554578260\",\n \"subject\": \"VIP会员\",\n \"body\": \"VIP会员月付\",\n \"inBankCode\": \"CREDIT_CARD\",\n \"payType\": \"SUBSCRIPTION\",\n \"notifyUrl\": \"https://www.google.com\",\n \"recurringInterval\": \"M\",\n \"recurringIntervalCount\": 1,\n \"recurringMaxNumber\": 12,\n \"retryTimes\": 3,\n \"sign\": \"EA66451051A2A96D3284D09DE4A5B78D\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/subscription/apply")
.header("Content-Type", "application/json")
.body("{\n \"country\": \"USA\",\n \"website\": \"https://test.com\",\n \"amount\": \"0.5\",\n \"callBackUrl\": \"https://www.google.com\",\n \"appId\": 10245,\n \"partnerUserId\": \"123456\",\n \"currency\": \"USD\",\n \"name\": \"John Doe\",\n \"phone\": \"1234567890\",\n \"email\": \"test@gmail.com\",\n \"subscriptionOrderId\": \"202506181112003554578260\",\n \"subject\": \"VIP会员\",\n \"body\": \"VIP会员月付\",\n \"inBankCode\": \"CREDIT_CARD\",\n \"payType\": \"SUBSCRIPTION\",\n \"notifyUrl\": \"https://www.google.com\",\n \"recurringInterval\": \"M\",\n \"recurringIntervalCount\": 1,\n \"recurringMaxNumber\": 12,\n \"retryTimes\": 3,\n \"sign\": \"EA66451051A2A96D3284D09DE4A5B78D\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/subscription/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"country\": \"USA\",\n \"website\": \"https://test.com\",\n \"amount\": \"0.5\",\n \"callBackUrl\": \"https://www.google.com\",\n \"appId\": 10245,\n \"partnerUserId\": \"123456\",\n \"currency\": \"USD\",\n \"name\": \"John Doe\",\n \"phone\": \"1234567890\",\n \"email\": \"test@gmail.com\",\n \"subscriptionOrderId\": \"202506181112003554578260\",\n \"subject\": \"VIP会员\",\n \"body\": \"VIP会员月付\",\n \"inBankCode\": \"CREDIT_CARD\",\n \"payType\": \"SUBSCRIPTION\",\n \"notifyUrl\": \"https://www.google.com\",\n \"recurringInterval\": \"M\",\n \"recurringIntervalCount\": 1,\n \"recurringMaxNumber\": 12,\n \"retryTimes\": 3,\n \"sign\": \"EA66451051A2A96D3284D09DE4A5B78D\"\n}"
response = http.request(request)
puts response.read_body{
"status": "1",
"error": "00000000",
"msg": "SUCCESS",
"data": {
"subscriptionOrderId": "1234567890",
"subscriptionOrderNo": "1234567890",
"payUrl": "https://test.com"
}
}信用卡订阅
订阅申请
创建订阅订单
POST
/
subscription
/
apply
订阅申请
curl --request POST \
--url https://api.example.com/subscription/apply \
--header 'Content-Type: application/json' \
--data '
{
"country": "USA",
"website": "https://test.com",
"amount": "0.5",
"callBackUrl": "https://www.google.com",
"appId": 10245,
"partnerUserId": "123456",
"currency": "USD",
"name": "John Doe",
"phone": "1234567890",
"email": "test@gmail.com",
"subscriptionOrderId": "202506181112003554578260",
"subject": "VIP会员",
"body": "VIP会员月付",
"inBankCode": "CREDIT_CARD",
"payType": "SUBSCRIPTION",
"notifyUrl": "https://www.google.com",
"recurringInterval": "M",
"recurringIntervalCount": 1,
"recurringMaxNumber": 12,
"retryTimes": 3,
"sign": "EA66451051A2A96D3284D09DE4A5B78D"
}
'import requests
url = "https://api.example.com/subscription/apply"
payload = {
"country": "USA",
"website": "https://test.com",
"amount": "0.5",
"callBackUrl": "https://www.google.com",
"appId": 10245,
"partnerUserId": "123456",
"currency": "USD",
"name": "John Doe",
"phone": "1234567890",
"email": "test@gmail.com",
"subscriptionOrderId": "202506181112003554578260",
"subject": "VIP会员",
"body": "VIP会员月付",
"inBankCode": "CREDIT_CARD",
"payType": "SUBSCRIPTION",
"notifyUrl": "https://www.google.com",
"recurringInterval": "M",
"recurringIntervalCount": 1,
"recurringMaxNumber": 12,
"retryTimes": 3,
"sign": "EA66451051A2A96D3284D09DE4A5B78D"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
country: 'USA',
website: 'https://test.com',
amount: '0.5',
callBackUrl: 'https://www.google.com',
appId: 10245,
partnerUserId: '123456',
currency: 'USD',
name: 'John Doe',
phone: '1234567890',
email: 'test@gmail.com',
subscriptionOrderId: '202506181112003554578260',
subject: 'VIP会员',
body: JSON.stringify('VIP会员月付'),
inBankCode: 'CREDIT_CARD',
payType: 'SUBSCRIPTION',
notifyUrl: 'https://www.google.com',
recurringInterval: 'M',
recurringIntervalCount: 1,
recurringMaxNumber: 12,
retryTimes: 3,
sign: 'EA66451051A2A96D3284D09DE4A5B78D'
})
};
fetch('https://api.example.com/subscription/apply', 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.example.com/subscription/apply",
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([
'country' => 'USA',
'website' => 'https://test.com',
'amount' => '0.5',
'callBackUrl' => 'https://www.google.com',
'appId' => 10245,
'partnerUserId' => '123456',
'currency' => 'USD',
'name' => 'John Doe',
'phone' => '1234567890',
'email' => 'test@gmail.com',
'subscriptionOrderId' => '202506181112003554578260',
'subject' => 'VIP会员',
'body' => 'VIP会员月付',
'inBankCode' => 'CREDIT_CARD',
'payType' => 'SUBSCRIPTION',
'notifyUrl' => 'https://www.google.com',
'recurringInterval' => 'M',
'recurringIntervalCount' => 1,
'recurringMaxNumber' => 12,
'retryTimes' => 3,
'sign' => 'EA66451051A2A96D3284D09DE4A5B78D'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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.example.com/subscription/apply"
payload := strings.NewReader("{\n \"country\": \"USA\",\n \"website\": \"https://test.com\",\n \"amount\": \"0.5\",\n \"callBackUrl\": \"https://www.google.com\",\n \"appId\": 10245,\n \"partnerUserId\": \"123456\",\n \"currency\": \"USD\",\n \"name\": \"John Doe\",\n \"phone\": \"1234567890\",\n \"email\": \"test@gmail.com\",\n \"subscriptionOrderId\": \"202506181112003554578260\",\n \"subject\": \"VIP会员\",\n \"body\": \"VIP会员月付\",\n \"inBankCode\": \"CREDIT_CARD\",\n \"payType\": \"SUBSCRIPTION\",\n \"notifyUrl\": \"https://www.google.com\",\n \"recurringInterval\": \"M\",\n \"recurringIntervalCount\": 1,\n \"recurringMaxNumber\": 12,\n \"retryTimes\": 3,\n \"sign\": \"EA66451051A2A96D3284D09DE4A5B78D\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/subscription/apply")
.header("Content-Type", "application/json")
.body("{\n \"country\": \"USA\",\n \"website\": \"https://test.com\",\n \"amount\": \"0.5\",\n \"callBackUrl\": \"https://www.google.com\",\n \"appId\": 10245,\n \"partnerUserId\": \"123456\",\n \"currency\": \"USD\",\n \"name\": \"John Doe\",\n \"phone\": \"1234567890\",\n \"email\": \"test@gmail.com\",\n \"subscriptionOrderId\": \"202506181112003554578260\",\n \"subject\": \"VIP会员\",\n \"body\": \"VIP会员月付\",\n \"inBankCode\": \"CREDIT_CARD\",\n \"payType\": \"SUBSCRIPTION\",\n \"notifyUrl\": \"https://www.google.com\",\n \"recurringInterval\": \"M\",\n \"recurringIntervalCount\": 1,\n \"recurringMaxNumber\": 12,\n \"retryTimes\": 3,\n \"sign\": \"EA66451051A2A96D3284D09DE4A5B78D\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/subscription/apply")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"country\": \"USA\",\n \"website\": \"https://test.com\",\n \"amount\": \"0.5\",\n \"callBackUrl\": \"https://www.google.com\",\n \"appId\": 10245,\n \"partnerUserId\": \"123456\",\n \"currency\": \"USD\",\n \"name\": \"John Doe\",\n \"phone\": \"1234567890\",\n \"email\": \"test@gmail.com\",\n \"subscriptionOrderId\": \"202506181112003554578260\",\n \"subject\": \"VIP会员\",\n \"body\": \"VIP会员月付\",\n \"inBankCode\": \"CREDIT_CARD\",\n \"payType\": \"SUBSCRIPTION\",\n \"notifyUrl\": \"https://www.google.com\",\n \"recurringInterval\": \"M\",\n \"recurringIntervalCount\": 1,\n \"recurringMaxNumber\": 12,\n \"retryTimes\": 3,\n \"sign\": \"EA66451051A2A96D3284D09DE4A5B78D\"\n}"
response = http.request(request)
puts response.read_body{
"status": "1",
"error": "00000000",
"msg": "SUCCESS",
"data": {
"subscriptionOrderId": "1234567890",
"subscriptionOrderNo": "1234567890",
"payUrl": "https://test.com"
}
}密钥私钥(生成签名)
相关主题
请求体
application/json
业务ID(后台获取,需要根据参数currency传递对应的业务ID)
商户订单号(必须保证唯一性,长度不超过48)
Maximum string length:
48交易金额(精确到小数点后两位;禁止添加标点符号,例如:",")
Pattern:
^\d+\.\d{2}$真实手机号(格式参考电话号码格式)
订阅标题
支付方式编码,与 paymentMethods 二选一
可用选项:
CREDIT_CARD, GOOGLE_PAY, APPLE_PAY 支付方式类型
可用选项:
SUBSCRIPTION 用户支付成功后跳转地址
异步通知地址
国家
币种,目前支持:USD
可用选项:
USD 用户唯一标识(如用户ID userId),用于风控系统,必须真实有效,否则会影响交易。格式要求:数字、大小写字母或常用符号-~!@#$%&*()_。
Pattern:
^[A-Za-z0-9\-~!@#$%&*()_]+$循环周期类型 D(天),W(周),M(月),Y(年)
可用选项:
D, W, M, Y 循环周期间隔
必填范围:
x >= 1最大循环次数,无论循环周期是哪个,最长时间不能超过三年,到期订阅自动取消
必填范围:
x >= 1交易网站
定期扣款失败重试次数,默认为3
必填范围:
x >= 0签名
用户姓名,推荐使用真实姓名,格式:包含firstName和lastName,以空格分割的,示例:John Doe
真实电子邮件
备注详情
用户取消支付URL,如果传递,用户可在支付页面点击返回到此页面
优惠期数(暂时只支持首期优惠与全期优惠,即couponPeriod只能等于1或者等于recurringMaxNumber)
每期优惠金额
Pattern:
^\d+\.\d{2}$支持的支付方式列表,英文逗号分隔,如 CREDIT_CARD,GOOGLE_PAY,APPLE_PAY,与 inBankCode 二选一,暂时仅支持前置组件组合模式使用
最后修改于 2026年7月16日
此页面对您有帮助吗?
⌘I

