接口文档API Reference
LHH Pay 是面向亚太多国市场的代收 / 代付支付网关,支持多币种电子钱包与银行转账,提供稳定的收款与出款能力。
LHH Pay is a multi-country collection and disbursement gateway for the Asia-Pacific market, supporting e-wallets and bank transfers in multiple currencies with reliable pay-in and pay-out.
所有接口均使用 POST 方式,参数以 application/x-www-form-urlencoded 提交,币种以运营为你开通的支付类型为准。使用 parter(你的 AppID)认证,并用 key(你的 AppSecret)对每个请求签名。
All endpoints use POST with application/x-www-form-urlencoded. Currency is determined by the payment types enabled for your account. Authenticate with parter (your AppID) and sign every request using key (your AppSecret).
- 注册Register — 联系运营获取 mchNo 与 appId。obtain your mchNo and appId from the operator.
- 获取密钥Credentials — 在商户后台获取 appSecret。retrieve your appSecret in the merchant console.
- 对接开发Integrate — 实现签名算法并调用接口。implement the signing algorithm and call the endpoints.
- 上线Go live — 小额测试后切换至生产环境。test with small amounts, then switch to production.
请求签名Request Signing
每个请求都必须携带 sign 参数,计算方式如下:
参与签名的字段:代收下单只对 parter、value、type、orderid、notifyurl、callbackurl 计算签名(其它字段不参与);代付下单与查询类接口对除 sign、clientip、attach 外的所有非空参数计算签名。查询、代付查询、凭证接口同样必须携带有效 sign。请求 IP 不在商户白名单内时返回 HTTP 401,响应体为 {"code":401,"msg":"..."}。
Signed fields: for payment creation only parter, value, type, orderid, notifyurl, callbackurl are signed (other fields are ignored); payout creation and all query endpoints sign every non-empty parameter except sign, clientip, attach. Query, payout-query and receipt endpoints must carry a valid sign. Requests from an IP outside your whitelist receive HTTP 401 with body {"code":401,"msg":"..."}.
Every request must include a sign parameter computed as follows:
- 筛选Filter — 所有非空参数,排除
sign、clientip、attach。all non-empty params, excludingsign,clientip,attach. - 排序Sort — 按参数名 ASCII 升序(不区分大小写)。by parameter name, ASCII ascending (case-insensitive).
- 拼接Concatenate —
k1=v1&k2=v2&…&key=SECRET - 计算Hash — 对字符串取 MD5,结果转为小写。MD5, result in lowercase.
创建代收订单Create Order
发起代收(收款)订单,返回收银台支付链接。
Initiate a pay-in order and receive a hosted payment URL.
| 参数Parameter | 类型Type | 说明Description |
|---|---|---|
| parter | string | required 商户 AppIDMerchant AppID |
| value | string | required 金额(元),如 100.00Amount in the method's currency, e.g. 100.00 |
| type | string | required 支付类型,取值见「支付类型」一节payment type, see "Payment Methods" |
| orderid | string | required 商户唯一订单号Your unique order number |
| notifyurl | string | optional 异步通知地址Async callback URL |
| callbackurl | string | optional 前端跳转地址Front-end redirect URL |
| clientip | string | optional 付款人 IPPayer IP不参与签名Excluded from signature |
| attach | string | optional 附加数据,回调原样返回Pass-through data不参与签名Excluded from signature |
| sign | string | required MD5 签名(小写)MD5 signature (lowercase) |
代收订单查询Query Order
查询代收订单的当前状态。
Retrieve the current status of a collection order.
| 参数Parameter | 类型Type | 说明Description |
|---|---|---|
| parter | string | required 商户 AppIDMerchant AppID |
| orderid | string | required 商户订单号Your order number |
| sign | string | required MD5 签名(小写)MD5 signature (lowercase) |
发起代付Create Payout
向收款人电子钱包或银行账户出款。
Send funds to a recipient e-wallet or bank account.
| 参数Parameter | 类型Type | 说明Description |
|---|---|---|
| parter | string | required 商户 AppIDMerchant AppID |
| order_no | string | required 商户唯一订单号Your unique order number |
| type | string | required 入账方式,取值见「支付类型」一节payment type, see "Payment Methods" |
| account_number | string | required 收款账号Recipient account |
| money | string | required 金额(元),如 100.00Amount in the method's currency, e.g. 100.00 |
| name | string | optional 收款人姓名Recipient name |
| notify_url | string | optional 异步通知地址Async callback URL |
| sign | string | required MD5 签名(小写)MD5 signature (lowercase) |
代付到银行账户时,type 传银行代码、account_number 传收款银行账号。完整银行代码见 支持银行。
For bank payouts, set type to the bank code and account_number to the recipient bank account. See the full list under Bank Codes.
代付查询Query Payout
查询代付订单状态。另提供详情查询与凭证获取接口。
Look up the status of a payout order. A detailed variant and a receipt endpoint are also available.
| 参数Parameter | 类型Type | 说明Description |
|---|---|---|
| parter | string | required 商户 AppIDMerchant AppID |
| order_no | string | required 商户订单号Your order number |
| sign | string | required MD5 签名(小写)MD5 signature (lowercase) |
商户余额查询Merchant Balance
查询可用结算余额。
Query your available settlement balance.
| 参数Parameter | 类型Type | 说明Description |
|---|---|---|
| parter | string | required 商户 AppIDMerchant AppID |
| sign | string | required MD5 签名(小写)MD5 signature (lowercase) |
| currency | string | optional 余额币种,小写,如 cny;不传默认 php。人民币商户请传 cny。Balance currency in lowercase, e.g. cny; defaults to php. CNY merchants must pass cny. |
异步通知Callbacks
代收:仅在支付成功时向你的 notifyurl 发送异步通知;订单未支付、超时关闭或支付失败不会发送通知,请通过 /pay/query 查询确认。代付:成功与失败均会向 notify_url 发送通知,失败时 info 字段给出原因。收到通知后请验证 sign、更新订单,然后返回纯文本 success。
Collection: a notification is sent to your notifyurl only when the payment succeeds. Unpaid, expired or failed orders do not trigger a notification; confirm them via /pay/query. Payout: both success and failure are sent to notify_url; on failure the info field carries the reason. Verify the sign, update your order, then respond with the plain string success.
若未返回 success,平台将按退避策略重试通知。
If your endpoint does not return success, the notification is retried on a back-off schedule.
代收通知参数Collection notification fields
| 字段Field | Type | 说明Description |
|---|---|---|
| parter | string | 商户号 AppIDMerchant AppID |
| orderid | string | 商户订单号Your order number |
| opstate | string | 支付结果:1=成功(代收通知仅在成功时发送,正常情况下恒为 1;收到 0 时请以查询接口为准)Result: 1=success (collection notifications are only sent on success, so this is normally always 1; if you ever receive 0, rely on the query endpoint) |
| ovalue | string | 订单金额(元)Order amount (in the method's currency) |
| sign | string | 签名,用于校验Signature for verification |
opstate=…&orderid=…&ovalue=…&parter=…&key=SECRET → md5() lowercase
代付通知参数Payout notification fields
| 字段Field | Type | 说明Description |
|---|---|---|
| parter | string | 商户号 AppIDMerchant AppID |
| orderid | string | 商户订单号Your order number |
| opstate | string | 代付结果:1=成功,0=非成功Result: 1=success, 0=not success |
| ovalue | string | 代付金额(元)Payout amount (in the method's currency) |
| sign | string | 签名,用于校验Signature for verification |
| info | string | 失败原因(成功时为空)Failure reason (empty on success) |
opstate=…&orderid=…&ovalue=…&parter=…&key=SECRET → md5() lowercase
info 不参与签名;代付失败时请读取 info 获取具体原因info is excluded from the signature; read info for the failure reason on a failed payout
错误码Errors
所有响应包含数字 code。失败时 info 给出具体原因。
All responses carry a numeric code. On failure, info describes the reason.
| Code | 含义Meaning |
|---|---|
| 200 | 成功Success |
| 400 | 请求错误 — 查看 info 获取详情Bad request — inspect info for the specific error |
https://api.lhhpay.com,parter 填你的 LHH Pay AppID、key 填对应 AppSecret,即可开始调用。
Set your base URL to https://api.lhhpay.com, use your LHH Pay AppID as parter and your AppSecret as key to start integrating.
支付类型Payment Methods
代收与代付的 type 字段统一使用下列取值,无需区分接口。
Both collection and disbursement use the same type values listed below.
| type | 支付方式Method | 币种Currency | 代收Pay-in | 代付Pay-out |
|---|---|---|---|---|
| 支付类型由运营在开通账户时提供,本表随开通情况更新。Payment types are provided when your account is enabled; this table is updated accordingly. | ||||
type 不区分大小写。实际可用的支付方式以你账户开通的为准;如需开通更多通道,请联系运营。
Note — type is case-insensitive. The methods actually available depend on what is enabled for your account — contact your operator to enable more.
支持银行Bank Codes
代付(/pay/transfer)到银行账户时,type 传下列银行代码,account_number 传收款银行账号。完整列表以运营提供为准。
For bank payouts via /pay/transfer, set type to one of the codes below and account_number to the recipient bank account. The full list is provided by your operator.