Alipay Mini App Online Payment
Tips: Get your Wallet ID
, User ID
and API key
via Latipay Merchant Portal > WALLETS > ACTION(on the right side of the corresponding wallet) > Settings > Integration parameters
Tips: Create a minimum amount product (e.g. $ 0.01 NZD/AUD) for testing.
API Details
1 - Latipay Transaction Interface
Make payment order with this api in your web server.
1 | POST https://api.latipay.net/v2/minialipay |
- Attributes
Name | Type | Description | Optional |
---|---|---|---|
user_id | String | The Latipay user account which is using for processing the transactions. | NO |
wallet_id | String | The wallet ID that using for online transactions. | NO |
amount | String | A decimal amount. | NO |
callback_url | String | Merchant web server’s URL that the payment result will send to. | NO |
merchant_reference | String | A unique id identifying the order in Merchant’s system. |
NO |
ip | String(16) | The customer’s IPv4 address | NO |
version | String | The latest version of the Latipay platform which must be "2.0" |
NO |
product_name | String | The name of the product or service being sold. | NO |
signature | String | The SHA-256 HMAC API signature. |
NO |
Example
1 | { |
- SHA-256 HMAC Signature
Rearrange all parameters alphabetically (except parameters with value of null
or empty
string) and join them with &
, and concat the value of api_key
in the end.
JS code example:
1 | Object.keys(data) |
Example
1 | message: amount=120.00&callback_url=https://merchantsite.com/confirm&ip=122.122.122.1&merchant_reference=dsi39ej430sks03&product_name=Pinot Noir, Otago&user_id=U000334333&version=2.0&wallet_id=W00000001111222333 |
- Response
1 | { |
2 - Alipay mini app pay
Build a query string with gatewaydata
in the above response, and call my.tradePay
method with orderStr
in Alipay mini app project.
1 | const gatewaydata = data.gatewaydata |
resultCode
Result Code refer to https://opendocs.alipay.com/mini/api/openapi-pay
Code | Description | Solution |
---|---|---|
9000 | 订单处理成功 | - |
8000 | 正在处理中。支付结果未知(有可能已经支付成功)。 | 请通过 alipay.trade.query 接口查询订单的支付状态。 |
4000 | 订单处理失败。 | 检查订单。 |
6001 | 用户中途取消。 | 请用户重新签约。 |
6002 | 网络连接出错。 | 检查网络连接后重试。 |
6004 | 处理结果未知(有可能已经成功)。 | 请通过 alipay.trade.query 接口查询订单的支付状态。 |
99 | iOS 客户端用户点击忘记密码导致快捷界面退出。 | - |