EPay-Compatible Integration (Redirect Checkout)
Use this flow only when your upstream system expects an EPay-style redirect order entry.
Route
GET /payments/epay/v1/order/create-transaction/submit.php
POST /payments/epay/v1/order/create-transaction/submit.phpMerchant credential requirement
Incoming requests are not validated with deprecated env keys like epay_pid or epay_key.
Current source does this instead:
- Read incoming
pid - Find the enabled
api_keysrow with that PID - Verify
signwith that row'ssecret_key - Apply optional IP whitelist check
Required incoming fields
pidmoneyout_trade_nonotify_urlsign
Optional common fields:
return_urlnametypetokennetworkcurrencysign_type
type now has two supported shapes:
alipay— compatibility value; token/network are resolved from explicittoken+networkrequest parameters, then from admin EPay defaults.token.networkselector such asusdt.tron— accepted only when that token/network pair is currently supported. A valid selector overridestoken,network,epay.default_token, andepay.default_network.
Other non-empty type values are rejected as invalid parameters. The selected or compatibility type is stored on the order for later EPay return/notify callbacks.
EPay defaults
After signature verification succeeds, current source builds the internal shared order payload with admin settings:
epay.default_tokenepay.default_currencyepay.default_network
Resolution order for EPay submit.php is:
- Supported
type=token.networkselector, if supplied - Explicit request
token/networkparameters - Admin
epay.default_token/epay.default_network - If both token and network are still empty, create a status
4placeholder order for the cashier selection flow
Currency is independent: request currency → epay.default_currency → cny.
Success behavior
On success, the endpoint redirects the browser to:
/pay/checkout-counter/{trade_id}In current source, that path is now the redirect entry for the hosted cashier SPA. The checkout page data is served through:
/pay/checkout-counter-resp/{trade_id}Direct token/network choices
For upstream "New API" payment-method lists, expose separate options whose type is a supported token.network selector. For example, usdt.tron creates a TRON USDT order directly, while usdt.binance creates a Binance/BSC USDT order when that asset is enabled.
Example upstream method list:
[
{ "color": "rgba(var(--semi-blue-5), 1)", "name": "GM Pay", "type": "custom1" },
{ "color": "rgba(var(--semi-blue-5), 1)", "name": "GM Pay usdt.binance", "type": "usdt.binance" },
{ "color": "rgba(var(--semi-blue-5), 1)", "name": "GM Pay usdt.tron", "type": "usdt.tron" }
]custom1 is only an upstream generic option name. Do not submit it unchanged to EPay submit.php; submit no type, type=alipay, or a valid selector such as usdt.tron.
Callback verification
When the created order carries payment_type = Epay, the worker later calls your notify_url with EPay-style query parameters and signs them with the same merchant secret_key.
The callback type reuses the stored request type. That means it returns either alipay or the accepted selector such as usdt.tron. If the request omitted type, outbound callbacks fall back to alipay for compatibility.
Do not verify those callbacks with an old standalone epay_key.
