Mini Program Signing
Update Time:2025.03.21The merchant backend obtains a signing session ID by requesting this interface, and then calls the signing page of the mini program for Auto-debit through the mini program signing interface.
|
Step 1: Obtaining Signing Session ID API
1. API Intro
Applicable object: Common mode Institutional mode
Request Url: https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/miniprogram-pre-entrust-sign
Request method: POST
Path parameter is a path parameter.
Query parameter needs to be passed in the request URL.
Body parameter needs to be passed in the request JSON.
UML
2. Request Parameters
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
App ID | appid | string[1, 32] | Yes | Body Appid bound to the merchant ID |
Sub-merchant ID | sub_mchid | string[1, 32] | Yes | Body Sub-merchant ID allocated by WeChat Pay |
App ID of the service provider | sp_appid | string[1, 32] | Yes | Body Appid bound to the service provider |
App ID of the sub-merchant | sub_appid | string[1, 32] | No | Body Appid bound to the sub-merchant ID for initiating signing |
Template ID | plan_id | int | Yes | Body Agreement template ID, which is generated by WeChat Pay when the merchant submits a deduction permission application to WeChat Pay |
Signed contract No. | out_contract_code | string[1, 32] | Yes | Body The signed contract No. at the merchant side, generated by the merchant and must be unique at the merchant side |
Displayed user account name | user_display_name | string[1, 32] | No | Body The name of the signing user, displayed on the page; urlencode is not required for the value, and the parameter value does not support the non-3-byte coded characters of UTF8, e.g., emoji, so WeChat nickname cannot be passed to this field. |
Signing success notification URL | success_notify_url | string[1, 256] | Yes | Body Callback notification URL starting with HTTPS; urlencode is not required for the value |
User ID under the merchant’s appid | openid | string[1, 128] | Yes | Body Openid of the user under the merchant’s appid |
Client IP | user_client_ip | string[1, 32] | No | Body Specifies the the IP of consumer |
Expire time of pre-sign ID | expired_time | string[1, 64] | No | Body Specifies the expire time of signing url. Time difference between expired_time and request time should be less than 10 minutes and bigger than 5 minutes for mobile h5 and PC web signing scenarios, while it icould be less than 2 hours and bigger than 5 minutes for other scenarios. If this value is not set, the validity of signing url is 10 minutes in default for mobile h5 and PC web signing scenarios, while it is 2 hours for other signing scenarios. |
Request Example:
Scenario 1:Common mode
Scenario 2:Service Provide Mode/Institution Mode
3. Response Parameters
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
Auto-debit signing session ID | session_id | string[1, 128] | Yes | Auto-debit signing session ID returned by WeChat |
Example
SUCCESS
ERROR
4. Error Codes
Error Codes | Error Message | Description | Solution |
---|---|---|---|
403 | CONTRACT_EXISTED | The contract is already signed | The user has already sign the contract. If another contract is required to sign, please change the out_contract_code and retry. |
400 | PARAM_ERROR | Parameter error | Please check the request parameter format. |
500 | SYSTEM_ERROR | System error | Please try the request again |
Step 2: Mini Program Signing API
wx.navigateToMiniProgram
Applicable object: Common mode Institutional mode
Interface: wx.navigateToMiniProgram(OBJECT) interface
Description: This interface has been supported since Version 6.5.9 of iOS WeChat client and Version 6.5.10 of Android client.
Request Parameters
Name | Variable Name | Type | Required | Description | |||
---|---|---|---|---|---|---|---|
WeChat signing mini program appid | appId | string[1, 32] | Yes | Fixed value wxbd687630cd02ce1d Please add this appid to the configuration item navigateToMiniProgramAppIdList of the mini program configuration file app.json | |||
Data of the scenario information that is passed to the mini program | extraData | object | Yes | Body For details, see the description about the extraData field | |||
|
Example:
Example
Response Parameters
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
Auto-debit contract ID | contract_id | string[1, 64] | Yes | Auto-debit contract ID returned by WeChat after successful signing |
Example:
Example