💴 API Interface Payment
POST
http://domain from merchant management after login/pay/mapi.php
Interface Description
POST data: pid={merchant_id}&type={payment_method}&out_trade_no={merchant_order_no}¬ify_url={server_async_notify_url}&return_url={page_redirect_notify_url}&name={product_name}&money={amount}&sitename={website_name}&sign={signature_string}&sign_type=MD5
Request Parameters
Field Name
Parameter Name
Required
Type
Example Value
Description
Merchant ID
pid
Required
Int
1000
Merchant ID
Payment Method
type
Required
String
alipay
Payment methods: alipay:Alipay, qqpay:QQ Wallet, wxpay:WeChat Pay
Merchant Order Number
out_trade_no
Required
String
20160806151343349
Merchant Order Number
Async Notification URL
notify_url
Required
String
http://site_domain/notify_url.php
Server async notification URL
Redirect Notification URL
return_url
Required
String
http://site_domain/return_url.php
Page redirect notification URL
Product Name
name
Required
String
An Oreo
Product Name
Product Amount
money
Required
String
1.00
Product Amount
Signature String
sign
Required
String
202cb962ac59075b964b07152d234b70
Signature string, same algorithm as Alipay signature algorithm
Signature Type
sign_type
Required
String
MD5
Currently only supports MD5
Extra Parameter
ext
Optional
String
userId
Extra parameter, max length 100. This parameter will be passed back in callback
Response Parameters
Field Name
Parameter Name
Type
Example Value
Description
Return Status Code
code
Int
200
200 for success, other values for failure
Actual Payment Amount
money
String
1.00
To prevent service risk control, amount may fluctuate up and down, decide whether to continue payment
Type
type
String
alipay
Payment methods: alipay:Alipay, qqpay:QQ Wallet, wxpay:WeChat Pay
QR Code Link
qrcode
String
wxp://f2f15IaTGck0xvm7vug4lqx-sMpJ0xiUB8fWTDwCQk-jYBxS6Yl1A_fOdPGNNGKwPnOt
If this field is returned, generate QR code based on this URL
Order Number
trade_no
String
20160806151343349
Payment Order Number
Merchant Order Number
out_trade_no
String
20160806151343349
Merchant Order Number
Description / Example
Signature algorithm is the same as Alipay signature algorithm, sign and sign_type are not included, code example as follows
let secretKey = "7a3b1053780db61ebd3d7123e1b8d6c4"
let reqJson = {
pid: 152787,
type: "wxpay",
out_trade_no: "20240125193935458",
notify_url: "1",
return_url: "2",
name: "Test Payment 20240125193935458",
money: 0.1
}
//str string (Note: 1/Parameter names in ASCLL code from small to large 2/Empty parameter values do not participate in signature 3/Case sensitive 4/sign and sign_type do not participate in signature 5/Finally concatenate secretKey)
money=0.1&name=Test Payment 20240125193935458&
notify_url=1&out_trade_no=20240125193935458&pid=152787&return_url=2&type=wxpay7a3b1053780db61ebd3d7123e1b8d6c4
//MD5 encryption result (Note: remove the newline before notify_url)
5af4287ea6c3ab4505e9dc8d2e3a148c
Status code description (can be handled by yourself, or directly pop up the returned message):
700: Missing parameters 701: Signature verification failed 702: Channel is under maintenance, please try again later 703: No payment code matched for the corresponding amount, please change the amount and try again 704: Amount cannot be less than 0.01 yuan 705: Duplicate order number 800: Invalid merchant or secret key, please check 901: No available channel, please check