Skip to content

出行券切卡组件预下单

商户在拉起快捷切卡小程序前,需要先调用本接口预下单,下单成功后,通过返回的token拉起小程序,本接口的调用商户需要和拉起组件传入的调用商户是同一个。

请求参数类型描述
jsonobject声明请求的JSON数据结构
open_idstring用户标识
coupon_listobject[]出行券列表
stock_idinteger批次号
coupon_idstring券ID
php
$instance->v3->industryCoupon->tokens->postAsync([
  'json' => [
    'open_id' => 'obLatjrR8kUDlj4-nofQsPAJAAFI',
    'coupon_list' => [[
      'stock_id' => 16474341,
      'coupon_id' => '11004999626',
    ],],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/industry-coupon/tokens')->postAsync([
  'json' => [
    'open_id' => 'obLatjrR8kUDlj4-nofQsPAJAAFI',
    'coupon_list' => [[
      'stock_id' => 16474341,
      'coupon_id' => '11004999626',
    ],],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/industry-coupon/tokens']->postAsync([
  'json' => [
    'open_id' => 'obLatjrR8kUDlj4-nofQsPAJAAFI',
    'coupon_list' => [[
      'stock_id' => 16474341,
      'coupon_id' => '11004999626',
    ],],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->industryCoupon->tokens->post([
  'json' => [
    'open_id' => 'obLatjrR8kUDlj4-nofQsPAJAAFI',
    'coupon_list' => [[
      'stock_id' => 16474341,
      'coupon_id' => '11004999626',
    ],],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/industry-coupon/tokens')->post([
  'json' => [
    'open_id' => 'obLatjrR8kUDlj4-nofQsPAJAAFI',
    'coupon_list' => [[
      'stock_id' => 16474341,
      'coupon_id' => '11004999626',
    ],],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/industry-coupon/tokens']->post([
  'json' => [
    'open_id' => 'obLatjrR8kUDlj4-nofQsPAJAAFI',
    'coupon_list' => [[
      'stock_id' => 16474341,
      'coupon_id' => '11004999626',
    ],],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
tokenstring切卡组件token值
expires_timestringtoken过期时间

参阅 官方文档

Published on the GitHub by TheNorthMemory