Member Card Upgrade Announcement

From May 15, 2016, the WeChat Card Voucher Team has upgraded its membership card capabilities.The following capabilities are upgraded on top of the existing capabilities to help merchants better manage their memberships.

  • Strengthen the client-side portal at the first level: members can be used at the store immediately, and merchant loyalty cards can be quickly located;

  • Custom card screen capabilities: developers can set different card screen backgrounds depending on membership status;

  • Store barcode scanning scheme: new users come to the store to collect the card with a barcode, and older users come to store to quickly open the member card, enabling a variety of functions such as ordering food and paying bills.

  • Payment as a member: support developers to set WeChat to send a card collection message to users after payment, and customers can pay as members and quickly attract new customers;

  • Operational strategy adjustment: new open category restrictions on membership cards. As of April 20, only merchants within the membership card category will be able to create new membership accounts. Existing membership tickets will not be affected. For more details, see: Membership Card Announcement

catalog

1. Introduction to the new membership card

2. key information

3. Membership Card Game Overview

4. Create membership card interface details

4.1 Create membership card interface

4.2 Get the results of the membership card audit

4.3 Setting up a test whitelist interface

5. Place a membership card

5.1 Create QR codes

5.2 In-Web page single / bulk voucher interface

5.3 Delivery via voucher shelf interface

5.4 Service Account Message Delivery Card

5.5 Recording user card behaviour

5.6 Statistical distribution channel data

6. Activate a membership card

6. 1 Interface Activation

6.2 One-click activation

6.3 Automatic activation

7. Update member information

# 1. Introduction to the new membership card

On the basis of the original ability, WeChat Card Voucher team will add custom card face,The capabilities such as store barcode scanning schemes, post-payment template messages, group messaging by member label, and voucher messaging capabilities have also been upgraded to help merchants better manage their members.

  • (a) Adding custom backgrounds that developers can set;

  • (b) Voucher message upgrades, points / balance changes are automatically sent via template messages, carrying marketing information.

(a) (b)

# 2. key information

Please read the front page before reading this section Start Development]] and WeChat Instructions for the Coupon Interface]] Make sure you understand the basic terms and invocations of the public platform and the coupons interface.

Generally, the order in which the interface is invoked for a member card can be referred to the following process:

# 3. Membership Card Game Overview

Store barcode scanning program Pay for membership cards quickly Connect with CRM

Membership card connects to payment system Older members are tied up Member Card Opens Storage Value

Card open component

Card Voucher - Weixin Mini Program

# 4. Create membership card interface details

# 4.1 Create a member card interface

Support developers to call this interface to create a membership card, and get card_id, for delivery.Before calling this interface, ask the developer to read in detail the Create Card Interface section Upload Image Interface and Home Page to quickly enter the necessary information for the member card face.

Dxplaination of Interface Call Request

HTTP request mode: POST URL: https://api.weixin.qq.com/card/create?access_token=ACCESS_TOKEN

Parameter explaination

parameter Do I have to? Introductions
access_token yes Call Interface Credentials
POST data yes JSON structure

Examples of POST data:

{
    "card": {
        "card_type": "MEMBER_CARD",
        "member_card": {
            "background_pic_url": "https://mmbiz.qlogo.cn/mmbiz/",
            "base_info": {
                "logo_url": "http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZ/0",
                "brand_name": "海底捞",
                "code_type": "CODE_TYPE_TEXT",
                "title": "海底捞会员卡",
                "color": "Color010",
                "notice": "使用时向服务员出示此券",
                "service_phone": "020-88888888",
                "description": "不可与其他优惠同享",
                "date_info": {
                    "type": "DATE_TYPE_PERMANENT"
                },
                "sku": {
                    "quantity": 50000000
                },
                "get_limit": 3,
                "use_custom_code": false,
                "can_give_friend": true,
                "location_id_list": [
                    123,
                    12321
                ],
                "custom_url_name": "立即使用",
                "custom_url": "http://weixin.qq.com",
                "custom_url_sub_title": "6个汉字tips",
                "promotion_url_name": "营销入口1",
                "promotion_url": "http://www.qq.com",
                "need_push_on_view": true
            },
             "advanced_info": {
               "use_condition": {
                   "accept_category": "鞋类",
                   "reject_category": "阿迪达斯",
                   "can_use_with_other_discount": true
               },
             "abstract": {
                   "abstract": "微信餐厅推出多种新季菜品,期待您的光临",
                   "icon_url_list": [
                       "http://mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sj
  piby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0"
                   ]
               },
               "text_image_list": [
                   {
                       "image_url": "http://mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sjpiby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0",
                       "text": "此菜品精选食材,以独特的烹饪方法,最大程度地刺激食 客的味蕾"
                   },
                   {
                       "image_url": "http://mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sj piby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0",
                       "text": "此菜品迎合大众口味,老少皆宜,营养均衡"
                   }
               ],
               "time_limit": [
                   {
                       "type": "MONDAY",
                       "begin_hour":0,
                       "end_hour":10,
                       "begin_minute":10,
                       "end_minute":59
                   },
                   {
                       "type": "HOLIDAY"
                   }
               ],
               "business_service": [
                   "BIZ_SERVICE_FREE_WIFI",
                   "BIZ_SERVICE_WITH_PET",
                   "BIZ_SERVICE_FREE_PARK",
                   "BIZ_SERVICE_DELIVER"
               ]
           },
            "supply_bonus": true,
            "supply_balance": false,
            "prerogative": "test_prerogative",
            "auto_activate": true,
            "custom_field1": {
                "name_type": "FIELD_NAME_TYPE_LEVEL",
                "url": "http://www.qq.com"
            },
            "activate_url": "http://www.qq.com",
            "custom_cell1": {
                "name": "使用入口2",
                "tips": "激活后显示",
                "url": "http://www.qq.com"
            },
            "bonus_rule": {
                "cost_money_unit": 100,
                "increase_bonus": 1,
                "max_increase_bonus": 200,
                "init_increase_bonus": 10,
                "cost_bonus_unit": 5,
                "reduce_money": 100,
                "least_money_to_use_bonus": 1000,
                "max_reduce_bonus": 50
            },
            "discount": 10
        }
    }
}

