Skip to content

充电自行车代扣受理扣款

通过调用该接口,为用户当次充电完成后发起代扣扣款,并同步返回受理结果。支付结果以回调通知为准,若返回超时,则主动查单。

🚫

本接口服务已于 2019.12.16 (北京时间)下线,文档仅做留存参考。

请求参数类型描述
jsonobject声明请求的JSON数据结构
sub_mchidstring特约商户号
appidstring服务商公众号ID
sub_appidstring特约商户公众号ID
out_trade_nostring商户订单号
attachstring附加字段
goods_tagstring营销信息
notify_urlstring通知url
descriptionstring商品描述
charging_tokenstring用户充电代扣凭证
amountobject订单金额信息
totalinteger订单总金额
currencystring货币类型
charge_infoobject充电自行车场景信息
start_timestring开始时间
end_timestring结束时间
charging_station_namestring充电站名称
charging_gun_numberstring充电枪编号
charged_capacityinteger已充电量
park_durationinteger车位延时占用时长
park_feeinteger车位延时占用产生的费用
device_infoobject设备信息
device_idstring充电位设备号
device_ipstring商户端设备ip
php
$instance->v3->ebike->charge->transactions->postAsync([
  'json' => [
    'sub_mchid'      => '1900000109',
    'appid'          => 'wxd678efh567hg678',
    'sub_appid'      => 'wxd678efh567hg6999',
    'out_trade_no'   => '121775250124070332',
    'attach'         => '自定义数据',
    'goods_tag'      => 'test',
    'notify_url'     => 'http://1111:111/metro-spt-api/callback',
    'description'    => '商品信息',
    'charging_token' => 'sdjf23kdsHJfdk',
    'amount'         => [
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'charge_info'    => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'end_time'              => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'charged_capacity'      => 10,
      'park_duration'         => 60,
      'park_fee'              => 100,
    ],
    'device_info'    => [
      'device_id' => '12343232',
      'device_ip' => '123.12.12.123',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/ebike/charge/transactions')->postAsync([
  'json' => [
    'sub_mchid'      => '1900000109',
    'appid'          => 'wxd678efh567hg678',
    'sub_appid'      => 'wxd678efh567hg6999',
    'out_trade_no'   => '121775250124070332',
    'attach'         => '自定义数据',
    'goods_tag'      => 'test',
    'notify_url'     => 'http://1111:111/metro-spt-api/callback',
    'description'    => '商品信息',
    'charging_token' => 'sdjf23kdsHJfdk',
    'amount'         => [
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'charge_info'    => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'end_time'              => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'charged_capacity'      => 10,
      'park_duration'         => 60,
      'park_fee'              => 100,
    ],
    'device_info'    => [
      'device_id' => '12343232',
      'device_ip' => '123.12.12.123',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/ebike/charge/transactions']->postAsync([
  'json' => [
    'sub_mchid'      => '1900000109',
    'appid'          => 'wxd678efh567hg678',
    'sub_appid'      => 'wxd678efh567hg6999',
    'out_trade_no'   => '121775250124070332',
    'attach'         => '自定义数据',
    'goods_tag'      => 'test',
    'notify_url'     => 'http://1111:111/metro-spt-api/callback',
    'description'    => '商品信息',
    'charging_token' => 'sdjf23kdsHJfdk',
    'amount'         => [
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'charge_info'    => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'end_time'              => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'charged_capacity'      => 10,
      'park_duration'         => 60,
      'park_fee'              => 100,
    ],
    'device_info'    => [
      'device_id' => '12343232',
      'device_ip' => '123.12.12.123',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->ebike->charge->transactions->post([
  'json' => [
    'sub_mchid'      => '1900000109',
    'appid'          => 'wxd678efh567hg678',
    'sub_appid'      => 'wxd678efh567hg6999',
    'out_trade_no'   => '121775250124070332',
    'attach'         => '自定义数据',
    'goods_tag'      => 'test',
    'notify_url'     => 'http://1111:111/metro-spt-api/callback',
    'description'    => '商品信息',
    'charging_token' => 'sdjf23kdsHJfdk',
    'amount'         => [
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'charge_info'    => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'end_time'              => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'charged_capacity'      => 10,
      'park_duration'         => 60,
      'park_fee'              => 100,
    ],
    'device_info'    => [
      'device_id' => '12343232',
      'device_ip' => '123.12.12.123',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/ebike/charge/transactions')->post([
  'json' => [
    'sub_mchid'      => '1900000109',
    'appid'          => 'wxd678efh567hg678',
    'sub_appid'      => 'wxd678efh567hg6999',
    'out_trade_no'   => '121775250124070332',
    'attach'         => '自定义数据',
    'goods_tag'      => 'test',
    'notify_url'     => 'http://1111:111/metro-spt-api/callback',
    'description'    => '商品信息',
    'charging_token' => 'sdjf23kdsHJfdk',
    'amount'         => [
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'charge_info'    => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'end_time'              => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'charged_capacity'      => 10,
      'park_duration'         => 60,
      'park_fee'              => 100,
    ],
    'device_info'    => [
      'device_id' => '12343232',
      'device_ip' => '123.12.12.123',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/ebike/charge/transactions']->post([
  'json' => [
    'sub_mchid'      => '1900000109',
    'appid'          => 'wxd678efh567hg678',
    'sub_appid'      => 'wxd678efh567hg6999',
    'out_trade_no'   => '121775250124070332',
    'attach'         => '自定义数据',
    'goods_tag'      => 'test',
    'notify_url'     => 'http://1111:111/metro-spt-api/callback',
    'description'    => '商品信息',
    'charging_token' => 'sdjf23kdsHJfdk',
    'amount'         => [
      'total'    => 888,
      'currency' => 'CNY',
    ],
    'charge_info'    => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'end_time'              => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'charged_capacity'      => 10,
      'park_duration'         => 60,
      'park_fee'              => 100,
    ],
    'device_info'    => [
      'device_id' => '12343232',
      'device_ip' => '123.12.12.123',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
accept_statestring受理状态
create_timestring订单创建时间

参阅 官方文档

Published on the GitHub by TheNorthMemory