本文将详细介绍如何获取微信支付商户号、私钥、证书序列号和 v3 密钥,方便在创建微信支付-小程序服务时,录入相关信息。
![](https://qcloudimg.tencent-cloud.cn/image/document/9371e3931536dd12a408a9aee4f1e8cb.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/9371e3931536dd12a408a9aee4f1e8cb.png)
获取微信支付商户号
2. 进入账户中心 > 商户信息,即可看到微信支付商户号。
![](https://qcloudimg.tencent-cloud.cn/image/document/a547f17a7f8bd48ce5a23067a0151a7b.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/a547f17a7f8bd48ce5a23067a0151a7b.png)
3. 注册成功后,进入产品中心 > AppID 账号管理 > 关联 AppID ,根据业务需求完成商户号和小程序的绑定,绑定后小程序后才可实现支付相关功能,详细绑定流程请参见 微信支付普通商户与 AppID 账号关联管理。
![](https://qcloudimg.tencent-cloud.cn/image/document/fe0620dc68346c13e522d035184b4ce5.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/fe0620dc68346c13e522d035184b4ce5.png)
获取商户 API 私钥
1. 需要商户号的超级管理员才能操作,登录微信支付商户平台 > 账户中心 > 账户设置 > API 安全 > 申请 API 证书,单击申请证书,确定后请勿关闭页面。
![](https://qcloudimg.tencent-cloud.cn/image/document/94e3435355c8e56835e5564d6581aaea.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/94e3435355c8e56835e5564d6581aaea.png)
单击确定。
![](https://qcloudimg.tencent-cloud.cn/image/document/f1c82d10d2905377ca6951365d4e58ac.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/f1c82d10d2905377ca6951365d4e58ac.png)
2. 下载证书工具,下载成功后安装工具。
也可通过以下链接下载证书工具:
Mac版本
![](https://qcloudimg.tencent-cloud.cn/image/document/fafe3c7e57ffd87b173d29c193d3c133.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/fafe3c7e57ffd87b173d29c193d3c133.png)
3. 打开证书工具,填写商户信息(商户号、商户名称),单击下一步。
![](https://qcloudimg.tencent-cloud.cn/image/document/f231146f5f30945aaa7c5e68504ad0e4.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/f231146f5f30945aaa7c5e68504ad0e4.png)
4. 在证书工具,复制证书请求串。(若提示请粘贴请求串到商户平台获取证书串,请在第5点步骤检查是否已粘贴。可同时尝试手动鼠标复制粘贴的方法)
![](https://qcloudimg.tencent-cloud.cn/image/document/1aa30df342a7c30c4d26e0542f2ee244.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/1aa30df342a7c30c4d26e0542f2ee244.png)
5. 在商户平台,粘贴证书请求串。
![](https://qcloudimg.tencent-cloud.cn/image/document/49ae9f8382d307ffcf4243ada7da3843.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/49ae9f8382d307ffcf4243ada7da3843.png)
6. 在商户平台,输入操作密码,安全验证后生成证书串。
![](https://qcloudimg.tencent-cloud.cn/image/document/c8b7e268d6db1b0e308e7ab17c9196e5.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/c8b7e268d6db1b0e308e7ab17c9196e5.png)
7. 在商户平台,复制证书串。
![](https://qcloudimg.tencent-cloud.cn/image/document/cf35d5bb6be42de117e14181e7db1932.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/cf35d5bb6be42de117e14181e7db1932.png)
8. 在证书工具,粘贴证书串,单击下一步,申请证书成功。(若提示证书与本地公私钥不匹配,可能是浏览器禁用了剪切板复制功能。请在操作步骤第7点,操作时使用鼠标选中全部证书串内容(注意右边有下拉框),单击鼠标右键选择复制)
![](https://qcloudimg.tencent-cloud.cn/image/document/8203267764998a2761b0f674e6a7351a.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/8203267764998a2761b0f674e6a7351a.png)
申请证书成功。
![](https://qcloudimg.tencent-cloud.cn/image/document/2d099ae7d635e269d3780a7a9db65f31.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/2d099ae7d635e269d3780a7a9db65f31.png)
9. 打开本地证书文件夹,解压文件。
![](https://qcloudimg.tencent-cloud.cn/image/document/72d670016b42e239cdd87095af311031.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/72d670016b42e239cdd87095af311031.png)
10. 使用文本编辑器,打开私钥文件。
![](https://qcloudimg.tencent-cloud.cn/image/document/70644e726e633c3ab797bd1d918c99da.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/70644e726e633c3ab797bd1d918c99da.png)
复制以下全部商户 API 私钥信息,包括所有信息,不要截断。
![](https://qcloudimg.tencent-cloud.cn/image/document/56ca5197e29246c4cd25b0d291e8fa86.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/56ca5197e29246c4cd25b0d291e8fa86.png)
获取证书序列号
进入账户中心 > API 安全 > 申请 API 证书 > 管理证书。
![](https://qcloudimg.tencent-cloud.cn/image/document/4df4e352c2051acdac8cc930c76702ed.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/4df4e352c2051acdac8cc930c76702ed.png)
进入管理页面,可查看获取证书序列号。
![](https://qcloudimg.tencent-cloud.cn/image/document/082487fc7e9655c56296ecc4a0c21a2a.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/082487fc7e9655c56296ecc4a0c21a2a.png)
获取 v3 密钥
设置或修改入口。
![](https://qcloudimg.tencent-cloud.cn/image/document/471d9d37efad66ee1100d74bc30c6afd.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/471d9d37efad66ee1100d74bc30c6afd.png)
设置/修改密钥,密钥请妥善保管。
![](https://qcloudimg.tencent-cloud.cn/image/document/ae2269a397ca4d6246fd130cc776e6db.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/ae2269a397ca4d6246fd130cc776e6db.png)
至此,已经配置并获取到创建微信支付-小程序服务需要的商户号、私钥、证书序列号和 v3 密钥信息。