Payment capability

Users can trigger the wallet cashier page on a mini program. The payment process and user experience on the mini program are similar to those of the native app.

Prerequisites

This capability is open to a merchant with a valid business license that is verified by its wallet. The merchant website should be accessible and provide clear business content and complete product information.

User experience

The overall payment process includes the following steps:

  1. A user selects a product in the mini program and places an order.
  2. The user confirms the purchase and enters the payment page that is triggered by the mini program.
  3. The user confirms the payee and amount on the checkout page, then confirms the payment.
  4. The payment success page is displayed.

Procedures

To develop the payment capability, follow the steps below:

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 overview and the developer guide.

2. Add features (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

image.png

  1. The wallet user creates a payment order in a mini program.
  2. The merchant or ISV server creates the order by calling the /{version}/payments/pay OpenAPI from the wallet server.
  3. The wallet server returns parameters such as acquirementId and checkout URL to the mini program.
  4. The mini program calls the tradePay JSAPI by triggering the wallet payment process and other return parameters and then gets the response.
  5. The user confirms the payment. Then the wallet server calls the /{version}/payments/notifyPayment OpenAPI and sends the order status notification to the min program server.
  6. The user is redirected to the payment result page in the mini program.

Note:

  • The version is the version of Open APIs, for example, v1 or v2.
  • The parameter userId or uid is fetched by calling the applyToken OpenAPI. For more information, see User information capability.

API list

JSAPI

Description

my.tradePay

Trigger the cashier page from the wallet.

OpenAPI

Description

/{version}/payments/{apiName}


 The version is the version of Open APIs, for example, v1 or v2.

For details, see the Open APIs for Merchants chapter.

More information

Capabilities

JSAPIs

Open APIs

Developing Mini Program

Using Mini Program Platform

Features