Payment Capability
Introduction
Users can trigger wallet cashier page on a mini program that is developed by a merchant/ISV. The payment process and user experience on the Mini Program is similar to that on the native app.
Prerequisite
This capability is open to a merchant with a valid business license that is verified by its wallet partner. The merchant website should be accessible and provides clear business content and complete product information.
User experience
- A user selects a product in the mini program and places an order.
- The user confirms the purchase and enters to the payment page triggered by the mini program.
- The user confirms the payee and amount on the checkout page and confirms the payment.
- The payment success page is displayed.
Procedures
1. Create a mini program
The merchant/ISV gets started with the workspace and publishes a mini program in the Mini Program Platform. For more information, see the product guide at Using Mini Program Platform and developer guide at Developing Mini Program.
2. (Optional) Add features
This step is optional. By default, the payment capability is available. For other features, you need to add a feature and define the details according to your business requirements. For more information, see Features.
3. Call APIs
- The wallet user creates a payment order from a mini program to the Merchant/ISV server.
- The Merchant/ISV server creates the order with the
/{version}/payments/pay
OpenAPI to the wallet back-end server.
The version
 is the version of Open APIs, for example, v1
 or v2
- The wallet back-end server returns parameters such as checkout URL to the mini program.
Note: The parameter userId
, or uid
, fetched from the applyToken
OpenAPI. For more information, see User Information Capability.
- The mini program requests to call the
tradePay
JSAPI with return parameters such as triggering payment flow of wallet native app and gets the response. - The user confirms the payment and the wallet server calls the
/{version}/payments/notifyPayment
OpenAPI and send notification of order status to the min program backend server. - The user is redirected to the payment result page in the mini program.
In addition, the Open APIs are available for payment query, refund and inquiry refund.
API List
JSAPI | Description |
Trigger cashier page. | |
OpenAPI | Description |
/  The | For details, see the Open APIs for Merchants chapter. |