Latest update time:2021.08.18 Release notes
The 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.
Request Url:https://apihk.mch.weixin.qq.com/v3/global/papay/contracts/miniprogram-pre-entrust-sign
Request method:POST
API rules: https://wechatpay-api.gitbook.io/wechatpay-api-v3
Applicable object:Common modeInstitutional mode
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.
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
App ID | appid | string[1, 32] | Yes | body Appid bound to the merchant ID Note: Only forCommon mode Example:wxcbda96de0b165486 |
Sub-merchant ID | sub_mchid | string[1, 32] | Yes | body Sub-merchant ID allocated by WeChat Pay Note: Only forInstitutional mode Example:10000097 |
App ID of the service provider | sp_appid | string[1, 32] | Yes | body Appid bound to the service provider Note: Only forInstitutional mode Example:wxcbda96de0b165486 |
App ID of the sub-merchant | sub_appid | string[1, 32] | No | body Appid bound to the sub-merchant ID for initiating signing Example:wxcbda96de0b165484 |
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 Example:123 |
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 Example:100001256 |
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. Example:Zhang San |
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 Example:https://yoursite.com |
User ID under the merchant’s appid | openid | string[1, 128] | Yes | body Openid of the user under the merchant’s appid Example:ouFhd5X9s9WteC3eWRjXV3lea123 |
Client IP | user_client_ip | string[1, 32] | No | body Specifies the the IP of consumer Example:119.145.83.6 |
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. This filed is in RFC3339 format. For example, 2018-06-08T10:34:56+08:00 represents BJT 10:34:56 June 8, 2018. Example:2021-11-20T13:29:35+08:00 |
{
"appid": "wxcbda96de0b165486",
"expired_time": "2021-11-20T13:29:35+08:00",
"openid": "ouFhd5X9s9WteC3eWRjXV3lea123",
"out_contract_code": "100001256",
"plan_id": 123,
"success_notify_url": "https://yoursite.com",
"user_client_ip": "119.145.83.6",
"user_display_name": "張三"
}
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:201710180325670965 |
The merchant can request this interface to call the signing page of mini program Auto-debit. After the user completes the Auto-debit signing on the WeChat page, WeChat will also inform the merchant background of the signing information through asynchronous notification. No notification will be sent if the user gives up signing or signing fails.
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.
Applicable object:Common modeInstitutional mode
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 Example:wxbd687630cd02ce1d |
+Data of the scenario information that is passed to the mini program | extraData | object | Yes | For details, see the description about the extraData field |
Page path for opening the mini program | path | string | Yes | Fixed value: pages/index/index Example:pages/index/index |
Callback function when the interface is called successfully | success | Function | Yes | Callback function when the interface is called successfully |
Callback function when the interface calling operation fails | fail | Function | Yes | Callback function when the interface calling operation fails |
Callback function when the interface calling operation is completed | complete | Function | Yes | Executed when the interface calling operation succeeds or fails |
wx.navigateToMiniProgram({
appId: wxbd687630cd02ce1d,
path: 'pages/Oversea/walletSelect?sessionId=201710180325670965',
extraData: {},
success(res) {
// Jumped to the signing mini program successfully
},
fail(res) {
// Failed to jump to the signing mini program
}
})
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:201710180325670965 |
App({
onShow(res)? {
if? (res.scene? === ?1038)? {? //Scenario value 1038: return from the opened min program
const? {?
appId,
?extraData?
}? = ?res.referrerInfo
if? (appId? == ?'wxbd687630cd02ce1d')? {? //?appId is wxbd687630cd02ce1d: jump back from the signing min program
if? (typeof? extraData? == ?'undefined') {
//?TODO
//?The client min program is not sure of the signing result and needs to request the merchant-side background to confirm the signing result
return;
}
if (extraData.return_code? == ?'SUCCESS') {
//?TODO
//?The client min program signs successfully and needs to request the merchant-side background to confirm the signing result
var? contract_id? = ?extraData.contract_id
return;
}?
else? {
//?TODO
//?Signing failed
return;
}
}
}
}
})
Customer Service Tel
Business Development
9:00-18:00
Monday-Friday GMT+8
Technical Support
WeChat Pay Global
ICP證