curl --request POST \
--url https://api.kyrenpay.com/epay/mapi.php \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data pid=merch_001 \
--data type=wxpay \
--data out_trade_no=order_20260409002 \
--data notify_url=https://merchant.example.com/pay/notify \
--data return_url=https://merchant.example.com/pay/return \
--data 'name=AI Credits 1000' \
--data money=9.99 \
--data money_type=CNY \
--data 'display_merchant_name=Campaign Store' \
--data param=user_42 \
--data clientip=203.0.113.9 \
--data device=pc \
--data sign=1ce4f4f5294ec4c95f6b79ff79dbb57b \
--data sign_type=MD5import requests
url = "https://api.kyrenpay.com/epay/mapi.php"
payload = {
"pid": "merch_001",
"type": "wxpay",
"out_trade_no": "order_20260409002",
"notify_url": "https://merchant.example.com/pay/notify",
"return_url": "https://merchant.example.com/pay/return",
"name": "AI Credits 1000",
"money": "9.99",
"money_type": "CNY",
"display_merchant_name": "Campaign Store",
"param": "user_42",
"clientip": "203.0.113.9",
"device": "pc",
"sign": "1ce4f4f5294ec4c95f6b79ff79dbb57b",
"sign_type": "MD5"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
pid: 'merch_001',
type: 'wxpay',
out_trade_no: 'order_20260409002',
notify_url: 'https://merchant.example.com/pay/notify',
return_url: 'https://merchant.example.com/pay/return',
name: 'AI Credits 1000',
money: '9.99',
money_type: 'CNY',
display_merchant_name: 'Campaign Store',
param: 'user_42',
clientip: '203.0.113.9',
device: 'pc',
sign: '1ce4f4f5294ec4c95f6b79ff79dbb57b',
sign_type: 'MD5'
})
};
fetch('https://api.kyrenpay.com/epay/mapi.php', 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.kyrenpay.com/epay/mapi.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "pid=merch_001&type=wxpay&out_trade_no=order_20260409002¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Freturn&name=AI%20Credits%201000&money=9.99&money_type=CNY&display_merchant_name=Campaign%20Store¶m=user_42&clientip=203.0.113.9&device=pc&sign=1ce4f4f5294ec4c95f6b79ff79dbb57b&sign_type=MD5",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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.kyrenpay.com/epay/mapi.php"
payload := strings.NewReader("pid=merch_001&type=wxpay&out_trade_no=order_20260409002¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Freturn&name=AI%20Credits%201000&money=9.99&money_type=CNY&display_merchant_name=Campaign%20Store¶m=user_42&clientip=203.0.113.9&device=pc&sign=1ce4f4f5294ec4c95f6b79ff79dbb57b&sign_type=MD5")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
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.kyrenpay.com/epay/mapi.php")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("pid=merch_001&type=wxpay&out_trade_no=order_20260409002¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Freturn&name=AI%20Credits%201000&money=9.99&money_type=CNY&display_merchant_name=Campaign%20Store¶m=user_42&clientip=203.0.113.9&device=pc&sign=1ce4f4f5294ec4c95f6b79ff79dbb57b&sign_type=MD5")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kyrenpay.com/epay/mapi.php")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "pid=merch_001&type=wxpay&out_trade_no=order_20260409002¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Freturn&name=AI%20Credits%201000&money=9.99&money_type=CNY&display_merchant_name=Campaign%20Store¶m=user_42&clientip=203.0.113.9&device=pc&sign=1ce4f4f5294ec4c95f6b79ff79dbb57b&sign_type=MD5"
response = http.request(request)
puts response.read_body{
"code": 1,
"trade_no": "order_epay_001",
"out_trade_no": "order_20260409002",
"qrcode": "weixin://wxpay/bizpayurl?pr=xxxx",
"img": "https://api.qrserver.com/v1/create-qr-code/?size=240x240&data=weixin%3A%2F%2Fwxpay%2Fbizpayurl%3Fpr%3Dxxxx"
}mapi.php (direct create payment compatibility endpoint)
Creates (or reuses) an order directly and returns Epay-style response fields.
For QR-style channels, response includes qrcode and img.
For redirect-style channels, response includes payurl.
Paydify:商户一次性加密货币通道绑定 Paydify 时使用 type=crypto,沿用 MD5 签名。
返回 code=1/trade_no/out_trade_no/payurl,其中 payurl 指向 Kyren 本地支付页;不返回上游 qrcode/img。
买家选择 App / 网络并确认有效 USDT 报价后才创建上游支付;不新增商户必填参数,目前不支持 USDC。
money/money_type 表示原商品计价金额,不是应付 USDT 数量;入口 code=1 不代表已付款。
同一商户 out_trade_no 重试必须保持金额、币种和支付方式一致,不能用重建订单处理未知支付结果。
目标环境须已部署且渠道已开通;文档不替代 Sandbox 真付验收。
Signature algorithm:
- Remove
signandsign_type, and drop empty values. - Sort parameters by key in ascending order.
- Join as
k=vwith&, append merchant API key. - MD5 the final string and compare in lowercase.
curl --request POST \
--url https://api.kyrenpay.com/epay/mapi.php \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data pid=merch_001 \
--data type=wxpay \
--data out_trade_no=order_20260409002 \
--data notify_url=https://merchant.example.com/pay/notify \
--data return_url=https://merchant.example.com/pay/return \
--data 'name=AI Credits 1000' \
--data money=9.99 \
--data money_type=CNY \
--data 'display_merchant_name=Campaign Store' \
--data param=user_42 \
--data clientip=203.0.113.9 \
--data device=pc \
--data sign=1ce4f4f5294ec4c95f6b79ff79dbb57b \
--data sign_type=MD5import requests
url = "https://api.kyrenpay.com/epay/mapi.php"
payload = {
"pid": "merch_001",
"type": "wxpay",
"out_trade_no": "order_20260409002",
"notify_url": "https://merchant.example.com/pay/notify",
"return_url": "https://merchant.example.com/pay/return",
"name": "AI Credits 1000",
"money": "9.99",
"money_type": "CNY",
"display_merchant_name": "Campaign Store",
"param": "user_42",
"clientip": "203.0.113.9",
"device": "pc",
"sign": "1ce4f4f5294ec4c95f6b79ff79dbb57b",
"sign_type": "MD5"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
pid: 'merch_001',
type: 'wxpay',
out_trade_no: 'order_20260409002',
notify_url: 'https://merchant.example.com/pay/notify',
return_url: 'https://merchant.example.com/pay/return',
name: 'AI Credits 1000',
money: '9.99',
money_type: 'CNY',
display_merchant_name: 'Campaign Store',
param: 'user_42',
clientip: '203.0.113.9',
device: 'pc',
sign: '1ce4f4f5294ec4c95f6b79ff79dbb57b',
sign_type: 'MD5'
})
};
fetch('https://api.kyrenpay.com/epay/mapi.php', 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.kyrenpay.com/epay/mapi.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "pid=merch_001&type=wxpay&out_trade_no=order_20260409002¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Freturn&name=AI%20Credits%201000&money=9.99&money_type=CNY&display_merchant_name=Campaign%20Store¶m=user_42&clientip=203.0.113.9&device=pc&sign=1ce4f4f5294ec4c95f6b79ff79dbb57b&sign_type=MD5",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$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.kyrenpay.com/epay/mapi.php"
payload := strings.NewReader("pid=merch_001&type=wxpay&out_trade_no=order_20260409002¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Freturn&name=AI%20Credits%201000&money=9.99&money_type=CNY&display_merchant_name=Campaign%20Store¶m=user_42&clientip=203.0.113.9&device=pc&sign=1ce4f4f5294ec4c95f6b79ff79dbb57b&sign_type=MD5")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
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.kyrenpay.com/epay/mapi.php")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("pid=merch_001&type=wxpay&out_trade_no=order_20260409002¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Freturn&name=AI%20Credits%201000&money=9.99&money_type=CNY&display_merchant_name=Campaign%20Store¶m=user_42&clientip=203.0.113.9&device=pc&sign=1ce4f4f5294ec4c95f6b79ff79dbb57b&sign_type=MD5")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kyrenpay.com/epay/mapi.php")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "pid=merch_001&type=wxpay&out_trade_no=order_20260409002¬ify_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Fnotify&return_url=https%3A%2F%2Fmerchant.example.com%2Fpay%2Freturn&name=AI%20Credits%201000&money=9.99&money_type=CNY&display_merchant_name=Campaign%20Store¶m=user_42&clientip=203.0.113.9&device=pc&sign=1ce4f4f5294ec4c95f6b79ff79dbb57b&sign_type=MD5"
response = http.request(request)
puts response.read_body{
"code": 1,
"trade_no": "order_epay_001",
"out_trade_no": "order_20260409002",
"qrcode": "weixin://wxpay/bizpayurl?pr=xxxx",
"img": "https://api.qrserver.com/v1/create-qr-code/?size=240x240&data=weixin%3A%2F%2Fwxpay%2Fbizpayurl%3Fpr%3Dxxxx"
}Body
Merchant ID
Payment channel type in Epay compatibility mode. crypto 按商户绑定选择 Satogate 或 Paydify;Paydify 不新增独立 type 值,也不能通过请求参数覆盖绑定。
alipay, wxpay, creditcard, crypto, paynow Merchant order number (must be unique under one merchant)
Merchant async callback URL
Product name
Order amount, decimal string, must be greater than 0. Paydify 下此值为 money_type 对应的商品计价金额,不是应付 USDT 数量;买家费用按现有规则计算。
Client IP address
Lowercase MD5 signature
Signature type. Current compatibility implementation only supports MD5.
MD5 Merchant sync return URL
Currency code. Defaults to CNY when omitted. Paydify 在本地页按此计价币种锁定有效 USDT 报价,报价不可用时不回退提交 USD。
Pass-through parameter returned in callbacks and order queries
Optional per-payment merchant display name shown on Kyren intermediate payment pages
80Device identifier passed to gateway (e.g. pc)
Optional JSON string for non-card channel-specific fields.
For type=creditcard, the raw value participates in signature verification
but is ignored after verification. Do not send card details or billing/contact
data in this field; the buyer enters card information on a hosted payment page.
Optional merchant user identifier passed to the payment gateway when supported.
Response
Epay-compatible create payment result
- Option 1
- Option 2
1 Platform order ID
Merchant order number
Redirect URL for browser/app payment flows. Paydify 返回 Kyren 本地 /epay/redirect/{orderId},不是上游付款二维码内容或已付款凭据。
QR code payload or H5 payment URL depending on channel. Paydify 的 mapi.php 响应不返回此字段,应打开 payurl 完成买家选择与报价确认。
QR image URL generated from qrcode for channels that return it. Paydify 的 mapi.php 响应不返回此字段;其本地页直接展示上游返回的二维码图片。