Interface fields correspond to tables

Parameter explaination

Parameter Name Required Type Description
card_type is string member card type。
background_ pic_ur l No string (128) Merchant customizes the logo for the card. You must first call the upload image interface to upload the logo to the CDN, otherwise you will report an error. Card surface design Please follow the WeChat custom logo design specification for the card, with pixel size controlled below 1000 pixels\ * 600 pixels
base_info is JSON basic voucher data, see the table below, all voucher types common。
prerogative yes stringer (3072) member card privilege explaination, limit 1024 characters。
auto_activate no bool When set to true, the system automatically activates the card after the user receives it, without calling the activation interface, see Auto Activation for details 。
wx_activate No bool When set to true, the member card supports one-click opening, and is not allowed to pass into the activate_url field at the same time, otherwise the wx_activate is invalid. Once you have filled this field, you still need to call the interface settings to open the card to take effect. See One Click to Open the Card 。
supply_bonus yes bool Display points, fill in true or false, if filled in true, points related fields are required to fill in if set to true, the follow-up can not be closed。
bonus_url No string (128) Set the jump outside the chain to view points details. Use of this field only when points cannot be synchronized by activating the interface。
supply_balance is whether bool supports stored values, filled in true or false. If you fill in true, the stored value related fields are required to fill in. If set to true, the subsequent cannot be closed. This field must be enabled to store values, for details see: Get special permissions
balance_url No string (128) Set the link to view balance details. Use of this field only if the balance cannot be synchronized by activating the interface。
custom_field1 No JSON structure Custom member information category, displayed after the card is activated, including name_type (name) and url fields
custom_field2 No JSON structure Custom Member Information Category, displayed after the card is activated, including name_type (name) and url fields
custom_field3 No JSON structure Custom member information category, membership card display after activation, including name_type (name) and url fields
name_type no string (24) member information category semi-custom name, when the developer changes the value of this category information can choose to trigger the system template message to notify the user. FIELD_NAME_TYPE_LEVEL Level FIELD_name_TYPE_COUPON Coupon FIELD_Name_TYPE_STAMP Stamp FIELD_name_TYPE_DISCOUNT Discount FIELD_NAMA_TYPE_ACHIEVEMEN Achievement FIELD_NAM_TYPE_MILEAGE Mileage FIELD_NAV_TYPE_SET_POINTS Points FIELD_NEW_TYPE_TIMS Number of times
name No string (24) Member information category custom name, when the developer changes the value of such category information does not trigger the system template message to notify the user
url No string (128) Click on a category to jump outside the link url
bonus_cleared No string (128) Bonus clearing rule。
bonus_rules No string (128) Points rules。
balance_rules No string (128) stored value explaination。
activate_url No string (128) Activate the url of your card。
activate_app_brand_user_name No string (128) Activate the Weixin Mini Program user_name corresponding to the Member Card url, only jump to the Service Account bound Mini Program
activate_app_brand_pass No string (128) Activate the Weixin Mini Program path
custom_cell1 No JSON structure Custom membership information category, membership card is displayed after activation。
name Yes string (15) The name of the entry.
tips yes string (18) The right side of the entrance tip, within 6 Chinese characters。
url Yes string (128) Entry Jump Link。
bonus_rule No JSON structure Integral rule 。
cost_money_unit No int Spend amount. Divided into units。
increase_bonus No int Points for increase。
max_increase_bonus No int Maximum number of points a user can earn at a single time。
init_increase_bonus No int Initial Set Credits。
cost_bonus_unit No int Points per use X。
reduce_money no int deduct xx yuan, (here divided into units)
least_money_to_use_bonus no int credit condition, full xx yuan (here divided into units) available。
max_reduce_bonus No int Credit condition, maximum use of xx points for a single stroke。
discount no int discount, the discount enjoyed by the member card, fill in 10 is 10% off。

Base_info field:

