Mini Program Payment
For merchants who already have WeChat or Alipay mini programs, users can open the mini program within WeChat or Alipay through friend sharing or scanning a QR code to complete the purchase process by calling the payment function.
Integration Overview
Merchants must first own a mini program; please develop the mini program according to WeChat and Alipay's guidelines. Merchants do not need to enable the mini program payment function in WeChat or Alipay. They only need to integrate with PayCloud’s API, obtain the payment parameters, and then invoke the mini program payment control to complete the payment.
After the user completes the payment, merchants can receive payment notifications from PayCloud and can also proactively call the order query interface to obtain payment results. After receiving the payment result, PayCloud will synchronize and update the order information to the merchant to complete the remaining goods and services.
Ensure that online payment permissions are enabled when invoking this interface. Do not include other payment methods like Alipay in WeChat mini programs, as it may prevent users from completing payments.
User Payment Process
Step 1: Users enter the merchant's mini program through sharing or scanning a QR code, select items to purchase, and complete the selection process.
Step 2: Invoke the WeChat or Alipay payment control, and the user begins to enter the payment password.
Step 3: After the password is verified, the payment is successful, and the merchant's backend receives a notification of successful payment.
Step 4: Return to the merchant's mini program and display a successful purchase message.
WeChat Mini Program Payment Diagram:

Development Guidelines
API List
We provide a set of REST APIs; please refer to the table below. These APIs offer SDKs in several programming languages; visit SDK Section for more details.
API Name | Description |
---|---|
Mini Program Pay Order | Submit a payment order through this API |
Cancel Order | Close unpaid orders through this api and refund the user if payment has already occurred |
Submit a refund request | If you submit a refund request through this API and the refund does not arrive immediately, you can call the refund inquiry API to get the progress of the refund. |
Query order | Query the transaction result (consumption/pre-authorization/pre-authorization completion) of a positive transaction order through this API |
Query refund | Query the transaction results of negative transaction orders (consumption cancellation/pre-authorization cancellation/consumption refund/pre-authorization completion refund) through this API |
Transaction result notification | After the transaction, notify the merchant through this webhook to tell the merchant the result of the transaction |
Initiating Payment in WeChat Mini Program
Based on the materials submitted by the merchant, we will register your merchant information with WeChat and enable payment. You also need to bind the WeChat Pay merchant number and Mini Program AppID. Please inform Newage support staff of your Mini Program AppID.

WeChat Pay officially provides guidance on how to invoke the mini program payment control and sample code. Please refer to Development Guide and Invoke Payment in Mini Program.
For the 【Unified Order】API mentioned in the WeChat documentation, use PayCloud’s Place an Order via Mini Program Payment API. As an official service provider for WeChat Pay in Japan, we have integrated WeChat Pay functionality, simplifying the integration process. You only need to get the order parameters through our API and then invoke WeChat Pay.
The pay_params
returned by the PayCloud mini program payment API is a JSON object with the following structure:
{
"timeStamp":"1414561699",
"nonceStr":"5K8264ILTKch16CQ2502SI8ZNMTM67VS",
"package":"prepay_id=123456789",
"signType":"MD5",
"paySign":"C380BEC2BFD727A4B6845133519F3AD6"
}
Initiating Payment via Alipay Client
Initiating payment in the Alipay client through a mini program is relatively simple. You only need to request our order placement API, obtain the returned payment parameters, which is an HTTPS link address, and redirect to that link address.
The pay_params
returned by the PayCloud mini program payment API is a JSON object with the following structure:
{
"paymentUrl":"https://pay.alipay.com/minipay/129010778.html?tradeno=20210926001099101518"
}
paymentUrl
is the cashier URL of Alipay. You only need to display this web page within your mini program.