# 支付宝支付

#### 请求URL

* `https://newapi.mbd.pub/release/alipay/pay`

#### 请求方式

* POST
* Json

#### 请求参数

| **参数名**        | **必选** | **类型** | **说明**                                                                                                                           |
| -------------- | ------ | ------ | -------------------------------------------------------------------------------------------------------------------------------- |
| url            | 是      | string | 支付后跳转的URL地址                                                                                                                      |
| app\_id        | 是      | string | 你的 app\_id，可在控制台查看                                                                                                               |
| share\_code    | 否      | string | 分账参数，需[先开通分账权限](/kai-fa-zhe-zhi-chi/ying-yong-he-zuo-fen-zhang-quan-xian.md#shen-qing-fen-zhang-quan-xian-de-qian-zhi-tiao-jian) |
| description    | 是      | string | 支付描述，一般为商品名称                                                                                                                     |
| amount\_total  | 是      | number | 金额，**单位为分**                                                                                                                      |
| out\_trade\_no | 否      | string | 订单号，如不填，面包多将随机生成订单号                                                                                                              |
| callback\_url  | 否      | string | 支付后跳转地址，如不填会只显示「支付成功」                                                                                                            |
| sign           | 是      | string | 请求签名，参照[签名算法](/api/qian-ming-suan-fa.md)                                                                                         |

#### 返回示例

```
//成功
{
    "body": "<form id='alipaysubmit' name='alipaysubmit' action='https://openapi.alipay.com/gateway.do?charset=UTF-8' method='POST'><input type='hidden' name='method' value='alipay.trade.wap.pay'/><input type='hidden' name='app_id' value='2021015212301193689006'/><input type='hidden' name='timestamp' value='2021-03-11 23:08:09'/><input type='hidden' name='format' value='json'/><input type='hidden' name='version' value='1.0'/><input type='hidden' name='alipay_sdk' value='alipay-easysdk-php-2.0.0'/><input type='hidden' name='charset' value='UTF-8'/><input type='hidden' name='sign_type' value='RSA2'/><input type='hidden' name='app_cert_sn' value='d6558a25f540df44efaa5fa7920b6f0e'/><input type='hidden' name='alipay_root_cert_sn' value='687b59193f3f462dd5336e5abf83c5d8_02941eef3asd424234d3b83462e1dfcf6'/><input type='hidden' name='biz_content' value='{\"subject\":null,\"sub_merchant\":{\"merchant_id\":null},\"settle_info\":{\"settle_detail_infos\":[{\"amount\":10,\"trans_in_type\":\"loginName\",\"trans_in\":\"XXXXX@gmail.com\"}]},\"out_trade_no\":\"fe79d8e4faa0e184f721de6e1f919f43\",\"total_amount\":10,\"quit_url\":\"https%3A%2F%2Fm.niucodata.com%2Fbox_pay%2Fmbd_payok.php%3Fres%3Dfail\",\"product_code\":\"QUICK_WAP_WAY\"}'/><input type='hidden' name='return_url' value='https%3A%2F%2Fm.niucodata.com%2Fbox_pay%2Fmbd_payok.php'/><input type='hidden' name='notify_url' value='https://api.mianbaoduo.com/release/alipay/notify'/><input type='hidden' name='sign' value='J5+svHVpVWwhmBUC2yzC4nF0cMi+OuGJKTfvdFBEiwkZOoiulTxUV7dgs4pTjGdL1DJ0qeU0xm82+3tXyvDuYapl2tzGmN1QfEB6Pp/aHeY3EVDkz1pF6zoh/iVb9bgLi/imSd95hbqvIyDAwFYsMMHl4b32wPyQMoYy9DTy/zIdpkNb4/I3bMaBwV1tniOldcxdzIkoV7z2CtQfp3eDI4z4KpGb239eIFPMDG2MDe+nj9Fr+I5PJMciKP1l8lfSlM65a4YAoXFmEjwqz3M6MFCxHWPT1lCmZ0EDA/0TWsXvwrrEo0579QOjhkqT6EpvJboDZsb1Ejg1sYslrJBS1Q=='/><input type='submit' value='ok' style='display:none;''></form><script>document.forms['alipaysubmit'].submit();</script>"
}

//失败
{
    "error": "error sign"
}
```

#### 返回参数说明

| **参数名** | **类型** | **说明** |
| ------- | ------ | ------ |
| error   | string | 错误说明   |
|         |        |        |

#### 备注

* 如果返回结果不包含 error，则请求成功，返回的body直接前端展示，即可自动唤起支付宝进行支付
* 支付宝支付的使用请参考支付宝官方文档
* 如需要在PC上使用，请先制作移动端支付页面，然后引导用户扫码到支付页面进行支付


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.mbd.pub/api/zhi-fu-bao-zhi-fu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
