根据openid导入用户会员卡
对于经营会员生意的商户来说,存量会员的注册渠道广泛,包括但不限于线下渠道、微信渠道、APP及其他线上渠道。因而,在微信生态下经营会员时常遇到两类问题:(1)存量会员的身份难统一识别;(2)在应用「开卡有礼」活动能力时,容易对存量(但未同步身份至微信侧的)老会员重复补贴。因而,针对大部分存量会员在微信内的商户,商户可通过用户在微信公众号/小程序内的openid,将存量会员通过接口导入至微信侧后台。
请求参数 | 类型 | 描述 |
---|---|---|
card_id | string | 会员卡ID |
json | object | 声明请求的JSON 数据结构 |
openid | string | 用户标识 |
code | string | 会员卡code |
out_request_no | string | 商户请求单号 |
php
$instance->v3->marketing->membercardOpen->cards->_card_id_->users->import->postAsync([
'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
'json' => [
'openid' => 'obLatjnx9gnqzS4myYGmLZ7LgLBA',
'code' => '478515832665',
'out_request_no' => '100002322019090134234sfdf',
],
])
->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}/users/import')->postAsync([
'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
'json' => [
'openid' => 'obLatjnx9gnqzS4myYGmLZ7LgLBA',
'code' => '478515832665',
'out_request_no' => '100002322019090134234sfdf',
],
])
->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}/users/import']->postAsync([
'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
'json' => [
'openid' => 'obLatjnx9gnqzS4myYGmLZ7LgLBA',
'code' => '478515832665',
'out_request_no' => '100002322019090134234sfdf',
],
])
->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_->users->import->post([
'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
'json' => [
'openid' => 'obLatjnx9gnqzS4myYGmLZ7LgLBA',
'code' => '478515832665',
'out_request_no' => '100002322019090134234sfdf',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/marketing/membercard-open/cards/{card_id}/users/import')->post([
'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
'json' => [
'openid' => 'obLatjnx9gnqzS4myYGmLZ7LgLBA',
'code' => '478515832665',
'out_request_no' => '100002322019090134234sfdf',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/marketing/membercard-open/cards/{card_id}/users/import']->post([
'card_id' => 'pbLatjvWOibDc5-TBnbUk1pD12o0',
'json' => [
'openid' => 'obLatjnx9gnqzS4myYGmLZ7LgLBA',
'code' => '478515832665',
'out_request_no' => '100002322019090134234sfdf',
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
code | string | 会员卡code |
参阅 官方文档