Parameter Name Required to fill in type describe
logo_url yes string(128) The merchant logo of the card coupon is recommended to be 300\ * 300 pixels.
code_type yes string(16) Code Displays the type, "CODE_TYPE_TEXT" Text "CODE_Type_BARCODE" One-dimensional code "CODE_type_QRCODE" QR code "Code_type_ONLY_QRCODE," Displays only QR codes "CODE_type_ONLY-BARCODE," Displaying only one-dimensional code
pay_info no JSON Payment function construction, swipe_card structure
swipe_card no JSON Swipe function conformation, including is_swipe_card field
is_swipe_card no bool WeChat WeChat
is_pay_and_qrcode no bool Whether to set the button in the middle of the card to support both WeChat payment swipe card and card code
brand_name yes string The name of the merchant is limited to 12 Chinese characters.
title yes string The name of the card is limited to 9 Chinese characters (it is recommended to cover the attributes, service and amount of the card).
color yes string The color of the ticket. Fill in Color010-Color100 according to color specification
notice yes string The coupons use reminders and the number of characters is limited to 16 Chinese characters.
description yes string Instructions for using the voucher are limited to 1024 Chinese characters.
sku yes JSON Information about commodities.
quantity yes int The number of coupons in stock, do not support to fill in 0, the maximum is 100000000.
date_info yes JSON Date of use, expiration information.
type yes string Type of time used supports fixed duration valid type fixed date valid type permanent valid type (DATE_TYPE_PERMANENT)
begin _timestamp no int Used when type is DATE_TYPE_FIX_TIME_RANGE, indicating the start time. The number of seconds from 000000000000000000 on January 1, 1970 to the starting time (East Eight District Time, UTC + 8, in seconds)
end _timestamp no int Type DATE_TYPE_FIX_TERM_RANGE, indicating the end time (UTC + 8, in seconds)
fixed_term no int When type is DATE_TYPE_FIX_TERM, it means that it is valid for several days after collection, and it is valid for 0 on the day after collection (in days)
fixed_begin _term no int Used when type is DATE_TYPE_FIX_TERM, indicating how many days after collection. (In units of heavens)
use_custom _code no bool Whether to customize the Code code. Fill in true or false, default to false Usually their own coupon code system developers choose custom code code, see whether custom code
bind_openid no bool Whether to specify the user to receive, fill in true or false. Defaults to false
service_phone no string(24) Customer service numbers
location_id_list no array Store Location ID. Call the POI store management interface to get the store location ID.
use_all_locations no bool Whether the loyalty card supports all stores will be automatically synchronized to the voucher when the store is updated by the merchant
center_title no string(18) The center of the voucher button is displayed only when the voucher is activated and available
center_sub _title no string(24) The prompt displayed below the entry is only displayed after the voucher is activated and when available
center_url no string(128) The url centered at the top, which appears only when the coupon is activated and available
custom_url _name no string(15) Customize the name of the portal to the bounce outer link.
custom_url no string(128) Custom jump URL.
custom_url _sub_title no string(18) The prompt appears on the right side of the entrance.
promotion _url_name no string(15) Custom entry name for a marketing scene.
promotion _url no string(128) Enter Jump to the address link of the external link.
promotion_ url_sub_title no string(18) The prompt appears on the right side of the marketing entrance.
get_limit no int There is a limit on the number of tickets available per person. It is recommended that a membership card be limited to one per person
can_share no bool Whether the voucher collection page can be shared, defaults to true
can_give _friend no bool Whether the voucher is transferable, defaults to true
need_push_on _view no bool Fill in true for the user to click into the card push event, the default is false. For more information, see enter membership card event push

Advanced_info field

field Is it compulsory? type Introductions
advanced_info no JSON structure Create premium fields that are unique to coupons
use_condition no JSON structure Use threshold (conditions) fields, spelled on the stock if they do not fill in the conditions of use: No minimum consumption limit, universal, unlimited categories; Also displayed in the usage instructions: can be shared with other offers
accept_category no string(512) Specify the available item category, only for the voucher type, fill in the box will be spelled for xxx
reject_category no string(512) Specify the unavailable item category, only for the voucher type, fill in will be on the face of the spelling does not apply to xxxx
least_cost no int The full minus threshold field can be used for redemption and vouchers, filled in will be spent full xx yuan in full spelling available.
object_use_for no string(512) Buy xx available type threshold, only for redeem, fill in after automatically spell buy xxx available.
can_use_with_other_discount no bool No other types of sharing thresholds. When you fill in false, the system spells "No other benefits" in the usage notice, and when you fill in true, the system Spells "Shares with other benefits," which is defaulted to true
abstract no JSON structure Cover Abstract Structure Name
abstract no string(24 ) A cover summary brief.
icon_url_list no string(128 ) Cover picture list, only support to fill in a cover picture link, upload the picture interface to get the picture to get the link, fill in the non-CDN link will be wrong, and fill in here.Suggested picture size pixels 850\ * 350
text_image_list no JSON structure Graphic lists, displayed on the details page. Coupon developers must enter at least one set of graphic lists
image_url no string(128 ) Images link. You must call the upload image interface. Upload the image to get a link and fill it in here, otherwise you will report an error
text no string(512 ) Graphic description
business_service no arry Merchant service type: BIZ_SERVICE_DELIVER take-away service; BIZ_SERVICE_FREE_PARK parking spaces; BIZ_SERVICE_WITH_PET Pets allowed; BIZ_SERVICE_FREE_WIFI Free wifi, optional
time_limit no JSON structure Use a time limit that contains the following fields
type no string(24) Limit type enumeration value: support fill in MONDAY TUESDAY WEDNESDAY THURSDAY THURSDAY FRIDAY SATURDAY SUNDAY SUNDAY SUNDAY HERE only control display, do not control the actual use of logic, do not fill in the default does not show
begin_hour no int The starting time (hour) of the current type, if MONDAY is filled in the current conformation, and 10 is filled in here, then 10 is available on Monday.
begin_minute no int The start time (minutes) under the current type, if MONDAY is filled in the current conformation, begin_hour is filled in 10, and here 59 is filled in, then Monday 10 is 59 available.
end_hour no int The end time (hours) of the current type, if MONDAY is filled in the current conformation, and 20 is filled in here, then Monday 10: 00 to 20: 00 is available here
end_minute no int The end time (minutes) under the current type type, if MONDAY is filled in the current conformation, begin_hour is filled in 10, and here 59 is filled in, then here it means that Monday 1059 - 0059 is available

