Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
微信支付
https://pay.weixin.qq.com/doc/v2
Admin
微信支付 (WeChat Pay) 是一个综合性支付平台,为商户提供多种支付方式、营销工具和金融服务。
Tokens:
547,388
Snippets:
1,834
Trust Score:
10
Update:
2 days ago
Context
Chat
Benchmark
45.19
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### 查看所有命令参数 Source: https://pay.weixin.qq.com/doc/v2/merchant/4012203398 使用 wxpaymonitor -h 命令查看所有命令参数。 ```bash ./wxpaymonitor -h ``` -------------------------------- ### GET /papay/partner/h5entrustweb Source: https://pay.weixin.qq.com/doc/v2/partner/4011988368 该接口用于发起H5签约,用户通过跳转URL进入微信签约页面进行签约。请求参数通过URL查询字符串传递,返回参数包括签约结果和跳转URL。 ```APIDOC ## [GET] /papay/partner/h5entrustweb ### Description 该接口用于发起H5签约,用户通过跳转URL进入微信签约页面进行签约。 ### Method GET ### Endpoint https://api.mch.weixin.qq.com/papay/partner/h5entrustweb ### Parameters #### Query Parameters - **appid** (string) - Required - 公众账号ID - **contract_code** (string) - Required - 签约协议号 - **contract_display_account** (string) - Required - 签约展示名称 - **mch_id** (string) - Required - 商户号 - **sub_mch_id** (string) - Required - 子商户号 - **notify_url** (string) - Required - 通知URL - **plan_id** (string) - Required - 模板ID - **request_serial** (string) - Required - 请求序列号 - **return_appid** (string) - Required - 返回appid - **clientip** (string) - Required - 客户端IP - **timestamp** (string) - Required - 时间戳 - **version** (string) - Required - 版本号 - **sign** (string) - Required - 签名 ### Request Example https://api.mch.weixin.qq.com/papay/partner/h5entrustweb?appid=wx426a3015555a46be&contract_code=122&contract_display_account=name1&mch_id=1223816102&sub_mch_id=1223816103¬ify_url=www.qq.com%2Ftest%2Fpapay&plan_id=106&request_serial=123&return_appid=wxcbda96de0b165542&clientip=12.1.1.12×tamp=1414488825&version=1.0&sign=130C7B07DD3B8074F7BF8BEF5C9A86487A1C57478F8C55587876B9C782F72036 ### Response #### Success Response (200) - **return_code** (string) - 返回状态码,SUCCESS/FAIL - **return_msg** (string) - 返回信息,如非空为错误原因 - **result_code** (string) - 业务结果,SUCCESS/FAIL - **result_msg** (string) - 业务结果描述,如非空为错误原因 - **redirect_url** (string) - 跳转签约页面URL #### Response Example <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[PARAM_ERROR]]></return_msg> <result_code><![CDATA[SUCCESS]]></result_code> <result_msg><![CDATA[SIGN_ERROR]]></result_msg> <redirect_url><![CDATA[https://payapp.weixin.qq.com]]></redirect_url> </xml> ``` -------------------------------- ### APP签约跳转小程序参数 Source: https://pay.weixin.qq.com/doc/v2/partner/4016049199 该接口用于APP签约流程中,通过WXLaunchMiniProgram Open SDK API调起微信签约小程序。需要传入跳转签约小程序的username、path和版本类型。 ```APIDOC ## APP签约跳转小程序参数 ### Description 该接口用于APP签约流程中,通过WXLaunchMiniProgram Open SDK API调起微信签约小程序。需要传入跳转签约小程序的username、path和版本类型。 ### Parameters #### Request Body - **userName** (String(32)) - 必填 - 跳转签约小程序的username,可从预签约接口的返回参数 miniprogram_username获取该值 - **path** (String(256)) - 必填 - 跳转签约小程序的path,可从预签约接口的返回参数miniprogram_path获取该值 - **miniprogramType** (Integer) - 必填 - 固定传值为0(正式版) ### Request Example ```json { "userName": "gh_xxxxxxxxxxxxx", "path": "pages/index/index?xxxxxx", "miniprogramType": 0 } ``` ### Response 返回参数内容无需关注,如果签约成功,商户系统会收到“签约、解约结果通知”,可参考使用的预签约文档目录下的“签约、解约结果通知”文档。 ``` -------------------------------- ### GET /papay/partner/h5entrustweb Source: https://pay.weixin.qq.com/doc/v2/partner/4011988368 该接口用于在H5浏览器设备场景下发起微信签约扣款。商户通过该接口获取redirect_url,用户在前端跳转到该URL完成签约。 ```APIDOC ## GET /papay/partner/h5entrustweb ### Description 该接口用于在H5浏览器设备场景下发起微信签约扣款。商户通过该接口获取redirect_url,用户在前端跳转到该URL完成签约。 ### Method GET ### Endpoint https://api.mch.weixin.qq.com/papay/partner/h5entrustweb ### Parameters #### Query Parameters - **appid** (string[1,32]) - 必填 - 服务商申请的公众号或移动应用appid。示例值:wxcbda96de0b165486 - **mch_id** (string[1,32]) - 必填 - 商户号,微信支付分配的商户号。示例值:1200009811 - **sub_appid** (string[1,32]) - 可选 - 子商户号绑定的appid。示例值:wxcbda96de0b165489 - **sub_mch_id** (string[1,32]) - 必填 - 微信支付分配的子商户号。示例值:1900000109 - **plan_id** (string[1,28]) - 必填 - 协议模板id。示例值:12535 - **contract_code** (string[1,128]) - 必填 - 商户侧的签约协议号,由商户生成,只能是数字、大小写字母,且在同一个商户号下唯一。示例值:100000 - **request_serial** (int64) - 必填 - 商户请求签约时的序列号,要求唯一性,禁止使用0开头,纯数字,范围不能超过int64的范围。示例值:1000 - **contract_display_account** (string[1,128]) - 必填 - 签约用户的名称,用于用户签约页面的“开通账号”处展示,不支持表情符号。示例值:微信代扣 - **notify_url** (string[1,256]) - 必填 - 用于接收签约成功消息的回调通知地址,以http或https开头,外网可访问,不能携带参数,需对参数值进行encode处理。示例值:https://weixin.qq.com - **version** (string[1,8]) - 必填 - 固定值1.0。示例值:1.0 - **sign** (string[1,64]) - 必填 - 签名,详见签名生成算法。示例值:C380BEC2BFD727A4B6845133519F3AD6 - **sign_type** (string[1,32]) - 可选 - 签名类型,MD5或HMAC-SHA256,不填默认HMAC-SHA256。示例值:MD5 - **timestamp** (string[1,10]) - 必填 - 系统当前时间,10位。示例值:1414488825 - **clientip** (string[1,32]) - 必填 - 用户客户端的IP地址,支持IPV4和IPV6。示例值:119.145.83.6 - **deviceid** (string[1,32]) - 可选 - 设备ID,android填imei的一次md5,ios填idfa的一次md5,风控参数。示例值:baf04e6bbbd06f7b1a197d18ed53b7f1 - **mobile** (string[1,11]) - 可选 - 用户手机号,风控参数。示例值:18933432355 - **email** (string[1,]) - 可选 - 用户邮箱地址,风控参数。示例值:aobama@whitehouse.com - **qq** (string[1,]) - 可选 - 用户QQ号,风控参数。示例值:100243 - **openid** (string[1,128]) - 可选 - 用户微信open ID,风控参数。示例值:baf04e6bbbd06f7b1a197d18ed53b7f1 - **creid** (string[1,]) - 可选 - 用户身份证号,风控参数。示例值:110102199701011000 - **outerid** (string[1,]) - 可选 - 用户在商户侧的标识,风控参数。示例值:user123 - **return_appid** (string[1,32]) - 可选 - 用来控制签约页面结束后的返回路径。示例值:wxcbda96de0b165486 ### Request Example GET https://api.mch.weixin.qq.com/papay/partner/h5entrustweb?appid=wxcbda96de0b165486&mch_id=1200009811&sub_appid=wxcbda96de0b165489&sub_mch_id=1900000109&plan_id=12535&contract_code=100000&request_serial=1000&contract_display_account=微信代扣¬ify_url=https%3A%2F%2Fweixin.qq.com&version=1.0&sign=C380BEC2BFD727A4B6845133519F3AD6&sign_type=MD5×tamp=1414488825&clientip=119.145.83.6&deviceid=baf04e6bbbd06f7b1a197d18ed53b7f1&mobile=18933432355&email=aobama%40whitehouse.com&qq=100243&openid=baf04e6bbbd06f7b1a197d18ed53b7f1&creid=110102199701011000&outerid=user123&return_appid=wxcbda96de0b165486 ### Response #### Success Response - **redirect_url** (string) - 用于前端跳转的URL,用户需跳转到该URL完成签约。 #### Response Example { "redirect_url": "https://wx.tenpay.com/cgi-bin/..." } ``` -------------------------------- ### GET /papay/partner/entrustweb Source: https://pay.weixin.qq.com/doc/v2/partner/4011988365 商户通过请求此接口唤起微信委托代扣的页面。适用于服务商,请求方式为GET,签名方式为MD5,无需证书。 ```APIDOC ## [GET] /papay/partner/entrustweb ### Description 商户可以通过请求此接口唤起微信委托代扣的页面。 ### Method GET ### Endpoint https://api.mch.weixin.qq.com/papay/partner/entrustweb ### Parameters #### Query Parameters - **appid** (string[1,32]) - 必填 - 服务商申请的公众号或移动应用appid。示例值:wxcbda96de0b165486 - **mch_id** (string[1,32]) - 必填 - 商户号是商户在微信申请微信支付成功后分配的账号ID,登录平台为pay.weixin.qq.com。示例值:1200009811 - **sub_appid** (string[1,32]) - 可选 - 子商户号绑定的appid(非必填,如需操作,需要服务商在商户平台为子商户绑定)。示例值:wxcbda96de0b165489 - **sub_mch_id** (string[1,32]) - 必填 - 微信支付分配的子商户号。示例值:1900000109 - **plan_id** (int) - 必填 - 协议模板id,设置路径见开发步骤。示例值:12535 - **contract_code** (string[1,128]) - 必填 - 商户侧的签约协议号,由商户生成,只能是数字、大小写字母的描述且在同一个商户号下唯一。示例值:100000 - **request_serial** (int64) - 必填 - 商户请求签约时的序列号,要求唯一性。禁止使用0开头,序列号主要用于排序,不作为查询条件,纯数字,范围不能超过int64的范围(9223372036854775807)。示例值:1000 - **contract_display_account** (string[1,128]) - 必填 - 签约用户的名称,用于用户签约页面的“开通账号”处进行展示,参数值不支持UTF8非3字节编码的字符,例如表情符号,所以请勿传微信昵称到该字段。示例值:微信代扣 - **notify_url** (string[1,256]) - 必填 - 用于接收签约成功消息的回调通知地址,以http或https开头,通知url必须为外网可访问的url,不能携带参数。请对notify_url参数值进行encode处理,注意是对参数值进行encode,例如参数为notify_url=“https://weixin.qq.com”,则需要encode的内容为https://weixin.qq.com。示例值:https://weixin.qq.com - **version** (string[1,8]) - 必填 - 固定值1.0。示例值:1.0 - **sign** (string[1,32]) - 必填 - 详见签名生成算法。示例值:C380BEC2BFD727A4B6845133519F3AD6 - **timestamp** (string[1,10]) - 必填 - 系统当前时间,10位。示例值:1414488825 - **return_web** (int) - 可选 - 用来控制签约页面结束后的返回路径(不传此参数,则签约完成后停留在微信内)。1表示返回签约页面的referrer url。如果获取到的referrer包含路径,会通过window.location.replace()跳转,跳转referrer url时会自动带上参数from_wxpay=1,否则会通过window.history.back()返回上一页,此时没有参数from_wxpay=1。示例值:1 ### Request Example ``` https://api.mch.weixin.qq.com/papay/partner/entrustweb?appid=wx426a3015555a46be&contract_code=122&contract_display_account=name1&mch_id=1223816102&sub_mch_id=1223816103¬ify_url=www.qq.com%2Ftest%2Fpapay&plan_id=106&request_serial=123×tamp=1414488825&version=1.0&sign=FF1A406564EE701064450CA2149E2514 ``` ### Response #### Success Response 签约页面跳转URL,用于前端跳转。 #### Response Example 无明确响应体,接口返回签约页面URL。 ``` -------------------------------- ### 检测更新 Source: https://pay.weixin.qq.com/doc/v2/merchant/4012203398 使用 wxpaymonitor -u 命令检测更新,只提示是否存在新版本,不会自动更新。 ```bash ./wxpaymonitor -u ``` -------------------------------- ### 确认监控程序正常运行 Source: https://pay.weixin.qq.com/doc/v2/merchant/4012203398 使用 service.sh show 命令检查监控程序是否正常运行。 ```bash ./service.sh show ``` -------------------------------- ### GET /papay/h5entrustweb Source: https://pay.weixin.qq.com/doc/v2/merchant/4011987295 该接口用于在H5浏览器场景下发起微信签约扣款协议,商户调用后获得redirect_url,用户跳转至该URL完成签约。 ```APIDOC ## [GET] /papay/h5entrustweb ### Description 该接口用于在H5浏览器场景下发起微信签约扣款协议,商户调用后获得redirect_url,用户跳转至该URL完成签约。 ### Method GET ### Endpoint https://api.mch.weixin.qq.com/papay/h5entrustweb ### Parameters #### Query Parameters - **appid** (string[1,32]) - Required - 直连商户申请的公众号或移动应用appid。示例值:wxcbda96de0b165486 - **mch_id** (string[1,32]) - Required - 商户号,微信支付分配的账号ID。示例值:1200009811 - **plan_id** (string[1,28]) - Required - 协议模板id。示例值:12535 - **contract_code** (string[1,128]) - Required - 商户侧的签约协议号,由商户生成,只能是数字、大小写字母,且在同一个商户号下唯一。示例值:100000 - **request_serial** (int64) - Required - 商户请求签约时的序列号,要求唯一性,禁止0开头,纯数字,范围不超过int64。示例值:1000 - **contract_display_account** (string[1,128]) - Required - 签约用户的名称,用于签约页面展示,不支持表情符号。示例值:微信代扣 - **notify_url** (string[1,256]) - Required - 用于接收签约成功消息的回调通知地址,需为外网可访问URL,不能携带参数,需对参数值进行encode。示例值:https://weixin.qq.com - **version** (string[1,8]) - Required - 固定值1.0。示例值:1.0 - **sign** (string[1,64]) - Required - 签名,详见签名生成算法。示例值:C380BEC2BFD727A4B6845133519F3AD6 - **sign_type** (string[1,32]) - Optional - 签名类型,MD5或HMAC-SHA256,不填默认HMAC-SHA256。示例值:MD5 - **timestamp** (string[1,10]) - Required - 系统当前时间,10位。示例值:1414488825 - **clientip** (string[1,32]) - Required - 用户客户端的IP地址,支持IPV4和IPV6。示例值:119.145.83.6 - **return_appid** (string[1,32]) - Optional - 用来控制签约页面结束后的返回路径。示例值:wxcbda96de0b165486 ### Request Example ``` https://api.mch.weixin.qq.com/papay/h5entrustweb?appid=wx426a3015555a46be&contract_code=122&contract_display_account=name1&mch_id=1223816102¬ify_url=https%3A%2F%2Fwww.qq.com%2Ftest%2Fpapay&plan_id=106&request_serial=123& return_appid= wxcbda96de0b165542&clientip=12.1.1.12×tamp=1414488825&version=1.0&sign= 130C7B07DD3B8074F7BF8BEF5C9A86487A1C57478F8C55587876B9C782F72036 ``` ### Response #### Success Response (200) - **return_code** (string[1,16]) - 返回状态码,SUCCESS/FAIL,非签约结果标识。示例值:SUCCESS - **return_msg** (string[1,128]) - 返回信息,如非空,为错误原因。示例值:签名失败 - **result_code** (string[1,16]) - 业务结果,SUCCESS/FAIL,仅在return_code为SUCCESS时返回。示例值:SUCCESS - **result_msg** (string[1,128]) - 业务结果描述,如非空,为错误原因。示例值:SIGN_ERROR - **redirect_url** (string[1,256]) - 跳转URL,有效期为10分钟,用户跳转此URL进入微信签约页面。示例值:https://payapp.weixin.qq.com #### Response Example ```xml <xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[PARAM_ERROR]]></return_msg> <result_code><![CDATA[SUCCESS]]></result_code> <result_msg><![CDATA[SIGN_ERROR]]></result_msg> <redirect_url><![CDATA[https://payapp.weixin.qq.com]]></redirect_url> </xml> ``` ```