Skip to main content
/epay/mapi.php is the server-to-server Epay compatibility endpoint. It accepts form POST, creates or reuses a Kyren order, and returns Epay-style response fields such as payurl, qrcode, img, and trade_no depending on the selected channel. This endpoint uses pid + sign, not x-api-key. Because it is server-to-server, it may be subject to the API IP allowlist when enabled. A failed allowlist check can return numeric code 0 with msg.

Parameters

Required parameters:
ParameterDescription
pidKyren-issued merchant Epay-compatible merchant ID.
typePayment type. Supported values include alipay, wxpay, creditcard, crypto, and paynow.
out_trade_noYour merchant order number.
notify_urlMerchant payment result notification URL.
nameOrder or product name.
moneyDecimal string amount, for example "9.99".
clientipEnd-user client IP collected by your server.
signEpay-compatible MD5 signature.
sign_typeSignature type, usually MD5.
Optional parameters:
ParameterDescription
return_urlBrowser return URL when the channel uses a payment page.
money_typeCurrency or money type if provided by your existing integration.
deviceDevice context from your existing integration.
display_merchant_namePer-payment merchant display name shown on Kyren intermediate payment pages.
paramPassthrough merchant metadata returned in notifications.
channel_paramChannel-specific extension data.

Example request

curl -X POST https://api.kyren.top/epay/mapi.php \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "pid=10001" \
  --data-urlencode "type=alipay" \
  --data-urlencode "out_trade_no=ORDER_10002" \
  --data-urlencode "notify_url=https://merchant.example.com/notify" \
  --data-urlencode "name=AI credits" \
  --data-urlencode "money=9.99" \
  --data-urlencode "display_merchant_name=Campaign Store" \
  --data-urlencode "clientip=203.0.113.10" \
  --data-urlencode "sign=lowercase_md5_signature" \
  --data-urlencode "sign_type=MD5"

Success response example

{
  "code": 1,
  "trade_no": "K202605260001",
  "out_trade_no": "ORDER_10002",
  "payurl": "https://api.kyren.top/epay/redirect/order_abc123",
  "qrcode": "https://api.kyren.top/epay/qr/order_abc123",
  "img": "https://api.kyren.top/epay/qr/order_abc123.png"
}

Failure response example

{
  "code": 0,
  "msg": "IP not allowed"
}
See Epay MD5 signature and the mapi.php API reference.