Return instructions

{
   "errcode":0,
   "errmsg":"ok",
   "card_id":"p1Pj9jr90_SQRaVqYI239Ka1erkI"
}
Parameter Name describe
errcode Error code, 0 is normal.
errmsg Error message.
card_id Voucher ID.

Developers' Note

2. When creating a membership card, you need to set the category of information presented when the membership card is activated. Currently, points,Balances, grades, coupons, miles, stamps, achievements, discounts, etc., WeChat 6.2 versions above display a maximum of 3 member information categories, i.e. category fields when createdSupply_bonus, supply_balance, custom_field1, custom_field2, and custom_field3 can be filled in at most.

3. When creating a voucher, the developer must be aware of the timestamp overflow. The timestamp set must be earlier than January 19, 2038. To set a longer validity period, you can select the validity period of the permanent validity type.

# 4.2 Get the results of membership card reviews

After the call interface successfully creates a membership card, the system automatically submits an audit, and the results of the audit will be notified to the developer as an event within three business days, while the call interface is supported to actively query the status of the card.

Review events pushed

When the generated voucher passes the audit, WeChat will push this event to the developer's URL. Coupon events pushed After the membership card is approved, it can be officially placed.

# 4.3 Set up a test whitelist interface

If the membership card is not approved temporarily, the developer can set the tester's WeChat number into a white list and receive the card voucher that has not been approved.Card information received in a whitelist status is not updated in real time with the voucher, so please note to the developer.For details, see:

# 5 Details of the delivery of membership card interface

Currently WeChat Membership cards are supported by scanning the two-dimensional code, clicking directly on the web page (see JS-SDK documentation ), card coupon shelves, Service Account group and service number passive reply message collection, developers can choose one or more.Please refer to the various distribution methods below for details.

Particular Attention

  1. The membership card that the developer calls the interface to deliver is a "card bundle" without member information, and the member card number, points, balance, and other information need to be called to activate / bind the member card interface update after the user collects the membership card.

  2. The credentials of calling the activation / binding membership card interface are Code and card_id. Developers need to record the relationship between the code and the member OpenID through the interface or the card voucher event when calling the membership card.

# 5.1 Create QR code interface

Create a QR code for a membership card, print it and place it in the store. Customers scan the QR code to collect the membership card. Scan the QR code below to experience the claim. If already collected, scan the QR Code to quickly open the membership.For details of the interface, see:

# 5.2 Single / bulk adding voucher interface within web pages

WeChat Provides an addCard interface that can be invoked by a merchant's front-end web page to add one or more card coupons to a user's card pack.For more information, see JS-SDK Dxplaination Document

(WeChat Scan > WeChat card voucher interface > addcard interface)

# 5.3 Place membership cards through the voucher shelf

Summary of the Coupon Shelf

The card coupon shelf supports the developer to generate a card coupon H5 page through the calling interface, and obtain the page link to carry out the card coupon delivery action. See the details of the interface Place a card

# 5.4 Service Account Message Delivery Card

Developers can also send a membership card to users via Service Account group message or customer service message, see: Place a card

# 5.5 Recording user card behaviour

When a user collects a membership card, WeChat pushes a notification to the developer server about the collecting card event so that the developer can record the connection between the user's OpenID and the membership card code and distinguish the collection channel by parameters within the event (see 1.5).

See: Card voucher event push

# 5.6 Statistical distribution channel data

In order to facilitate the development of statistical channels of the card voucher data, the new field outer_id.Fill the different set outer_id into the card_ext JSON structure, and when the user collects a card, the corresponding set outer-id is brought into the card event push push to the developer server.

Example: Set outer_id to 1 in a binary code delivery mode

{
    "action_name": "QR_CARD",
    "action_info": {
        "card": {
            "card_id": "pFS7Fjg8kV1IdDz01r4SQwMkuCKc",
            "code": "198374613512",
            "openid": "oFS7Fjl0WsZ9AMZqrI80nbIq8xrA",
            "expire_seconds": 1800,
            "is_unique_code": false,
            "outer_id": 1
        }
    }
}

Pick up the event XML file

