Authored by wujiexiang

立即购买接口

  1 +## 1、获取用户可用的优惠券张数 ##
  2 +#### 说明
  3 +获取用户可用的优惠券张数(app.Buynow.countUsableCoupon)
  4 +#### 请求参数
  5 +| 参数名称 | 参数类型 | 可否为空 | 示例 | 默认值 | 备注 |
  6 +|:-------| -----:|-----:|-----:|-----:|----:|
  7 +|uid|int|否|3236556|0|用户id|
  8 +|product_sku|int|否|1|1|sku|
  9 +|sku_type|string|否|I 分期|“”|sku类型|
  10 +|buy_number|int|否|1|1|购买数量|
  11 +|client_type|string|否|web|iphone|终端|
  12 +
  13 +### 请求示例
  14 +POST http://192.168.102.205:8080/gateway?method=app.Buynow.countUsableCoupon
  15 +### 响应
  16 +code为200即为成功,否则是失败。
  17 +响应JSON格式如下所示:
  18 +
  19 +```json
  20 +{
  21 + "alg":"SALT_MD5",
  22 + "code":200,
  23 + "data":{"count":5},
  24 + "md5":"c1d725306fb09dcbf504776d276521cb",
  25 + "message":"ok"
  26 +}
  27 +```
  28 +
  29 +## 2、获取用户可用和不可用优惠券列表 ##
  30 +#### 说明
  31 +获取用户优惠券列表,可用和不可用(app.Buynow.listCoupon)
  32 +#### 请求参数
  33 +| 参数名称 | 参数类型 | 可否为空 | 示例 | 默认值 | 备注 |
  34 +|:-------| -----:|-----:|-----:|-----:|----:|
  35 +|uid|int|否|3236556|0|用户id|
  36 +|product_sku|int|否|1|1|sku|
  37 +|sku_type|string|否|I 分期|“”|sku类型|
  38 +|buy_number|int|否|1|1|购买数量|
  39 +|client_type|string|否|web|iphone|终端|
  40 +
  41 +### 请求示例
  42 +POST http://192.168.102.205:8080/gateway?method=app.Buynow.listCoupon
  43 +
  44 +### 响应
  45 +code为200即为成功,否则是失败。
  46 +响应JSON格式如下所示:
  47 +
  48 +```json
  49 +{
  50 + "alg": "SALT_MD5",
  51 + "code": 200,
  52 + "data": {
  53 + "usable_coupons":[
  54 + {
  55 + "coupon_code": "amccccc",
  56 + "coupon_name": "生日券",
  57 + "coupon_type": "3",
  58 + "coupon_validity": "2013.11.01-2017.01.31",
  59 + "coupon_value": "55"
  60 + }
  61 + ],
  62 + "unusable_coupons": [
  63 + {
  64 + "coupon_code": "ambb2345",
  65 + "coupon_name": "生日券",
  66 + "coupon_type": "3",
  67 + "coupon_validity": "2013.11.01-2017.01.31",
  68 + "coupon_value": "55"
  69 + }
  70 + ]
  71 + },
  72 + "md5": "c1d725306fb09dcbf504776d276521cb",
  73 + "message": "ok"
  74 +}
  75 +```
  76 +
  77 +## 3、立即购买结算接口 ##
  78 +#### 说明
  79 +购物车结算(app.Buynow.payment)
  80 +#### 请求参数
  81 +| 参数名称 | 参数类型 | 可否为空 | 示例 | 默认值 | 备注 |
  82 +|:-------| -----:|-----:|-----:|-----:|----:|
  83 +|uid|int|否|3236556|0|用户id|
  84 +|product_sku|int|否|1|1|sku|
  85 +|sku_type|string|否|I|“”|I 分期|
  86 +|buy_number|int|否|1|1|购买数量|
  87 +|yoho_coin_mode|int|否|1|1|是否使用yoho币,1使用,0不使用|
  88 +|yoho_bill_term|int|是|0||30天不分期 - 1 分期:3、6、9、12;0,不使用|
  89 +|client_type|string|否|web|iphone|终端|
  90 +|is_support_apple_pay|string|否|Y|N|客户端设备是否支持apple pay|
  91 +
  92 +### 响应
  93 +POST
  94 +code为200即为成功,否则是失败。
  95 +响应JSON格式如下所示:
  96 +
  97 +```json
  98 +{
  99 + "alg": "SALT_MD5",
  100 + "code": 200,
  101 + "data": {
  102 + "delivery_address": {
  103 + "address": "南京",
  104 + "address_id": "4555851",
  105 + "area": "北京市 北京市 东城区",
  106 + "area_code": "110101",
  107 + "consignee": "123",
  108 + "is_delivery": "Y",
  109 + "is_support": "Y",
  110 + "mobile": "139****4768",
  111 + "phone": ""
  112 + },
  113 + "delivery_time": [{
  114 + "default": "N",
  115 + "delivery_time_id": 1,
  116 + "delivery_time_string": "只工作日送货"
  117 + }, {
  118 + "default": "Y",
  119 + "delivery_time_id": 2,
  120 + "delivery_time_string": "工作日、双休日和节假日均送货"
  121 + }, {
  122 + "default": "N",
  123 + "delivery_time_id": 3,
  124 + "delivery_time_string": "只双休日、节假日送货(工作日不送货)"
  125 + }],
  126 + "delivery_way": [{
  127 + "default": "Y",
  128 + "delivery_way_cost": 10,
  129 + "delivery_way_id": 1,
  130 + "delivery_way_name": "普通快递",
  131 + "is_delivery": "Y",
  132 + "is_support": "Y"
  133 + }, {
  134 + "default": "N",
  135 + "delivery_way_cost": 15,
  136 + "delivery_way_id": 2,
  137 + "delivery_way_name": "顺丰速运",
  138 + "is_delivery": "Y",
  139 + "is_support": "Y"
  140 + }],
  141 + "goods_list": [{
  142 + "attribute": "1",
  143 + "brand_id": "141",
  144 + "buy_limit": 0,
  145 + "buy_number": "1",
  146 + "cn_alphabet": "TYAKASHABaiSeNanNvTongKuanJiaoYinJiRouJiBenKuanTXuAJN01T16XSAJN01W",
  147 + "color_id": "1",
  148 + "color_name": "白色",
  149 + "expect_arrival_time": "",
  150 + "fit_promotions": ["8479", "8477", "8475"],
  151 + "get_yoho_coin": "0",
  152 + "goods_id": "529095",
  153 + "goods_images": "http://img10.static.yhbimg.com/goodsimg/2016/04/11/10/01717d13ad6eab0a039f013dfecdb0e4a7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
  154 + "goods_type": "ordinary",
  155 + "is_advance": "N",
  156 + "is_jit": "N",
  157 + "is_limited": "N",
  158 + "is_outlets": "N",
  159 + "is_special": "N",
  160 + "last_price": "168.0",
  161 + "last_vip_price": 168,
  162 + "market_price": 168,
  163 + "max_sort_id": "1",
  164 + "middle_sort_id": "11",
  165 + "off_shelves": 0,
  166 + "product_id": 417451,
  167 + "product_name": "TYAKASHA 白色男女通款胶印肌肉基本款T恤 ",
  168 + "product_skc": "373162",
  169 + "product_skn": "51228710",
  170 + "product_sku": "1164186",
  171 + "promotion_flag": "108",
  172 + "promotion_id": "0",
  173 + "real_price": 168,
  174 + "real_vip_price": 0,
  175 + "sale_price": 0,
  176 + "sales_price": 168,
  177 + "selected": "Y",
  178 + "shop_id": 0,
  179 + "shopping_cart_goods_id": "106796919",
  180 + "shopping_cart_id": "131919063",
  181 + "size_id": "201",
  182 + "size_name": "L",
  183 + "small_sort_id": "114",
  184 + "storage_number": "100",
  185 + "str_subtotal": "¥168.00",
  186 + "subtotal": 168,
  187 + "supplier_id": 0,
  188 + "uid": "10921691",
  189 + "vip1_price": "159.60",
  190 + "vip2_price": "151.20",
  191 + "vip3_price": "147.84",
  192 + "vip_discount": 1,
  193 + "vip_discount_money": 0,
  194 + "vip_discount_type": "1",
  195 + "vip_price": 0,
  196 + "yoho_coin_num": "0"
  197 + }],
  198 + "invoices": {
  199 + "invoices_title": "",
  200 + "invoices_type_id": 0,
  201 + "invoices_type_list": [{
  202 + "invoices_type_id": 1,
  203 + "invoices_type_name": "图书"
  204 + }, {
  205 + "invoices_type_id": 2,
  206 + "invoices_type_name": "资料"
  207 + }, {
  208 + "invoices_type_id": 3,
  209 + "invoices_type_name": "办公用品"
  210 + }, {
  211 + "invoices_type_id": 4,
  212 + "invoices_type_name": "洗涤用品"
  213 + }, {
  214 + "invoices_type_id": 5,
  215 + "invoices_type_name": "化妆品"
  216 + }, {
  217 + "invoices_type_id": 6,
  218 + "invoices_type_name": "体育用品"
  219 + }, {
  220 + "invoices_type_id": 7,
  221 + "invoices_type_name": "服装"
  222 + }, {
  223 + "invoices_type_id": 8,
  224 + "invoices_type_name": "饰品"
  225 + }, {
  226 + "invoices_type_id": 9,
  227 + "invoices_type_name": "配件"
  228 + }, {
  229 + "invoices_type_id": 10,
  230 + "invoices_type_name": "数码产品"
  231 + }],
  232 + "invoiceContentList": -- 发票内容
  233 + [{
  234 + "invoices_type_id": 1,
  235 + "invoices_type_name": "服装"
  236 + }, {
  237 + "invoices_type_id": 2,
  238 + "invoices_type_name": "图书"
  239 + }, {
  240 + "invoices_type_id": 3,
  241 + "invoices_type_name": "配件"
  242 + }, {
  243 + "invoices_type_id": 4,
  244 + "invoices_type_name": "日用品"
  245 + }, {
  246 + "invoices_type_id": 5,
  247 + "invoices_type_name": "办公用品"
  248 + }, {
  249 + "invoices_type_id": 6,
  250 + "invoices_type_name": "体育用品"
  251 + }, {
  252 + "invoices_type_id": 7,
  253 + "invoices_type_name": "数码产品"
  254 + }],
  255 + "invoices_type_name": ""
  256 + },
  257 + "payment_way": [{
  258 + "default": "Y",
  259 + "is_support": "Y",
  260 + "payment_id": 15,
  261 + "payment_name": "支付宝",
  262 + "payment_type": 1,
  263 + "payment_type_name": "在线支付(推荐)",
  264 + "is_support_message":""
  265 + }, {
  266 + "default": "N",
  267 + "is_support": "Y",
  268 + "payment_id": 0,
  269 + "payment_name": "货到付款",
  270 + "payment_type": 2,
  271 + "payment_type_name": "货到付款",
  272 + "is_support_message":"送货上门后再付款"
  273 + }],
  274 + "promo_code_enabled": 0,
  275 + "shopping_cart_data": {
  276 + "discount_amount": 0,
  277 + "fast_shopping_cost": 15,
  278 + "gain_yoho_coin": 0,
  279 + "goods_count": 1,
  280 + "instalment": {//不支持或者用户没有选择分期时,不返回
  281 + "is_support": "Y",//是否支持
  282 + "plan_amount_per": 326.66,//每期应还金额
  283 + "plan_amount_per_name": "分3期(¥326.66*3)",
  284 + "plan_int_amount_per_name": "免手续费",
  285 + "term": 3 //期数
  286 + },
  287 + "last_order_amount": 178,
  288 + "order_amount": 168,
  289 + "promotion_formula": "总计¥178.00=商品金额¥168.00+运费¥10.00",
  290 + "promotion_formula_list": [{
  291 + "promotion": "商品金额",
  292 + "promotion_amount": "¥168.00"
  293 + }, {
  294 + "promotion": "运费",
  295 + "promotion_amount": "+¥10.00"
  296 + }],
  297 + "selected_goods_count": 1,
  298 + "shipping_cost": 10,
  299 + "str_discount_amount": "¥0.00",
  300 + "str_order_amount": "¥168.00"
  301 + },
  302 + "shopping_cart_tag": "3613572d1571f9cf448e3dacb8ec4c37",
  303 + "uid": 10921691,
  304 + "use_yoho_coin": 0,
  305 + "yoho_coin": 0
  306 + },
  307 + "md5": "3c89d2af5917a0f12070df8281b39fe8",
  308 + "message": "payment data."
  309 +}
  310 +```
  311 +## 4、立即购买compute接口 ##
  312 +#### 说明
  313 +购物车结算(app.Buynow.compute)
  314 +#### 请求参数
  315 +| 参数名称 | 参数类型 | 可否为空 | 示例 | 默认值 | 备注 |
  316 +|:-------| -----:|-----:|-----:|-----:|----:|
  317 +|uid|int|否|3236556|0|用户id|
  318 +|product_sku|int|否|1|1|sku|
  319 +|sku_type|string|否|I|“”|I 分期|
  320 +|buy_number|int|否|1|1|购买数量|
  321 +|yoho_coin_mode|int|是|1|1|是否使用yoho币,1使用,0不使用|
  322 +|payment_type|int|否|1|1|支付方式,1 在线支付 2 货到付款|
  323 +|delivery_way|int|否|1|1|快递方式,1 普通 2 加急|
  324 +|use_yoho_coin|double|是|1.00||使用的yoho币金额,单位元|
  325 +|use_red_envelopes|double|是|1.00||使用的红包,单位元|
  326 +|coupon_code|string|是|b123456||优惠券code|
  327 +|promotion_code|string|是|1345abc||优惠码code|
  328 +|yoho_bill_term|int|是|0||30天不分期 - 1 分期:3、6、9、12;0,不使用|
  329 +|client_type|string|否|web|iphone|终端|
  330 +
  331 +### 响应
  332 +POST
  333 +code为200即为成功,否则是失败。
  334 +响应JSON格式如下所示:
  335 +
  336 +```json
  337 +{
  338 + "alg": "SALT_MD5",
  339 + "code": 200,
  340 + "data": {
  341 + "coupon_amount": 0,
  342 + "delivery_way": [{
  343 + "default": "Y",
  344 + "delivery_way_cost": 0,
  345 + "delivery_way_id": 1,
  346 + "delivery_way_name": "普通快递",
  347 + "is_delivery": "Y",
  348 + "is_support": "Y"
  349 + }, {
  350 + "default": "N",
  351 + "delivery_way_cost": 5,
  352 + "delivery_way_id": 2,
  353 + "delivery_way_name": "顺丰速运",
  354 + "is_delivery": "Y",
  355 + "is_support": "Y"
  356 + }],
  357 + "discount_amount": 0,
  358 + "fast_shopping_cost": 5,
  359 + "gain_yoho_coin": 0,
  360 + "goods_count": 4,
  361 + "last_order_amount": 340,
  362 + "order_amount": 335,
  363 + "payment_way": [{
  364 + "default": "Y",
  365 + "is_support": "Y",
  366 + "is_support_message": "",
  367 + "payment_id": 15,
  368 + "payment_name": "支付宝",
  369 + "payment_type": 1,
  370 + "payment_type_name": "在线支付(推荐)"
  371 + }, {
  372 + "default": "N",
  373 + "is_support": "Y",
  374 + "is_support_message": "送货上门后再付款",
  375 + "payment_id": 0,
  376 + "payment_name": "货到付款",
  377 + "payment_type": 2,
  378 + "payment_type_name": "货到付款"
  379 + }],
  380 + "promotion_formula": "总计¥340.00=商品金额¥335.00+运费¥5.00",
  381 + "promotion_formula_list": [{
  382 + "promotion": "商品金额",
  383 + "promotion_amount": "¥335.00"
  384 + }, {
  385 + "promotion": "运费",
  386 + "promotion_amount": "+¥5.00"
  387 + }],
  388 + "selected_goods_count": 2,
  389 + "shipping_cost": 0,
  390 + "str_discount_amount": "¥0.00",
  391 + "str_order_amount": "¥335.00",
  392 + "use_red_envelopes": 0,
  393 + "use_yoho_coin": 0,
  394 + "instalment": {//不支持或者用户没有选择分期时,不返回
  395 + "is_support": "Y",//是否支持
  396 + "plan_amount_per": 326.66,//每期应还金额
  397 + "plan_amount_per_name": "分3期(¥326.66*3)",
  398 + "plan_int_amount_per_name": "免手续费",
  399 + "term": 3 //期数
  400 + },
  401 + "is_multi_package":"Y",
  402 + "package_list":[{
  403 + "supplier_id":"0",
  404 + "goods_list":[{
  405 + "buy_number": "1",
  406 + "goods_images": "http://img11.static.yhbimg.com/goodsimg/2015/12/23/07/0115f6f0e2ca345d2b413396202f97c8b5.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
  407 + "goods_type": "ordinary",
  408 + "product_id": 329795,
  409 + "product_name": "Blackbird 黑鸟锥形香-Ai香型",
  410 + "product_skc": "320280",
  411 + "product_skn": "51184595",
  412 + "product_sku": "1003938"
  413 + }],
  414 + "shopping_cost":3,
  415 + "shopping_cut_cost": 7,
  416 + "shopping_orig_cost:10
  417 + },
  418 + {
  419 + "supplier_id":"23",
  420 + "goods_list":[{
  421 + "buy_number": "1",
  422 + "goods_images": "http://img11.static.yhbimg.com/goodsimg/2015/12/23/07/0115f6f0e2ca345d2b413396202f97c8b5.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80",
  423 + "goods_type": "gift",
  424 + "product_id": 329795,
  425 + "product_name": "Blackbird 黑鸟锥形香-Ai香型",
  426 + "product_skc": "320280",
  427 + "product_skn": "51184595",
  428 + "product_sku": "1003938"
  429 + }],
  430 + "shopping_cost":3,
  431 + "shopping_cut_cost": 7,
  432 + "shopping_orig_cost:10
  433 + }]
  434 + },
  435 + "md5": "c743135bb9ee4afe3c522c59e64604ea",
  436 + "message": "compute list."
  437 +}
  438 +```
  439 +
  440 +
  441 +## 8、立即购买提交接口 ##
  442 +#### 说明
  443 +购物车提交订单(app.Buynow.submit)
  444 +#### 请求参数
  445 +| 参数名称 | 参数类型 | 可否为空 | 示例 | 默认值 | 备注 |
  446 +|:-------| -----:|-----:|-----:|-----:|----:|
  447 +|uid|int|否|3236556|0|用户id|
  448 +|product_sku|int|否|1|1|sku|
  449 +|sku_type|string|否|I|“”|I 分期|
  450 +|buy_number|int|否|1|1|购买数量|
  451 +|yoho_bill_term|int|是|0||30天不分期 - 1 分期:3、6、9、12;0,不使用|
  452 +|address_id|int|否|5816006||送货地址id|
  453 +|delivery_time|int|否|2||寄送时间类型|
  454 +|delivery_way|int|否|1||发货方式(1:普通,2顺丰)|
  455 +|invoices_title|string|是|""|""|发票抬头|
  456 +|invoices_type_id|int|是|""|""|发票类型|
  457 +|use_yoho_coin|double|是|1.00||使用的yoho币金额,单位元|
  458 +|use_red_envelopes|double|是|1.00||使用的红包,单位元|
  459 +|payment_id|int|否|15||支付id|
  460 +|payment_type|int|否|1||支付类型|
  461 +|remark|string|是|""|""|备注|
  462 +|coupon_code|string|是|""|""|优惠券码|
  463 +|promotion_code|string|是|1345abc||优惠码code|
  464 +|client_type|string|否|web|iphone|终端|
  465 +
  466 +### 响应
  467 +POST
  468 +code为200即为成功,否则是失败。
  469 +响应JSON格式如下所示:
  470 +```json
  471 +{
  472 + "alg": "SALT_MD5",
  473 + "code": 200,
  474 + "data": {
  475 + "create_time": "2016-07-14 15:57:48",//订单创建时间
  476 + "order_amount": 1965,//订单金额
  477 + "order_code": 1613291832,//订单号
  478 + "pay_expire": "2016-07-14 17:57:48",//支付失效时间
  479 + "payment_status": 0//0 未支付,1已支付,只有0元订单才为1
  480 + },
  481 + "md5": "62723a6f81151e880b04a8480df4d2f9",
  482 + "message": "submit order ."
  483 +}
  484 +```
  485 +
  486 +## 9、使用优惠券 ##
  487 +#### 说明
  488 +使用优惠券(app.Buynow.useCoupon)
  489 +#### 请求参数
  490 +| 参数名称 | 参数类型 | 可否为空 | 示例 | 默认值 | 备注 |
  491 +|:-------| -----:|-----:|-----:|-----:|----:|
  492 +|uid|int|否|3236556|0|用户id|
  493 +|product_sku|int|否|1|1|sku|
  494 +|sku_type|string|否|I 分期|“”|sku类型|
  495 +|buy_number|int|否|1|1|购买数量|
  496 +|coupon_code|string|是|""|""|优惠券|
  497 +|client_type|string|否|web|iphone|终端|
  498 +
  499 +### 请求示例
  500 +POST http://192.168.102.205:8080/gateway?method=app.Buynow.useCoupon
  501 +
  502 +### 响应
  503 +code为200即为成功,否则是失败。
  504 +响应JSON格式如下所示:
  505 +
  506 +```json
  507 +{
  508 + "alg": "SALT_MD5",
  509 + "code": 200,
  510 + "data": {
  511 + "coupon_amount": 10,
  512 + "coupon_code": "aob9p9r204j9qz",
  513 + "coupon_title": "10元现金券",
  514 + "uid": 10921691
  515 + },
  516 + "md5": "47eb4073ca797fd7dc5968de7a20bda2",
  517 + "message": "use coupon code."
  518 +}
  519 +```
  520 +
  521 +## 10、使用优惠码 ##
  522 +#### 说明
  523 +使用优惠码(app.Buynow.usePromotionCode)
  524 +#### 请求参数
  525 +| 参数名称 | 参数类型 | 可否为空 | 示例 | 默认值 | 备注 |
  526 +|:-------| -----:|-----:|-----:|-----:|----:|
  527 +|uid|int|否|3236556|0|用户id|
  528 +|product_sku|int|否|1|1|sku|
  529 +|sku_type|string|否|I 分期|“”|sku类型|
  530 +|buy_number|int|否|1|1|购买数量|
  531 +|promotion_code|string|是|""|""|优惠码|
  532 +|client_type|string|否|web|iphone|终端|
  533 +
  534 +### 请求示例
  535 +POST http://192.168.102.205:8080/gateway?method=app.Buynow.usePromotionCode
  536 +
  537 +### 响应
  538 +code为200即为成功,否则是失败。
  539 +响应JSON格式如下所示:
  540 +
  541 +```json
  542 +{
  543 + "alg": "SALT_MD5",
  544 + "code": 200,
  545 + "data": {
  546 + "id": 10,
  547 + "name": "aob9p9r204j9qz",//优惠码名称
  548 + "code": "1111",//优惠码code
  549 + "limit_times": 1,
  550 + "discount_type": "2",
  551 + "amount_at_least": "aob9p9r204j9qz",
  552 + "count_at_least": "1111",
  553 + "discount": 1,
  554 + "discount_at_most":111,
  555 + "status":1
  556 + },
  557 + "md5": "47eb4073ca797fd7dc5968de7a20bda2",
  558 + "message": "use promotion code."
  559 +}
  560 +```