Skip to content

加密code解码(跳转型激活)

如果商家选择跳转激活的投放方式,用户点击开卡跳转至商家H5网页/小程序时,会员组件会在跳转链接activate_url后拼接若干个参数,包括:用户的openid、加密的会员code(encrypt_code)、激活ticket(activate_ticket)。对于加密的encrypt_code,商家可调用此api解码接口,获取真实code。

请求参数类型描述
card_idstring会员卡id
queryobject声明请求的查询参数
encrypt_codestring加密code
php
$instance->v3->marketing->membercardOpen->cards->_card_id_->decryptCode->getAsync([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'query' => [
    'encrypt_code' => 'XXIzTtMqCxwOaawoE91+VJdsFmv7b8g0VZIZkqf4GWA60Fzpc8ksZ/5ZZ0DVkXdE',
  ],
])
->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}/decrypt-code')->getAsync([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'query' => [
    'encrypt_code' => 'XXIzTtMqCxwOaawoE91+VJdsFmv7b8g0VZIZkqf4GWA60Fzpc8ksZ/5ZZ0DVkXdE',
  ],
])
->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}/decrypt-code']->getAsync([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'query' => [
    'encrypt_code' => 'XXIzTtMqCxwOaawoE91+VJdsFmv7b8g0VZIZkqf4GWA60Fzpc8ksZ/5ZZ0DVkXdE',
  ],
])
->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_->decryptCode->get([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'query' => [
    'encrypt_code' => 'XXIzTtMqCxwOaawoE91+VJdsFmv7b8g0VZIZkqf4GWA60Fzpc8ksZ/5ZZ0DVkXdE',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/marketing/membercard-open/cards/{card_id}/decrypt-code')->get([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'query' => [
    'encrypt_code' => 'XXIzTtMqCxwOaawoE91+VJdsFmv7b8g0VZIZkqf4GWA60Fzpc8ksZ/5ZZ0DVkXdE',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/marketing/membercard-open/cards/{card_id}/decrypt-code']->get([
  'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
  'query' => [
    'encrypt_code' => 'XXIzTtMqCxwOaawoE91+VJdsFmv7b8g0VZIZkqf4GWA60Fzpc8ksZ/5ZZ0DVkXdE',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
codestring会员卡code

参阅 官方文档

Published on the GitHub by TheNorthMemory