<xml>
   <ToUserName>< ![CDATA[toUser] ]></ToUserName>
    <FromUserName>< ![CDATA[FromUser] ]></FromUserName>
    <FriendUserName>< ![CDATA[FriendUser] ]></FriendUserName>
    <CreateTime>123456789</CreateTime>
    <MsgType>< ![CDATA[event] ]></MsgType>
    <Event>< ![CDATA[user_get_card] ]></Event>
    <CardId>< ![CDATA[cardid] ]></CardId>
    <IsGiveByFriend>1</IsGiveByFriend>
    <UserCardCode>< ![CDATA[12312312] ]></UserCardCode>
    <OuterId>1</OuterId>
</xml>

# 6 Activate a membership card

When the user collects the membership card "clutch," the support calls this interface to activate the membership cards and set the initial value of the membership information, such as points, balances, ranks, membership card numbers and other membership information. At present, the WeChat membership card supports three activation methods, namely interface activation, one-click activation and automatic activation.

Developers' Note

1. Developers can choose the right activation process based on the business scenario. There are only one of the three ways to activate the stream;

2. To activate the membership card, you need to pass in the Code code obtained when the user receives it, and set the membership_number of the membership card.

# 6.1 Interface activation

Dxplaination of how to activate

Interface activation typically requires the developer to develop a web page where the user fills in information. There are usually two activation processes:

  1. Users must fill in information before they can receive the card, and after receiving the card, the developer calls the activation interface to activate the membership card for the user.

  2. It is possible for the user to collect the membership card first, click on Activating the Membership Card and jump to the data set by the developer to fill in the page. After filling in, the developer calls the Activation Interface to activate the membership cards for the user.

Interface details

Dxplaination of Interface Call Request

HTTP request mode: POST URL: https://api.weixin.qq.com/card/membercard/activate?access_token=TOKEN

Parameter explaination

parameter Do I have to? Introductions
access_token yes Call Interface Credentials
POST data yes JSON structure
{
    "init_bonus": 100,
    "init_bonus_record":"旧积分同步",
    "init_balance": 200,
    "membership_number": "AAA00000001",
    "code": "12312313",
    "card_id": "xxxx_card_id",
    "background_pic_url": "https://mmbiz.qlogo.cn/mmbiz/0?wx_fmt=jpeg",
    "init_custom_field_value1": "xxxxx"
}
Parameter Name Required to fill in type describe
membership_number yes string(20) The member card number, which is entered by the developer, is displayed as a serial number in the user's card package. Can be equal to Code.
code yes string(20) The code received by the user
card_id no string(32) Voucher ID, custom code Voucher required
background_pic_url no string(128) For merchants to customize the logo for a member card, you must first call the upload image interface and upload the logo to the CDN, otherwise you will report an error. Please follow the WeChat custom logo design specification for a Member Card
activate_begin_time no unsigned int The effective start time after activation. If you do not fill in the default data_info at the time of creation. Unix timestamp format.
activate_end_time no unsigned int Valid expiration time after activation. If you do not fill in the default data_info at the time of creation. Unix timestamp format.
init_bonus no int Initial points, not filled with 0.
init_bonus_record no string(32) Points synchronization instructions.
init_balance no int The initial balance, not filled, is 0.
init_custom_field_value1 no string(12) The custom_field1 field defines the initial value of the type, limited to 4 characters and 12 bytes.
init_custom_field_value2 no string(12) When created, the custom_field2 field defines the initial value of the type, limited to 4 characters, 12 bytes.
init_custom_field_value3 no string(12) The custom_field3 field defines the initial value of the type, limited to 4 characters and 12 bytes.

Return instructions

Data examples:

{
   "errcode":0,
   "errmsg":"ok"
}
Parameter Name describe
errcode Error code, 0 is normal.
errmsg Error message.

# 6.2 One-click activation

6.2.1 Regular one-click activation

One-key activation is a quick and convenient activation program provided by WeChat. After the user receives the card, click "activate the card" will jump to the official information filling page,WeChat will automatically pull the user's previously filled out card opening information, and the user does not need to repeat the filling out, while avoiding the process of phone number verification, thereby achieving the purpose of one-click activation and improving the card opening rate. The details of the process are shown below:

Step 1: Fill in the wx_activate field Interface explaination Set WeChat one-click opening function, now supports the creation of membership card when filling in the specified field specified to one-click activation, member_card added "wx_activate": true.See Creating a Member Card Interface for more details

If the merchant uses a custom card number, the developer can set the user to fill in the information and jump to the merchant's web page, which the developer can activate. Parameter Dxplaination | Parameters | Is it necessary | Dxplaination | | --- | --- | --- | | member_card | | | | wx_activate | no | fill in true or false |

Examples of POST data:

{
    "card": {
        "member_card": {
            "wx_activate": true
        }
    }
}

Developers' Note

1. If the auto_activate field is filled in, the activation link activate_url and the one-click opening interface settings will be invalid;

2. If the activate_url is passed at the same time, the one-click opening interface setting will be invalid;

3. Developers are advised to fill in only one entry for activate_url, auto_activate, and wx_activate.

Step 2: Set up the card open field interface

After the developer fills in the wx_activate field at the time of creation, he needs to call the interface to set the options that the user needs to fill in when activating, otherwise the one-click open card setting will not take effect.

