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

  1. A user selects a product in the mini program and places an order.
  2. The user confirms the purchase and enters to the payment page triggered by the mini program.
  3. The user confirms the payee and amount on the checkout page and confirms the payment.
  4. 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

image.png

  1. The wallet user creates a payment order from a mini program to the Merchant/ISV server.
  2. 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

  1. 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.

  1. 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.
  2. 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.
  3. 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

my.tradePay

Trigger cashier page.

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