import{_ as a}from"./battery-100-VBikFKl4.js";import{_ as n,c as t,a as l,o as e}from"./app-Dgsdh8A6.js";const o={};function d(p,s){return e(),t("div",null,s[0]||(s[0]=[l('<h1 id="微信-支付宝方式充电" tabindex="-1"><a class="header-anchor" href="#微信-支付宝方式充电"><span>微信&amp;支付宝方式充电</span></a></h1><img src="'+a+`" width="100" height="100"><p>操作流程：</p><ol><li>申请充电二维码及扫码秘钥，秘钥临时保存备用</li><li>使用<code>qr_code_url</code>中的值生成二维码</li><li>用支付宝或微信扫描</li><li>以扫码秘钥作为参数轮询检查扫码支付结果</li></ol><h2 id="申请充电二维码及扫码秘钥" tabindex="-1"><a class="header-anchor" href="#申请充电二维码及扫码秘钥"><span>申请充电二维码及扫码秘钥</span></a></h2><blockquote><p>https://api.bilibili.com/x/ugcpay/web/v2/trade/elec/pay/qr_code/create</p></blockquote><p><em>请求方式：POST</em></p><p>认证方式：Cookie（SESSDATA）</p><p>秘钥有效时间为10分钟</p><p><strong>正文参数（ application/x-www-form-urlencoded ）：</strong></p><table><thead><tr><th>参数名</th><th>类型</th><th>内容</th><th>必要性</th><th>备注</th></tr></thead><tbody><tr><td>bp_num</td><td>num</td><td>充电B币数量</td><td>必要</td><td>必须在2-9999之间</td></tr><tr><td>is_bp_remains_prior</td><td>bool</td><td>是否优先扣除B币</td><td>必要</td><td>true：是<br>false：否<br>在B币不足时剩余的部分利用支付平台支付</td></tr><tr><td>up_mid</td><td>num</td><td>充电对象用户mid</td><td>必要</td><td></td></tr><tr><td>otype</td><td>str</td><td>充电来源</td><td>必要</td><td>up：空间充电<br>archive：视频充电</td></tr><tr><td>oid</td><td>num</td><td>充电来源代码</td><td>必要</td><td>空间充电：充电对象用户mid<br>视频充电：稿件avid</td></tr><tr><td>csrf</td><td>str</td><td>CSRF Token（位于cookie）</td><td>必要</td><td></td></tr></tbody></table><p><strong>json回复：</strong></p><p>根对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>code</td><td>num</td><td>返回值</td><td>0：成功<br>-101：账号未登录<br>-111：csrf校验失败<br>-400：请求错误<br>-500：服务器错误</td></tr><tr><td>message</td><td>str</td><td>错误信息</td><td>默认为0</td></tr><tr><td>ttl</td><td>num</td><td>1</td><td></td></tr><tr><td>data</td><td>obj</td><td>信息本体</td><td></td></tr></tbody></table><p><code>data</code>对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>qr_code_url</td><td>str</td><td>支付二维码生成内容</td><td>存在转义</td></tr><tr><td>qr_token</td><td>str</td><td>扫码秘钥</td><td></td></tr><tr><td>exp</td><td>num</td><td>获得经验数</td><td></td></tr></tbody></table><p><strong>示例：</strong></p><p>申请空间的方式向用户23215368充电10电池且不使用B币的支付二维码</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#CE9178;"> &#39;https://api.bilibili.com/x/ugcpay/trade/elec/pay/qr_code/create&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;elec_num=10&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;up_mid=23215368&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;is_bp_remains_prior=false&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;otype=up&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;oid=23215368&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;csrf=xxx&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">-b </span><span style="color:#CE9178;">&#39;SESSDATA=xxx&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">		&quot;qr_code_url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;https://api.bilibili.com/x/ugcpay/trade/elec/pay/qr_code/gateway?mid=293793435&amp;token=c1cb1d95d2194ba58df6bb0f24ae1aaa&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">		&quot;qr_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;c1cb1d95d2194ba58df6bb0f24ae1aaa&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">		&quot;exp&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span></span>
<span class="line"><span style="color:#D4D4D4;">	}</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h2 id="检查扫码支付结果" tabindex="-1"><a class="header-anchor" href="#检查扫码支付结果"><span>检查扫码支付结果</span></a></h2><blockquote><p>https://api.bilibili.com/x/ugcpay/trade/elec/pay/order/status</p></blockquote><p><em>请求方式：GET</em></p><p>认证方式：Cookie（SESSDATA）</p><p><strong>url参数：</strong></p><table><thead><tr><th>参数名</th><th>类型</th><th>内容</th><th>必要性</th><th>备注</th></tr></thead><tbody><tr><td>qr_token</td><td>str</td><td>扫码秘钥</td><td>必要</td><td></td></tr></tbody></table><p><strong>json回复：</strong></p><p>根对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>code</td><td>num</td><td>返回值</td><td>0：成功<br>-101：账号未登录</td></tr><tr><td>message</td><td>str</td><td>错误信息</td><td>默认为0</td></tr><tr><td>ttl</td><td>num</td><td>1</td><td></td></tr><tr><td>data</td><td>obj</td><td>信息本体</td><td></td></tr></tbody></table><p><code>data</code>对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>qr_token</td><td>str</td><td>扫码秘钥</td><td></td></tr><tr><td>order_no</td><td>str</td><td>留言token</td><td>未成功则无此项<br>用于添加充电留言</td></tr><tr><td>mid</td><td>num</td><td>当前用户mid</td><td></td></tr><tr><td>status</td><td>num</td><td>状态值</td><td>若秘钥错误则无此项<br>1：已支付<br>2：未扫描<br>3：未确认</td></tr></tbody></table><p><strong>示例：</strong></p><p>当申请到的支付二维码未被扫描时，<code>data</code>.<code>status</code>的值为<code>2</code></p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#569CD6;"> -G</span><span style="color:#CE9178;"> &#39;https://api.bilibili.com/x/ugcpay/trade/elec/pay/order/status&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;qr_token=c7cbdc47fc424cd18f2146db653597b8&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">-b </span><span style="color:#CE9178;">&#39;SESSDATA=xxx&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;qr_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;c7cbdc47fc424cd18f2146db653597b8&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;mid&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">293793435</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;status&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">2</span></span>
<span class="line"><span style="color:#D4D4D4;">    }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p>当申请到的支付二维码已扫描但未确认时，<code>data</code>.<code>status</code>的值为<code>3</code></p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#569CD6;"> -G</span><span style="color:#CE9178;"> &#39;https://api.bilibili.com/x/ugcpay/trade/elec/pay/order/status&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;qr_token=c7cbdc47fc424cd18f2146db653597b8&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">-b </span><span style="color:#CE9178;">&#39;SESSDATA=xxx&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;qr_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;c7cbdc47fc424cd18f2146db653597b8&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;mid&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">293793435</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;status&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">3</span></span>
<span class="line"><span style="color:#D4D4D4;">    }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p>成功支付后，<code>data</code>.<code>status</code>的值为<code>1</code>，且<code>data</code>.<code>order_no</code>存在留言token</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#569CD6;"> -G</span><span style="color:#CE9178;"> &#39;https://api.bilibili.com/x/ugcpay/trade/elec/pay/order/status&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;qr_token=c7cbdc47fc424cd18f2146db653597b8&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">-b </span><span style="color:#CE9178;">&#39;SESSDATA=xxx&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;qr_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;bd649c836c524550bfe22a369334fc05&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;order_no&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;BPTD36U3KP82I31RSSLG&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;mid&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">293793435</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;status&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span></span>
<span class="line"><span style="color:#D4D4D4;">    }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details>`,41)]))}const i=n(o,[["render",d]]),D=JSON.parse('{"path":"/docs/electric/WeChat_Alipay.html","title":"微信&支付宝方式充电","lang":"zh-CN","frontmatter":{},"git":{"updatedTime":1740498696000,"contributors":[{"name":"SocialSisterYi","username":"SocialSisterYi","email":"1440239038@qq.com","commits":2,"url":"https://github.com/SocialSisterYi"},{"name":"SessionHu","username":"SessionHu","email":"102411014+SessionHu@users.noreply.github.com","commits":1,"url":"https://github.com/SessionHu"},{"name":"wuziqian211","username":"wuziqian211","email":"65224318+wuziqian211@users.noreply.github.com","commits":1,"url":"https://github.com/wuziqian211"}],"changelog":[{"hash":"6c1f03e75334aaba6f3b6f3bf346b0326073b779","time":1740498696000,"email":"65224318+wuziqian211@users.noreply.github.com","author":"晨叶梦春","message":"update"},{"hash":"b1a06806f09ed3ea130eefc94e33df2bc0335424","time":1691494779000,"email":"102411014+SessionHu@users.noreply.github.com","author":"Session小胡","message":"将 http 改为 https (#776)"},{"hash":"f6760f4be38d5b592d396b211e48c666286524de","time":1677124138000,"email":"1440239038@qq.com","author":"SocialSisterYi","message":"🔨remove header index"},{"hash":"7d89ece2ac46425810647c4ac92acf5f3721cb68","time":1676998806000,"email":"1440239038@qq.com","author":"SocialSisterYi","message":"🚀调整项目结构"}]},"filePathRelative":"docs/electric/WeChat&Alipay.md"}');export{i as comp,D as data};