Interface Invocation Request Dxplaination > HTTP request method: POST URL:https://api.weixin.qq.com/card/membercard/activateuserform/set?access_token=TOKEN Parameter Dxplaination | Parameters | Is it necessary | Dxplaination | | --- | --- | --- | | access_token | Yes | Call Interface Credentials | | POST Data | Yes | JSON Structure |

{
    "card_id": "pbLatjnrwUUdZI641gKdTMJzHGfc",
    "service_statement": {
        "name": "会员守则",
        "url": "https://www.qq.com"
    },
    "bind_old_card": {
        "name": "老会员绑定",
        "url": "https://www.qq.com"
    },
    "required_form": {
        "can_modify"false,
        "rich_field_list": [
            {
                "type": "FORM_FIELD_RADIO",
                "name": "兴趣",
                "values": [
                    "钢琴",
                    "舞蹈",
                    "足球"
                ]
            },
            {
                "type": "FORM_FIELD_SELECT",
                "name": "喜好",
                "values": [
                    "郭敬明",
                    "韩寒",
                    "南派三叔"
                ]
            },
            {
                "type": "FORM_FIELD_CHECK_BOX",
                "name": "职业",
                "values": [
                    "赛车手",
                    "旅行家"
                ]
            }
        ],
        "common_field_id_list": [
            "USER_FORM_INFO_FLAG_MOBILE"
        ]
    },
    "optional_form": {
        "can_modify"false,
        "common_field_id_list": [
            "USER_FORM_INFO_FLAG_LOCATION",
            "USER_FORM_INFO_FLAG_BIRTHDAY"
        ],
        "custom_field_list": [
            "喜欢的电影"
        ]
    }}

Parameter Name Required to fill in type describe
card_id yes string(32) Voucher ID.
required_form no JSON structure Required options when a membership card is activated.
optional_form no JSON structure What to fill in when a member card is activated.
can_modify no bool Whether the field in the current structure (required_form or optional_form) allows the user to modify it again after activation, and when the merchant is set to true, it needs to receive the corresponding event notification to handle the modification event
common_field_id_list no arry WeChat Formatted option type.See the list below.
custom_field_list no arry The name of the custom options, which developers can define up to five custom options in both mandatory and optional fields respectively
rich_field_list no arry A custom rich text type that contains the following three fields, allowing developers to define up to five custom options in required and optional fields
type no string( 21 ) Rich text type FORM_FIELD_RADIO custom single FORM_FIELD_SELECT custom selector FORM_FIELD_CHECK_BOX custom multiple selections
name no string(21) Field Name
values no arry Select item
service_statement no JSON structure Service Notice, used to place merchant loyalty card codes
name no string( 21 ) Member declaration field name
url no string(128) Please fill in http:// or https://
bind_old_card no JSON structure Bind old member links
name no string(32) Link Name
url no string(128) Please fill in http:// or https://

Common_field_id_list, which enables developers to use the following option types

Field Values describe
USER_FORM_INFO_FLAG_MOBILE Mobile phone number
USER_FORM_INFO_FLAG_SEX gender
USER_FORM_INFO_FLAG_NAME Full name
USER_FORM_INFO_FLAG_BIRTHDAY birthday
USER_FORM_INFO_FLAG_IDCARD ID
USER_FORM_INFO_FLAG_EMAIL mailbox
USER_FORM_INFO_FLAG_LOCATION Detailed address
USER_FORM_INFO_FLAG_EDUCATION_BACKGRO educational background
USER_FORM_INFO_FLAG_INDUSTRY industry
USER_FORM_INFO_FLAG_INCOME income
USER_FORM_INFO_FLAG_HABIT Hobby

Step 3: Receive Notification of Member Information Event

After the user fills in and submits the information, the event will be pushed to the merchant. Developers can call the activation interface after receiving the notification of the event, enter the member card number, initial points, etc. or call the pull member information interface to obtain member information and conduct member management.

Push XML digital packet example

<xml>
   <ToUserName> < ![CDATA[gh_3fcea188bf78] ]></ToUserName>
    <FromUserName>< ![CDATA[obLatjlaNQKb8FqOvt1M1x1lIBFE] ]></FromUserName>
    <CreateTime>1432668700</CreateTime>
    <MsgType>< ![CDATA[event] ]></MsgType>
    <Event>< ![CDATA[submit_membercard_user_info] ]></Event>
    <CardId>< ![CDATA[pbLatjtZ7v1BG_ZnTjbW85GYc_E8] ]></CardId>
    <UserCardCode>< ![CDATA[018255396048] ]></UserCardCode> 
</xml>

Parameter explaination

parameter Introductions
ToUserName Developer No. WeChat
FromUserName Sender account (an OpenID)
CreateTime Message Creation Time (integer)
MsgType Message type, event
CardId Voucher ID
UserCardCode Card Voucher Code Code

Step 4: Sync member data

Developers can call the Activation Interface after receiving an event notification, enter information such as membership card number, initial points, etc., or call the Pull Membership Information Interface to obtain membership information. See: Activating Membership Card Interface for more details

Step 5: Tap the member information interface

Interface Dxplaination

Support developers to query member information based on CardID and Code.

Dxplaination of Interface Call Request

