创建订单
<p><strong>简要描述:</strong><br />
使用指定支付方式, 购买指定支付项.<br />
不同支付方式的返回数据结构不尽相同, 客户端请参考本页最下方的开发建议.</p>
<p><strong>请求URL:</strong><br />
<code>/api/v1/order</code></p>
<p><strong>请求方式:</strong><br />
<code>POST</code></p>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">是否必选</th>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">source</td>
<td style="text-align: left;">必选</td>
<td style="text-align: left;">string</td>
<td>渠道号</td>
</tr>
<tr>
<td style="text-align: left;">package_id</td>
<td style="text-align: left;">必选</td>
<td style="text-align: left;">string</td>
<td>套餐ID</td>
</tr>
<tr>
<td style="text-align: left;">channel</td>
<td style="text-align: left;">必选</td>
<td style="text-align: left;">string</td>
<td>支付通道</td>
</tr>
<tr>
<td style="text-align: left;">gateway</td>
<td style="text-align: left;">可选</td>
<td style="text-align: left;">string</td>
<td>支付网关, 参考各支付通道对应网关, 没有可不填</td>
</tr>
<tr>
<td style="text-align: left;">coupon_prop_id</td>
<td style="text-align: left;">可选</td>
<td style="text-align: left;">string</td>
<td>优惠券道具ID</td>
</tr>
<tr>
<td style="text-align: left;">cost_order_id</td>
<td style="text-align: left;">可选</td>
<td style="text-align: left;">string</td>
<td>消耗订单ID(当补差价时此参数必填, 由服务端提供)</td>
</tr>
</tbody>
</table>
<p><strong>channel支付通道说明:</strong></p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">alipay</td>
<td>支付宝</td>
</tr>
<tr>
<td style="text-align: left;">wechat</td>
<td>微信</td>
</tr>
<tr>
<td style="text-align: left;">helloNow</td>
<td>你好现在</td>
</tr>
<tr>
<td style="text-align: left;">apple</td>
<td>苹果</td>
</tr>
<tr>
<td style="text-align: left;">yijie</td>
<td>易接</td>
</tr>
<tr>
<td style="text-align: left;">quickSdk</td>
<td>quickSdk</td>
</tr>
<tr>
<td style="text-align: left;">adapay</td>
<td>adapay</td>
</tr>
</tbody>
</table>
<p><strong>gateway支付网关 (channel=alipay)</strong></p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">app</td>
<td>APP支付</td>
</tr>
<tr>
<td style="text-align: left;">web</td>
<td>电脑网站支付</td>
</tr>
<tr>
<td style="text-align: left;">wap</td>
<td>手机网站支付</td>
</tr>
</tbody>
</table>
<p><strong>gateway支付网关 (channel=wechat)</strong></p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">app</td>
<td>APP支付</td>
</tr>
<tr>
<td style="text-align: left;">scan</td>
<td>PC端扫码支付</td>
</tr>
<tr>
<td style="text-align: left;"><del>web</del></td>
<td><del>电脑网站支付</del></td>
</tr>
<tr>
<td style="text-align: left;">wap</td>
<td>手机网站支付</td>
</tr>
</tbody>
</table>
<p><strong>gateway支付网关 (channel=helloNow)</strong></p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">alipay</td>
<td>支付宝</td>
</tr>
<tr>
<td style="text-align: left;">wechat</td>
<td>微信</td>
</tr>
</tbody>
</table>
<p><strong>支付网关(adapay渠道)</strong></p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">alipay</td>
<td>支付宝</td>
</tr>
</tbody>
</table>
<p><strong>身份验证: </strong></p>
<p><code>是</code></p>
<p><strong>返回示例</strong></p>
<pre><code class="language-bash">// 支付宝APP
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: &quot;app_id=2016102602338302&amp;format=JSON&amp;charset=utf-8&amp;sign_type=RSA2&amp;version=1.0&amp;return_url=http%3A%2F%2F192.168.10.10%3A8080%2Fapi%2Fv1%2Forder%2Freturn%2Falipay&amp;notify_url=http%3A%2F%2F192.168.10.10%3A8080%2Fapi%2Fv1%2Forder%2Fnotify%2Falipay&amp;timestamp=2020-05-09+10%3A13%3A55&amp;biz_content=%7B%22out_trade_no%22%3A%22ALI202005091013554620%22%2C%22total_amount%22%3A1.23%2C%22subject%22%3A%221%22%2C%22body%22%3A%221%22%2C%22product_code%22%3A%22QUICK_MSECURITY_PAY%22%7D&amp;method=alipay.trade.app.pay&amp;sign=eyHap1fJgrIlxclpOmx425Bfxd44gBIge0JvF7ePfrvqhgSVAJDwqcSzLnPyHM5usBhFqzhK63wzGMpvu600p3q4aMuVKK8e1ZNNan4eyA%2F%2F0DhFbPtzGFSBt47l5APxjwtt0riu4ySVbRNF0Uzw23eHJP3MH%2FaOZF72T08A1ElgHaVszzHf8JvaRiBRWjTQOlEiuUgXGbku0S%2BUOPN8XQwAqwXHR%2Fsk1%2Boaw7TTL9pnZu5PxFYarm%2F3qDuFaRfgSgA6HiR4feeTB4KhZpyQ4C3002iFoetqWtVpilZb%2By%2FQwhacKZn3h5Bwwt%2BXFJhH%2FjhIyXyC%2BoKzVOOro9JTUg%3D%3D&quot;
}
// 支付宝 WEB
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: &quot;https://openapi.alipay.com/gateway.do?charset=utf-8&amp;app_id=2016080401702147&amp;format=JSON&amp;charset=utf-8&amp;sign_type=RSA2&amp;version=1.0&amp;return_url=http%3A%2F%2F192.168.10.10%3A8080%2Fapi%2Fv1%2Forder%2Freturn%2Falipay&amp;notify_url=http%3A%2F%2F192.168.10.10%3A8080%2Fapi%2Fv1%2Forder%2Fnotify%2Falipay&amp;timestamp=2020-06-02+19%3A13%3A12&amp;biz_content=%7B%22out_trade_no%22%3A%22ALI202006021913128396%22%2C%22total_amount%22%3A0.01%2C%22subject%22%3A%22%5Cu81f3%5Cu5c0a20%5Cu5929%5Cu793c%5Cu5305%22%2C%22body%22%3A%22%5Cu81f3%5Cu5c0a20%5Cu5929%5Cu793c%5Cu5305%22%2C%22product_code%22%3A%22FAST_INSTANT_TRADE_PAY%22%7D&amp;method=alipay.trade.page.pay&amp;sign=FOvXpcGNa0K8usKu%2BxStSKCBdRDu0DqYl7U0nOiF3FlQC5BLmhBukALYMUA%2F8oF9WqgOuLx0DNNFnn2%2Bo0fkT4%2FTKOuPExMI6YLBK1VV6wK8w7cLCbY2gNXbsm7s1lSu8QlRMD8A8Iwx%2BWJizHM6KHFJ4ELXjD8bUGPRHVYbNEC1wofh%2BTo5V1Zrf6y3nJpPBs8aDQKF5YERzliEoLoJ3pGAfcXDYEySDDiXU23PLjgs2C2cNyhQAspcV1H2b2d0Hg%2BKPscA%2BWSVl7GHvZQp19xGkrozbt%2BO4ty50ZD7xChW3D21ndvMiqaD98m3q42THtTSti0pK%2BgaZBSr%2Bci6Ig%3D%3D&quot;
}
// 苹果内购
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: {
&quot;orderid&quot;: &quot;PG202007301609314744&quot;,
&quot;price&quot;: 1,
&quot;appleProductId&quot;: &quot;0&quot;,
&quot;sign&quot;: &quot;taXbm9MwfDF8NDQ3NDEzOTA2MTAzNzAwMjAyR1A=&quot;
}
}
// 易接
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: {
&quot;orderid&quot;: &quot;NO202008061711392723&quot;,
&quot;price&quot;: 1,
&quot;title&quot;: &quot;至尊20天礼包&quot;,
&quot;notify_url&quot;: &quot;http://192.168.10.10/api/v1/order/notify/nopay&quot;
}
}
// 微信支付 APP支付(app)
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: {
&quot;appid&quot;: &quot;wxade597438d0d2fa3&quot;,
&quot;partnerid&quot;: &quot;1602969828&quot;,
&quot;prepayid&quot;: &quot;wx2714310732185443cbbfb8623c9ed60000&quot;,
&quot;timestamp&quot;: &quot;1601188267&quot;,
&quot;noncestr&quot;: &quot;AmnAP7JtoPXTfX3g&quot;,
&quot;package&quot;: &quot;Sign=WXPay&quot;,
&quot;sign&quot;: &quot;18275991C86FD7899BC4860A21D8E223&quot;
}
}
// 微信支付 PC扫码(scan)
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: {
&quot;return_code&quot;: &quot;SUCCESS&quot;,
&quot;return_msg&quot;: &quot;OK&quot;,
&quot;appid&quot;: &quot;wx17471a05c15d2d70&quot;,
&quot;mch_id&quot;: &quot;1602969828&quot;,
&quot;nonce_str&quot;: &quot;BHtPQkM8xVZ8hrco&quot;,
&quot;sign&quot;: &quot;92F2531441C52962B8BC0CF8F3777DB8&quot;,
&quot;result_code&quot;: &quot;SUCCESS&quot;,
&quot;prepay_id&quot;: &quot;wx271431075556675898d4ab51b336580000&quot;,
&quot;trade_type&quot;: &quot;NATIVE&quot;,
&quot;code_url&quot;: &quot;weixin://wxpay/bizpayurl?pr=5Glkec400&quot;
}
}
// 微信支付 H5支付(wap)
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: &quot;weixin://wxpay/bizpayurl?pr=5Glkec400&quot;
}
// quickSdk
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: {
&quot;orderid&quot;: &quot;NO202011021821484222&quot;,
&quot;price&quot;: 1,
&quot;title&quot;: &quot;199元单人套餐男宾一位&quot;,
&quot;gold&quot;: 11000000,
&quot;diamond&quot;: 0,
&quot;notify_url&quot;: &quot;http://192.168.10.10:8080/api/v1/order/notify/quickSdk&quot;
}
}
// helloNow 两种支付方式, 一种是APP支付, 一种是H5支付, 由服务端控制, 客户端需要根据 is_h5 字段判断.
// APP支付 直接使用返回返参, 调起你好SDK.
// H5支付 则需要客户端使用webview、浏览器打开HTTP链接或直接打开scheme链接
// helloNow 你好现在(APP支付)
// alipay与wechat返参大致相同
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: {
&quot;funcode&quot;: &quot;WP001&quot;,
&quot;version&quot;: &quot;1.0.3&quot;,
&quot;appId&quot;: &quot;1234567890&quot;,
&quot;mhtOrderNo&quot;: &quot;HNOW202111251534516355&quot;,
&quot;mhtOrderName&quot;: &quot;Yolanda Cartwright&quot;,
&quot;mhtOrderType&quot;: &quot;05&quot;,
&quot;mhtCurrencyType&quot;: &quot;156&quot;,
&quot;mhtOrderAmt&quot;: 100,
&quot;mhtOrderDetail&quot;: &quot;Yolanda Cartwright&quot;,
&quot;mhtOrderStartTime&quot;: &quot;20211125153451&quot;,
&quot;notifyUrl&quot;: &quot;http:\/\/localhost\/api\/v1\/order\/notify\/helloNow\/0&quot;,
&quot;mhtCharset&quot;: &quot;UTF-8&quot;,
&quot;deviceType&quot;: &quot;01&quot;,
&quot;payChannelType&quot;: &quot;12&quot;,
&quot;consumerCreateIp&quot;: &quot;192.168.10.10&quot;,
&quot;mhtSignType&quot;: &quot;MD5&quot;,
&quot;mhtSignature&quot;: &quot;ac31c2e05d9d542301c11e087c3406ad&quot;
}
}
// helloNow 你好现在(H5支付)
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: {
&quot;is_h5&quot;: true,
&quot;url&quot;: &quot;alipays:\/\/platformapi\/startapp?appId=10000007&amp;qrcode=https%3A%2F%2Fqr.alipay.com%2Fbax03957tcjaspafm4ok3058#Intent&quot;
}
}
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: {
&quot;is_h5&quot;: true,
&quot;url&quot;: &quot;https://openapi.alipay.com/gateway.do?alipay_sdk=alipay-sdk-java-dynamicVersionNo&amp;app_auth_token=201612BBe7933914c71745ae99360f4c29fedB06&amp;app_id=2016090701862812&amp;biz_content=%7B%22total_amount%22%3A%220.01%22%2C%22timeout_express%22%3A%2260m%22%2C%22product_code%22%3A%22QUICK_WAP_PAY%22%2C%22subject%22%3A%22mhtOrderName%E8%AE%A2%E5%8D%95%E5%90%8D%E7%A7%B0%22%2C%22out_trade_no%22%3A%22200601201710231457537743001%22%2C%22extend_params%22%3A%22%7B%5C%22sys_service_provider_id%5C%22%3A%5C%222088421452327167%5C%22%7D%22%7D&amp;charset=UTF-8&amp;format=json&amp;method=alipay.trade.wap.pay&amp;notify_url=https%3A%2F%2Fpay.ipaynow.cn%2FaliPayNotify%2F2006%2F0df24039a41c139eB1123_116_22478846Be9cf69e5774937B260_22_0091777671&amp;return_url=https%3A%2F%2Fpay.ipaynow.cn%2FalipayFrontNotify%2F2006%2F0df24039a41c139eB1123_116_22478846Be9cf69e5774937B260_22_0091777671&amp;sign=R%2BpsmG%2BCon1OL5SkuhsApxcUS4U2BwD5ZrL%2Ben1SgmOAv3%2B2JV5x6CEoJbFgOdh9UhkR%2Bn5PR6RNDAhKP2XSP6uWptS20aydIB4PZ8%2BYwX%2FlW0WH6uE5WI65K%2Bd5uOzb%2B6CZEcwqhC8Et%2Fm2KIw7wGvp94wFZn7P14Y3wcx%2Berk%3D&amp;sign_type=RSA&amp;timestamp=2017-10-23+14%3A57%3A53&amp;version=1.0&amp;sign=R%2BpsmG%2BCon1OL5SkuhsApxcUS4U2BwD5ZrL%2Ben1SgmOAv3%2B2JV5x6CEoJbFgOdh9UhkR%2Bn5PR6RNDAhKP2XSP6uWptS20aydIB4PZ8%2BYwX%2FlW0WH6uE5WI65K%2Bd5uOzb%2B6CZEcwqhC8Et%2Fm2KIw7wGvp94wFZn7P14Y3wcx%2Berk%3D&quot;
}
}
# adapay alipay
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: &quot;alipays://platformapi/startapp?saId=10000007&amp;qrcode=https://qr.alipay.com/bax02911brluc2xieoph6001&quot;
}</code></pre>
<p><strong>返回参数说明</strong> </p>
<p><strong>备注</strong> </p>
<p>当 <code>data.code</code> 为<code>0</code>, 且<code>data.message</code> 不为空时, 客户端应使用确认框显示文本内容, 其余流程不变.</p>
<p><strong>开发建议</strong></p>
<p>考虑到后面会接入很多支付宝/微信的第三方支付, 为减小工作量, 建议首先判断 <code>data</code> 为<code>string</code>时, 进行<strong>scheme前缀匹配</strong>, 匹配成功直接打开.</p>
<pre><code># 直接打开支付宝, 前缀 alipays://
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: &quot;alipays://platformapi/startapp?saId=10000007&amp;qrcode=https://qr.alipay.com/bax02911brluc2xieoph6001&quot;
}
# 直接打开微信, 前缀 weixin://
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: &quot;weixin://wxpay/bizpayurl?pr=5Glkec400&quot;
}
# 直接打开自带浏览器, 前缀 http:// 或 https://
{
&quot;code&quot;: 0,
&quot;message&quot;: &quot;&quot;,
&quot;data&quot;: &quot;https://openapi.alipay.com/gateway.do?charset=utf-8&amp;app_id=2016080401702147&amp;format=JSON&amp;charset=utf-8&amp;sign_type=RSA2&amp;version=1.0&amp;return_url=http%3A%2F%2F192.168.10.10%3A8080%2Fapi%2Fv1%2Forder%2Freturn%2Falipay&amp;notify_url=http%3A%2F%2F192.168.10.10%3A8080%2Fapi%2Fv1%2Forder%2Fnotify%2Falipay&amp;timestamp=2020-06-02+19%3A13%3A12&amp;biz_content=%7B%22out_trade_no%22%3A%22ALI202006021913128396%22%2C%22total_amount%22%3A0.01%2C%22subject%22%3A%22%5Cu81f3%5Cu5c0a20%5Cu5929%5Cu793c%5Cu5305%22%2C%22body%22%3A%22%5Cu81f3%5Cu5c0a20%5Cu5929%5Cu793c%5Cu5305%22%2C%22product_code%22%3A%22FAST_INSTANT_TRADE_PAY%22%7D&amp;method=alipay.trade.page.pay&amp;sign=FOvXpcGNa0K8usKu%2BxStSKCBdRDu0DqYl7U0nOiF3FlQC5BLmhBukALYMUA%2F8oF9WqgOuLx0DNNFnn2%2Bo0fkT4%2FTKOuPExMI6YLBK1VV6wK8w7cLCbY2gNXbsm7s1lSu8QlRMD8A8Iwx%2BWJizHM6KHFJ4ELXjD8bUGPRHVYbNEC1wofh%2BTo5V1Zrf6y3nJpPBs8aDQKF5YERzliEoLoJ3pGAfcXDYEySDDiXU23PLjgs2C2cNyhQAspcV1H2b2d0Hg%2BKPscA%2BWSVl7GHvZQp19xGkrozbt%2BO4ty50ZD7xChW3D21ndvMiqaD98m3q42THtTSti0pK%2BgaZBSr%2Bci6Ig%3D%3D&quot;
}</code></pre>