Skip to content

预开通服务

商户通过该接口获取preopenid,跳转到签约小程序后,用preopenid进行签约开通,本接口用于开通自动扣费前上传必要的信息。

🚫

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

请求参数类型描述
jsonobject声明请求的JSON数据结构
sub_mchidstring特约商户号
appidstring服务商公众号ID
sub_appidstring特约商户公众号ID
trade_scenestring交易场景
openidstring用户标识
php
$instance->v3->ebike->charge->contracts->preopen->postAsync([
  'json' => [
    'sub_mchid'   => '1510770601',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'trade_scene' => 'CHARGE',
    'openid'      => 'ot35_4gNgXsUuh2sQY0lT9N08AU0',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/ebike/charge/contracts/preopen')->postAsync([
  'json' => [
    'sub_mchid'   => '1510770601',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'trade_scene' => 'CHARGE',
    'openid'      => 'ot35_4gNgXsUuh2sQY0lT9N08AU0',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/ebike/charge/contracts/preopen']->postAsync([
  'json' => [
    'sub_mchid'   => '1510770601',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'trade_scene' => 'CHARGE',
    'openid'      => 'ot35_4gNgXsUuh2sQY0lT9N08AU0',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->ebike->charge->contracts->preopen->post([
  'json' => [
    'sub_mchid'   => '1510770601',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'trade_scene' => 'CHARGE',
    'openid'      => 'ot35_4gNgXsUuh2sQY0lT9N08AU0',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/ebike/charge/contracts/preopen')->post([
  'json' => [
    'sub_mchid'   => '1510770601',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'trade_scene' => 'CHARGE',
    'openid'      => 'ot35_4gNgXsUuh2sQY0lT9N08AU0',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/ebike/charge/contracts/preopen']->post([
  'json' => [
    'sub_mchid'   => '1510770601',
    'appid'       => 'wx47c677487ce3ac47',
    'sub_appid'   => 'wxcc603d9f0d54eaf0',
    'trade_scene' => 'CHARGE',
    'openid'      => 'ot35_4gNgXsUuh2sQY0lT9N08AU0',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
preopen_idstring预开通ID

参阅 官方文档

Published on the GitHub by TheNorthMemory