HTTP request mode: POST URL: https://api.weixin.qq.com/card/membercard/userinfo/get?access_token=TOKEN

Parameter explaination

parameter Do I have to? Introductions
POST data yes JSON structure
access_token yes Call Interface Credentials

POST data

{
   "card_id": "pbLatjtZ7v1BG_ZnTjbW85GYc_E8",
   "code": "916679873278"
}

Return data

{
    "errcode": 0,
    "errmsg": "ok",
    "openid": "obLatjjwDolFj******wNqRXw",
    "nickname": "*******",
    "membership_number": "658*****445",
    "bonus": 995,
    "sex": "MALE",
    "user_info": {
        "common_field_list": [
            {
                "name": "USER_FORM_INFO_FLAG_MOBILE",
                "value": "15*****518"
            },
            {
                "name": "USER_FORM_INFO_FLAG_NAME",
                "value": "HK"
            },
            {
                "name": "USER_FORM_INFO_FLAG_EDUCATION_BACKGROUND",
                "value": "研究生"
            }
        ],
        "custom_field_list": [
      {
        "name": "兴趣",
        "value": "钢琴",
        "value_list": []
      },
      {
        "name": "喜好",
        "value": "郭敬明",
        "value_list": []
      },
      {
        "name": "职业",
        "value": "",
        "value_list": [
          "赛车手",
          "旅行家"
        ]
      }
    ]
    },
    "user_card_status": "NORMAL",
    "has_active": false
}
Parameter Name Introductions
errcode Error code, 0 is normal
errmsg Error message
openid User's unique identifier in this Service Account
nickname User nickname
bonus Points Information
balance Balance information
sex User gender
user_info Member Information
custom_field_list The categories of member card membership information set by the developer, such as levels.
name Category Name of Member Information
value Membership card information category value, such as rating value, etc.
value_list Return when you fill in an item for multiple choice
user_card_status Current user's membership card status, NORMAL Normal EXPIRE Expired GIFTING GIFT_SUCC GIFT SUCCESSFUL GIFT_TIMEOUT DELETE DELETED, UNAVAILABLE Expired
has_active Whether the card has been activated, true means it has been activated, false means it has not been activated

6.2.2 Jump-to-the-Switch activation with one click

Jump-to-the-middle activation allows users to jump to a merchant-custom web page after submitting their member card details. Unlike normal one-click activation, the activation of a member card by jumping to one-click is completed by the merchant, and the merchant can do the logic of activation, activation rewards, and judgment of card opening conditions in the web page to be jumped to. At the same time, it ensures the real-time opening of the card, suitable for merchants who use custom card numbers.

Step 1: In the Create / Update Interface, fill in the transformation one-click activation field

If a merchant sets up a user to jump to its own web page after activation, the following parameters need to be entered when creating or updating the interface.

