Skip to content

商户预授权

生成商户预授权投放会员卡的凭证

请求参数类型描述
card_idstring会员卡模板id
jsonobject声明请求的JSON数据结构
activate_typestring激活类型
navigate_back_previous_pageboolean设置用户在开卡完成后,是否返回拉起开卡组件的商家页面
activate_urlstring跳转激活的url
activate_appidstring跳转激活的appid
activate_pathstring跳转激活的path
outer_strstring自定义场景值
php
$instance->v3->marketing->membercardOpen->cards->_card_id_->permissionTokens->postAsync([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'json' => [
    'activate_type'               => 'AUTO_ACTIVATE',
    'navigate_back_previous_page' => true,
    'activate_url'                => 'https://w.url.cn/s/Ahz3p2C',
    'activate_appid'              => 'wxea9c30a90fs8d3fe',
    'activate_path'               => 'pages/activate/activate',
    'outer_str'                   => 'szwxtd',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/marketing/membercard-open/cards/{card_id}/permission-tokens')->postAsync([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'json' => [
    'activate_type'               => 'AUTO_ACTIVATE',
    'navigate_back_previous_page' => true,
    'activate_url'                => 'https://w.url.cn/s/Ahz3p2C',
    'activate_appid'              => 'wxea9c30a90fs8d3fe',
    'activate_path'               => 'pages/activate/activate',
    'outer_str'                   => 'szwxtd',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/marketing/membercard-open/cards/{card_id}/permission-tokens']->postAsync([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'json' => [
    'activate_type'               => 'AUTO_ACTIVATE',
    'navigate_back_previous_page' => true,
    'activate_url'                => 'https://w.url.cn/s/Ahz3p2C',
    'activate_appid'              => 'wxea9c30a90fs8d3fe',
    'activate_path'               => 'pages/activate/activate',
    'outer_str'                   => 'szwxtd',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->marketing->membercardOpen->cards->_card_id_->permissionTokens->post([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'json' => [
    'activate_type'               => 'AUTO_ACTIVATE',
    'navigate_back_previous_page' => true,
    'activate_url'                => 'https://w.url.cn/s/Ahz3p2C',
    'activate_appid'              => 'wxea9c30a90fs8d3fe',
    'activate_path'               => 'pages/activate/activate',
    'outer_str'                   => 'szwxtd',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/marketing/membercard-open/cards/{card_id}/permission-tokens')->post([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'json' => [
    'activate_type'               => 'AUTO_ACTIVATE',
    'navigate_back_previous_page' => true,
    'activate_url'                => 'https://w.url.cn/s/Ahz3p2C',
    'activate_appid'              => 'wxea9c30a90fs8d3fe',
    'activate_path'               => 'pages/activate/activate',
    'outer_str'                   => 'szwxtd',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/marketing/membercard-open/cards/{card_id}/permission-tokens']->post([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'json' => [
    'activate_type'               => 'AUTO_ACTIVATE',
    'navigate_back_previous_page' => true,
    'activate_url'                => 'https://w.url.cn/s/Ahz3p2C',
    'activate_appid'              => 'wxea9c30a90fs8d3fe',
    'activate_path'               => 'pages/activate/activate',
    'outer_str'                   => 'szwxtd',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
permission_tokenstring预授权token

参阅 官方文档

Published on the GitHub by TheNorthMemory