Skip to content

创建用户当次充电代扣凭证

商户通过该接口,得到用户当次充电的代扣凭证,使用该凭证进行扣款校验操作,该接口也会触发对用户发送的确认开始充电的通知。

🚫

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

请求参数类型描述
contract_idstring充电授权扣费协议号
jsonobject声明请求的JSON数据结构
sub_mchidstring特约商户号
appidstring服务商公众号ID
sub_appidstring特约商户公众号ID
charge_infoobject充电场景信息
start_timestring开始时间
charging_station_namestring充电站名称
charging_gun_numberstring充电枪编号
device_idstring充电位设备号
php
$instance->v3->ebike->charge->contracts->_contract_id_->confirm->postAsync([
  'contract_id' => 'aAfixCs13LsdKPpfZfDkk2189ssXjfx',
  'json' => [
    'sub_mchid'   => '1900000109',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'charge_info' => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'device_id'             => '12343232',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/ebike/charge/contracts/{contract_id}/confirm')->postAsync([
  'contract_id' => 'aAfixCs13LsdKPpfZfDkk2189ssXjfx',
  'json' => [
    'sub_mchid'   => '1900000109',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'charge_info' => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'device_id'             => '12343232',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/ebike/charge/contracts/{contract_id}/confirm']->postAsync([
  'contract_id' => 'aAfixCs13LsdKPpfZfDkk2189ssXjfx',
  'json' => [
    'sub_mchid'   => '1900000109',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'charge_info' => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'device_id'             => '12343232',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->ebike->charge->contracts->_contract_id_->confirm->post([
  'contract_id' => 'aAfixCs13LsdKPpfZfDkk2189ssXjfx',
  'json' => [
    'sub_mchid'   => '1900000109',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'charge_info' => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'device_id'             => '12343232',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/ebike/charge/contracts/{contract_id}/confirm')->post([
  'contract_id' => 'aAfixCs13LsdKPpfZfDkk2189ssXjfx',
  'json' => [
    'sub_mchid'   => '1900000109',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'charge_info' => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'device_id'             => '12343232',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/ebike/charge/contracts/{contract_id}/confirm']->post([
  'contract_id' => 'aAfixCs13LsdKPpfZfDkk2189ssXjfx',
  'json' => [
    'sub_mchid'   => '1900000109',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'charge_info' => [
      'start_time'            => '2017-08-26T09:43:39+08:00',
      'charging_station_name' => 'xxx充电站',
      'charging_gun_number'   => '6555',
      'device_id'             => '12343232',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
charging_tokenstring用户充电代扣凭证

参阅 官方文档

Published on the GitHub by TheNorthMemory