{
    "card": {
         "member_card": {
     ························
      ························
    "wx_activate": true, "wx_activate_after_submit" : true,
   //是否设置跳转型一键激活 "wx_activate_after_submit_url" : "https://qq.com"
      //用户提交信息后跳转的网页 }
    }
}
Parameter Name Required to fill in type describe
member_card yes JSON structure Member Card Structure
wx_activate no bool Do you support one-click activation, fill in true or false
wx_activate_after_submit no bool Whether to support jump type one key activation, fill in true or false
wx_activate_after_submit_url no bool Jump transformation click to activate the jump address link, please fill in http:// or https:// at the beginning of the link

Step 2: Set up the card open field interface

See 6.2.1

Step 3: Obtain user submission information

After the user fills out and submits the card opening information, the user will be redirected to the merchant's web page, where the merchant can obtain the information filled out by the user and conduct card qualification judgment, information confirmation and other actions.

This can be done as follows:

After the user clicks submit, WeChat spells the parameters after the merchant's URL for the user's completed information: activate_ticket, openid, card_id, and encrypted code-encrypted_code, such as the merchant who filled out the wx_activate_after_submit_url is www.qq.com , then the stitched url is www.qq.com&card_id=pbLatjvFdsLDUMoN8JqcsGeiMHKk&encrypt_code=Bupk8bb9xxxxxx3rdXV6fClBVtkHQplYohdzGvgDl4%3D&outer_str=&openid=obLatjjwDxxxxxxxoGIdwNqRXw&activate_ticket=fDZv9eMQAFfrNr3XBoqhb%2F%2BMSDM0yjDF6CdiUhC%2BOlEaxb0clsUxxxxxxxxxxxd6yQsjRMRu4kAcKTibYLN5tmHBdll1b6zQRsLF53MpKjGU%3D

Developers can use activate_ticket to get the information that users fill in for logical judgment on the developer page.

Interface Dxplaination

Enable developers to get information filled in by users according to activate_ticket.

Dxplaination of Interface Call Request

HTTP request mode: POST URL: https://api.weixin.qq.com/card/membercard/activatetempinfo/get?access_token=TOKEN

Parameter explaination

parameter Do I have to? Introductions
POST data yes JSON structure
access_token yes Call Interface Credentials

POST data

{
    "activate_ticket" : "abcdefg"
}

Return data

  {
    "errcode": 0,
    "errmsg": "ok",
    "info": {
        "common_field_list": [
            {
                "name": "USER_FORM_INFO_FLAG_MOBILE",
                "value": "15*****518"
            },
            {
                "name": "USER_FORM_INFO_FLAG_NAME",
                "value": "HK"
            },
            {
                "name": "USER_FORM_INFO_FLAG_EDUCATION_BACKGROUND",
                "value": "研究生"
            }
        ],
        "custom_field_list": []
    }
}

NOTE:

1.Developers must use business card printing AppID to call the interface, otherwise error;

2.The developer must urldecode after intercepting the ticket on URL.

Step 4: Call the interface to activate the membership card

Developers can call the Activation Interface after receiving an event notification, enter information such as membership card number, initial points, etc., or call the Pull Membership Information Interface to obtain membership information. See: Activating Membership Card Interface for more details

# 6.3 Automatically Activate

Interface Dxplaination

To set the automatic activation function of the membership card, fill in the specified fields when creating the membership card, add "auto_activate": true to base_info, and get the card_id. See Creating a Member Card Interface for more details

It is worth noting that after passing in the auto_activate field, the activation url of the one-click open card setting and the interface activation setting are no longer displayed. After the user collects the card, the system automatically activates the user, and the custom display information such as points, stored values and so on is zero, and the developer can update the user's membership data through the update member information interface.

Parameter explaination

parameter Do I have to? Introductions
member_card
auto_activate no Fill in true or false

# 7 Update member information

When a member consumes with a card, the support developer calls this interface to update the member information.Each change of information after the card transaction needs to be notified through the interface WeChat to facilitate subsequent message notification and other extension functions.

Dxplaination of Interface Call Request

HTTP request mode: POST URL: https://api.weixin.qq.com/card/membercard/updateuser?access_token=TOKEN

Parameter explaination

parameter Do I have to? Introductions
access_token yes Call Interface Credentials
POST data yes JSON structure
{
    "code": "179011264953",
     "card_id": "p1Pj9jr90_SQRaVqYI239Ka1erkI",
    "background_pic_url": "https://mmbiz.qlogo.cn/mmbiz/0?wx_fmt=jpeg",
    "record_bonus": "消费30元,获得3积分",
    "bonus": 3000,
     "add_bonus": 30,
    "balance": 3000,
    "add_balance": -30,
    "record_balance": "购买焦糖玛琪朵一杯,扣除金额30元。",
     "custom_field_value1": "xxxxx""custom_field_value2": "xxxxx""notify_optional": {
        "is_notify_bonus": true,
        "is_notify_balance": true,
        "is_notify_custom_field1":true
    }
}

Parameter explaination:

Parameter Name Required to fill in type Example values describe
code yes string(20) 1231123 Card Voucher Code Code.
card_id yes string(32) p1Pj9jr90_SQ RaVqYI239Ka1erkI Voucher ID.
background_pic_url no string(128) https://mmbiz.qlogo.cn/ Supports assigning custom membership card backgrounds to individual membership cards when a merchant activates.
bonus no int 100 The full value of the integral needs to be set, and the incoming value is displayed directly
add_bonus no int 100 For this change in the value of points, the convergence negative represents a decrease
record_bonus no string(42) Spending 30 yuan and gaining 3 points Merchant customised points consumption record, no more than 14 Chinese characters
balance no int 100 The full value of the balance needs to be set. The incoming value is displayed directly on the card
add_balance no int 100 The change in the current balance represents a decrease by the convergence of negative numbers
record_balance no string(42) Buy a cup of caramel macaroni, deduction of 30 yuan. The merchant customizes the amount consumption record, no more than 14 Chinese characters.
custom_field_value1 no string(12) platinum Custom_field1 is the most recent value of the type defined at creation time, limited to 4 characters and 12 bytes.
custom_field_value2 no string(12) 8 folds The custom_field2 field is the most recent value of the type defined at creation time, limited to 4 characters and 12 bytes.
custom_field_value3 no string(12) 500 The custom_field3 field is the latest value of the type defined at creation time, limited to 4 characters and 12 bytes.
notify_optional no JSON -- Control the native message structure, containing message control fields for each field
is_notify_bonus no bool true Whether the system template message is triggered when points change, defaults to true
is_notify_balance no bool true Whether the system template message is triggered when the balance changes, defaults to true
is_notify_custom_field1 no bool false Custom group1 changes whether to trigger the system template message, the default is false. (2 and 3 the same)

Return instructions

Data examples:

{
    "errcode": 0,
    "errmsg": "ok",
    "result_bonus": 100,
    "result_balance": 200,
    "openid": "oFS7Fjl0WsZ9AMZqrI80nbIq8xrA"
}

Parameter Name describe
errcode Error code, 0 is normal
errmsg Error message
result_bonus Total current user points
result_balance Total amount stored by current users
openid User openid

Note

  1. Developers can pass in both add_bonus and bonus to solve the idempotence problem due to synchronization failure. When you pass in add_bonus and bonus at the same time

Add_bonus is displayed as the value of the variable in the credit change message, and bonus is displayed as the total credit amount on the card surface. The same applies to balance changes.

  1. Developers can pass in is_notify_bonus to control that special credit reconciliation changes do not send a message, as do balance changes.