Gift Card Interface Documentation
Date of update | Introductions |
---|---|
2016/11/15 | Support the addition, deletion and modification of shelves |
2016/12/7 | Create shelf interface adjustments that add theme structure |
2016/12/14 | Increase gift card giving events |
2016/12/21 | Batch pull interface modified from GET to POST method |
2016/12/27 | New types of exchange cards |
2017/1/5 | Support developers to preset number of gift card rebates |
2017/1/19 | Added page_title field Developers can customize the title of the page |
2017/2/8 | New checkout shelf page interface |
2017/2/20 | New application process |
2017/4/25 | Support for post-payment invoicing function |
2017/6/2 | Add a switch for gift card group distribution |
2017/12/25 | 1.Support for Buy-To-Yourself option 2. Support for individual / bulk inquiry orders 3. Support for adding item thumbnails and descriptions to items 4. Increased merchant self-configuration Weixin Mini Program Process 5. Support for marketing functions 6. App Store Support for custom delivery channel values |
# 1. Gift Card Overview
WeChat provides a complete set of WeChat gift card creation, sale and use processes for gift card merchants. Merchants can create gift cards through API, create gift card shelves, and call the interface to synchronize balances on the WeChat voucher platform.Developers by creating gift card shelf configuration in Service Account or generate two-dimensional code posted in the store gift card sales.
Users can express holiday blessings and condolences by purchasing a gift card to send to a friend and attaching a blessing. A small gift card to convey a strong bond of friendship.
Merchant WeChat Gift Cards have the following advantages:
1 The card pack is taken and stored, so the user never has to worry about losing the gift card anymore;
2 The native social re-gifting process is smooth and secure, and it is much easier to give gift cards to friends.
3 Opening a gift card gift bag with the sense of surprise, allows the friend who receives the gift to enjoy the double pleasure;
4 Merchants can use the dynamic code capabilities provided by WeChat to use a secure two-dimensional code stored value consumption process without development;
5 multi-channel sales, merchants can be gift card shelf configuration in the Service Account menu, graphics, two-dimensional code and even advertising channels for sales. More surprises waiting for you to explore.
# 2. Gift Card Product Process
The following interactive demonstrations are for reference, and actual implementation is dependent on the final implementation.
# 2.1 Gift Card Buying Giveaway Process
# 2.2 Gift Card Receipt Process
# 2.3 displayed inside the gift card package
# 3. Access threshold
# 3.1 Category scope
At this stage, it is mainly open to merchants in the following voucher categories, and virtual categories are not supported at this time. This is as follows:
Level 1 category | Category II |
---|---|
shopping | Department Stores, Shopping Centres / Malls, Supermarkets, Convenience Stores, General Food, Health Food, Liquor, Sub-food stores, apparel, footwear trunks, jewellery accessories, cosmetics, day care products, watches and glasses, flowers and gifts, mother and baby products, sports and outdoor, musical instruments, books, newspapers and magazines, pharmacies / pharmacies, digital home appliances, home textile and home improvement, building materials, hardware / mechanical instruments, general e-commerce |
Life Services | Car sales, oil fuel filling station, housekeeping, maintenance, wedding, vehicle maintenance and repair |
Pub | Star-rated hotels, resorts, fast-moving hotels |
Delicious food | Cantonese cuisine, tea restaurant, Sichuan cuisine, Xiangxi cuisine, Northeastern cuisine, Northwest cuisine, hot pot, buffet, snacks, fast food, Japanese, Korean, Southeast Asian cuisine, Western food, bread and dessert, cafes, Jiangsu and Zhejiang cuisine, other cuisines, bars / clubs, takeaways |
Recreation & Entertainment | Hairdressing, Nails, Hot Springs, Sports and Fitness, Foot Massage |
# 3.2 Merchant qualification requirements
WeChat Gift cards are divided into stored-value gift cards and single-item gift cards according to their contents.Among them, the stored value type gift card, means that the card surface information contains a specific stored value amount, such as a 1000 yuan gift card, and the product type gift card means that this gift card is used to redeem a specified product, such as the Hamburg gift card. The two gift cards require different qualifications for merchants, as described below.
# 3.2.1 Storage Value Type Gift Card
Merchants need to have a single-use prepaid card filing in order to carry out gift card business (including gift stored value cards and gift exchange vouchers). If the filing entity is inconsistent with the Service Account entity, one of the following conditions must be met: Group issued card, brand issued card and multi-use licensee guarantee.
Supplementary materials
The transition phase is submitted by mail and is described as follows:
1) Group card issuer: If the single-purpose prepayment card licensee is the parent company of the group, the Service Account certification body applying for stored value authority is a subsidiary of the group.If the equity accounts for more than 50%, applicants can additionally supplement the Group Card Authorization of the registered company (must have the public seal of the listed company) to open the authority.
2) Brand issue cards: If the single-use prepaid card licensee is a brand, the Service Account certification body that applies for stored value rights is a franchise authorized by the brand, the applicant may supplement the Franchise Authorization (must have the company's official seal) to open the rights.
In both cases, the power of attorney is drawn up by the business and needs to clarify the following: Who am I? The status of my filing; Whom do I authorize? What does it authorize to do (issue cards in the group name)? Issue a card in the name of a brand?);I'm responsible for cashing cards issued by authorized parties.
3) Multi-purpose prepaid card licence: If the applicant has authorization to cooperate with the issuer of a prepaid card and the issuing authority to which it is accepted (the Payment Operations License), The applicant may submit the multi-purpose prepaid card filing materials directly by mail, as well as the cooperation agreement between the filing party and the applicant (must have the public seal of the filing company) to open rights.
Here are three things to pay attention to:
A. The licensee must be the issuing institution of "prepayment card issuance and acceptance," and cannot be the accepting institution of "prepayment card acceptance"; b. After the completion of the authorization, the brand side needs to entrust the license party to implement business card printing, issuing cards, etc., the brand side itself has not yet obtained the prepaid card permission, If the licensee needs to sell prepaid cards, there is no legal assessment that there is no risk of diversion for compliance purposes, and since current regulations require card issuers to issue prepaid tickets through physical outlets, it is recommended that priority be given to merchants with physical card operations;
c. The Payment Institutions' Prepaid Card Business Management Rules stipulate that payment institutions should conduct prepaid card business strictly in accordance with the type and scope of business approved under the Payment Operations License. No prepaid card business may be conducted in provinces (autonomous regions, municipalities, planned municipalities) that do not have a provincial branch. Therefore, local licence holders may not operate throughout the country.
In the case of a multi-use licensee's authorization, on the basis of the above, the authorization also needs to be supplemented by the following statements, that is, a complete explaination:
a) Who I am, what I document, whom I authorize to, what I authorizes it to do, the cards issued by the authorized party, and I am responsible for cashing them;
B) Basic information of the special merchant;
C) fees and charges;
D) Requirements for the protection of the rights and interests of the cardholder;
E) management requirements for card information, transaction data, acceptance terminals, transaction vouchers;
(f) The name of the receiving account of the authorized merchant, the opening bank, the account number and the period of the settlement of funds;
G) Requirements for reconciliation of accounts, handling of errors and handling of business disputes;
(h) Risk-taking and liability for breach of contract;
I) the conditions for termination of the agreement and the method of repayment of debts after termination.
Supplementary materials will be sent uniformly by mail during the transitional period to: weixincard@tencent.com It will be supported in the MP system.
# 3.2.2 Item Type Gift Card
There is no need to have prepaid card qualifications, and the platform is considered ordinary card exchange business. Merchants who meet the category requirements do not need to go through the application process alone, and can develop directly with the interface documentation.
# 4 Access Preparation
# 4.1 Have a certificate Service Account and open the card coupon function
# 4.1.1 New registration process
- If the merchant does not already have a Service Account, the merchant can log in to Service Account WeChat public platform ] To register and authenticate the service number, see: Register the WeChat Official Platform
- After registration, merchants can log on to the WeChat public platform ] and go to [Add Plugins] - [Card Bag Function] to submit the corresponding information and open the card voucher function. For more details, see: WeChat Coupon Function Rules ]].
# 4.1.2 Non-new registration process
- If the merchant has opened the card coupon function Service Account can be based on their own situation, decide whether to directly reuse.
Note: The above opening requires a review time of 3-5 business days, so please apply for operation in advance depending on the project progress.
# 4.2 Have a certified Weixin Mini Program (gift card only)
We require merchants to provide a separate Weixin Mini Program for uploading the code and information of the gift card.Merchants are required to apply for or have a gift card-specific Mini Program.
# 4.2.1 New registration process
- If the merchant does not already have a certified Weixin Mini Program, the merchant may log in to [ WeChat public platform ] To register and authenticate the Mini Program, see: Register the Mini Program account .
# 4.3 Use Service Account to apply for a merchant number
- Merchants must use the Service Account applied merchant number to go through the Gift Card configuration process. See: []] WeChat public platform ]]
Note
1 The self-service configuration process only supports the merchant number that Service Account applies, and the merchant number that Weixin Mini Program applies does not support the self-service configuration process;
2 Merchant numbers are recommended for gift cards to facilitate reconciliation statistics;
3 Merchant numbers under the general service provider and connected merchant model are supported, and merchant numbers under banking service provider and payment institution service provider models are not supported for the time being.
# 5 Development Overview
# 5.1 key information
The gift card is a type of WeChat card voucher, please developers before developing the gift card function please first overview < public platform interface document >, < WeChat card voucher interface document and Rules for the use of WeChat voucher functions to ensure familiarity with the basic concepts involved in gift card development and basic guidelines related to gift card operations.
# 5.2 Terminology Explanation
To avoid conceptual confusion among developers during the development process, develop familiarity with the following terms before developing the gift card interface.
Parameter Name | describe |
---|---|
card_id | Voucher ID. A card voucher ID corresponds to a class of card vouchers, including the corresponding inventory number of Code. |
code | Card Voucher Code Code. A unique identifier for a voucher. This serial code is used when the voucher is written off, allowing merchant customization. |
openid | The user's unique identity under the Service Account. |
access_token | Credentials for invoking interfaces are valid for 7200s, and each request refresh is obtained by access_token interface . Developers need to preserve and establish a cache mechanism. |
jsapi_ticket | The signature ticket used to invoke the JS-SDK interface of WeChat native function on the WeChat web page, see: JS-SDK section for details |
api_ticket | The temporary ticket signed when calling WeChat card ticket interface, valid for 7200s, 7200s repeated requests remain unchanged, get the api_ticket interface to get. |
card_ext | Extensible additional information for coupons. It is used to carry the basic information for a voucher when it is placed. |
outer_str | Scenarios of ticketing channels. Support merchants custom scene value filled in card_ext card voucher delivery, when the user will receive the corresponding scene value through the event notification merchants. |
Event push | When a voucher passes approval, a token is collected, a card is deleted, and a card has been deleted, the developer is notified of the event and receives a server addressed to the public platform developer center URL. |
Custom Entry | Through the API to create a card voucher support merchants custom card voucher details page jump outside the chain of the unit. |
Gift Card Use | This document defines a decrease in the balance of a gift card as being called gift card use. Including but not limited to offline POS machine balance deduction, users online use and other scenarios |
# 5.3 Development steps
Gift card development goes through several important steps in creating a gift card, placing the gift card, and synchronizing the giftcard information, as shown in the following diagram.
Notes: This document only describes the mainstream process for gift card creation. Please refer to the card interface documentation for the back-line process
- For the difference between custom code and import code, please refer to:
WeChat Card Coupon Interface Call Dxplaination:
http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056&token=&lang=zh_CN&anchor=2.2
Import custom code:
http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025062&token=&lang=zh_CN&anchor=4.1
Public platform event handling mechanisms:
http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025274&token=&lang=zh_CN
# 5.4 Documentation Reference
In the process of developing a gift card feature, you may want to refer to the following documents
Public platform interface documentation (token acquisition, cache, event push processing):
http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1445241432&token=&lang=zh_CN
WeChat Voucher interface documentation (creating gift cards, custom code mechanism, import code mechanism):
http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141229&token=&lang=zh_CN
# 6. Create Gift Cards
# 6.1 Upload Gift Card Image Material Interface
Developers need to upload the user's gift card logo and background image displayed in WeChat to the WeChat CDN first, and after obtaining the url, the logo_url field and the background_pic_url field for creating the gift card interface
For more details, see:
http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056&token=&lang=zh_CN&anchor=2.3
NOTE:
- Gift card background picture design please strictly follow the < WeChat Membership card custom background design specification ;
- WeChat will upload the image of the merchant for anti-theft chain protection, upload material if displayed in the non-merchant domain page will be banned.
# 6.2 Upload Gift Card Store Interface
For geographically related use cases for gift cards, we recommend that developers fill in the store when creating a gift card, and when users use a giftcard, the order of the gift card is automatically toped if they are near the store.
For more details, see:
http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056&token=&lang=zh_CN
# 6.3 Create Gift Card Interface
Interface Dxplaination
Creating a gift card interface is the basic interface for WeChat card vouchers,For creating a new class of coupons, obtain the card_id, successfully create and pass the audit, the merchant can send the coupons to the user through other interfaces provided in the document. Each purchase successfully, the inventory is deducted accordingly.
Dxplaination of Interface Call Request
parameter | Introductions |
---|---|
agreement | HTTPS |
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/create?access_token=ACCESS_TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"card": {
"card_type": "GENERAL_CARD",
"general_card": {
"sub_card_type": "GIFT_CARD",
"background_pic_url": "https://mmbiz.qlogo.cn/mmbiz/",
"base_info": {
"max_give_friend_times": 1,
"giftcard_info": {
"price": 1
},
"logo_url": "https://mmbiz.qlogo.cn/mmbiz/p98FjXy8LaeMq67mEpDmkj05EtiaVcGOibVaVux3Agib1ibcHFkCoic7HuQWFawx9XGCNWIO085drjdxTib2nBHlYGAA/0?wx_fmt=gif",
"brand_name": "微信咖啡厅",
"code_type": "CODE_TYPE_QRCODE",
"title": "心意卡",
"color": "Color020",
"notice": "使用时向服务员出示",
"service_phone": "020-88888888",
"description": "不可与其他优惠同享",
"date_info": {
"type": "DATE_TYPE_FIX_TIME_RANGE",
"begin_timestamp": 1397577600,
"end_timestamp": 1472724261
},
"sku": {
"quantity": 50000000
},
"get_limit": 0,
"use_custom_code": false,
"can_give_friend": true,
"location_id_list": [
213059884
],
"center_title": "顶部居中按钮",
"center_sub_title": "按钮下方的wording",
"center_url": "www.qq.com",
"center_app_brand_user_name": "gh_86a091e50ad4@app",
"center_app_brand_pass": "pages/index/index",
"custom_url_name": "新品推荐",
"custom_url": "https://www.starbucks.com.cn/",
"custom_app_brand_user_name": "gh_86a091e50ad4@app",
"custom_app_brand_pass": "pages/index/index",
"need_push_on_view": true
},
"advanced_info": {
"text_image_list": [
{
"image_url": "http://mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sjpiby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0",
"text": "此菜品精选食材,以独特的烹饪方法,最大程度地刺激食 客的味"
},
{
"image_url": "http://mmbiz.qpic.cn/mmbiz/p98FjXy8LacgHxp3sJ3vn97bGLz0ib0Sfz1bjiaoOYA027iasqSG0sj piby4vce3AtaPu6cIhBHkt6IjlkY9YnDsfw/0",
"text": "此菜品迎合大众口味,老少皆宜,营养均衡"
}
]
},
"supply_balance": true,
"prerogative": "礼品卡享受更多优惠",
"auto_activate": true,
"init_balance": 10000,
"custom_field1": {
"name": "优惠券",
"url": "",
"app_brand_user_name": "",
"app_brand_pass": ""
},
"custom_field2": {
"name": "兑换券",
"url": "",
"app_brand_user_name": "",
"app_brand_pass": ""
}
}
}
}
' Request data explaination:
Gift Cards
Structure | Structure | field | Introductions | Required to fill in |
---|---|---|---|---|
card | The Coupon Information Section | yes | ||
card_type | GENERAL_CARD | The type of voucher. | yes | |
general_card | background_pic_url | Background picture for gift card | no | |
base_info | For basic voucher data, see the table below. All vouchers are generic. | yes | ||
advanced_info | Graphic illustration of the voucher | no | ||
sub_card_type | Card type, currently supported | yes | ||
GIFT_CARD GIFT CARD VOUCHER | ||||
auto_activate | Whether it is automatically activated or true if the developer does not require additional activation processes. | no | ||
supply_bonus | Whether support points, fill in true or false. Defaults to false | yes | ||
supply_balance | Whether the balance is supported, fill in true or false. Defaults to false | yes | ||
init_balance | Initial balance, the initial balance shown on the card surface after the user purchases the gift card | no | ||
custom_field1 | Custom member information category, membership card display after activation, including name and url fields | no | ||
custom_field2 | Custom member information category, membership card display after activation, including name and url fields | no | ||
custom_field3 | Custom member information category, membership card display after activation, including name and url fields | no | ||
name | Customize the name of the information category, | no | ||
url | Custom Information Category Jump url | no | ||
need_push_on_view | True is whether the event is pushed when the user clicks into the gift card. | no |
Note: Developers can only fill in supply_balance and custom_field1, custom_field2, and custom_field3 at most, otherwise an error is reported.
Description of base_info field
Structure | field | field | Introductions | Required to fill in |
---|---|---|---|---|
base_info | Basic Card Data | yes | ||
giftcard_info | price | The price of gift cards is divided into units | yes | |
logo_url | The merchant logo of the card coupon, the size is 300\ * 300, the logo must be uploaded to the CDN first, otherwise the error is reported. | yes | ||
max_give_friend_times | Maximum number of times a gift card can be given | yes | ||
code_type | Code code display type. | yes | ||
"CODE_TYPE_TEXT," text text; "CODE_TYPE_BARCODE," one dimensional code; "CODE_TYPE_QRCODE," two dimensional code; "CODE_TYPE_ONLY_QRCODE," binary code without code display; "CODE_TYPE_ONLY_BARCODE," one-dimensional code without code display; | yes | |||
brand_name | The name of the merchant is limited to 12 Chinese characters. (Complete the name of the merchant who directly provides the service) | yes | ||
title | The maximum number of characters for the ticket is 9 Chinese characters. (Recommendations cover card attributes, service and amount) | yes | ||
color | The color of the ticket. Fill in Color010-Color100 according to color specification | yes | ||
notice | Using reminders, the number of characters is limited to 12 Chinese characters. (A sentence description, displayed on the front page. Example: Please show a QR code to cancel the card.) | yes | ||
description | Use instructions. Long text description, which can be branched out, up to 1000 Chinese characters. | yes | ||
date_info | Date of use, expiration information. | yes | ||
type | Support for fixed duration valid type DATE_TYPE_FIX_TIME_RANGE Fixed date valid type DATE_TYPE FIX_TERM permanent valid type DATE_TYPE_PERMANENT | yes | ||
begin_timestamp | Used when type is DATE_TYPE_FIX_TIME_RANGE, indicating the start time. The number of seconds from 00: 00: 00 on January 1, 1970 to the start of operation shall eventually be converted into the form of a character string. (in seconds) | yes | ||
end_timestamp | Used when the type is DATE_TYPE_FIX_TIME_RANGE, indicating the end time. (in seconds) | yes | ||
fixed_term | Used when the type is DATE_TYPE_FIX_TERM, indicating how many days after collection. (In units of days) Complete 0 as valid on the day of receipt. | yes | ||
fixed_begin_term | Used when type is DATE_TYPE_FIX_TERM, indicating how many days after collection. (In units of heavens) | yes | ||
sku | Information about commodities. | yes | ||
quantity | The number of coupons in stock, we recommend filling in a larger value. | yes | ||
location_id_list | Store Location ID. Merchants need to enter the store information on the mp platform or call the batch import store information interface to get the store location ID. | no | ||
use_all_locations | All stores, set up vouchers to support all stores, fill in true or false, do not fill on behalf of the default is false. | yes | ||
use_custom_code | Whether custom code code. Fill in true or false, do not fill in the default is false. | no | ||
bind_openid | Whether to specify the user to receive, fill in true or false, gift card suggested to fill in false. | no | ||
can_share | Whether the original page of the card voucher can be shared, fill in true or false, gift cards suggest filling in false. | no | ||
can_give_friend | Whether the voucher can be transferred, fill in true or false, true representative can be transferred. Defaults to true. | no | ||
get_limit | For a maximum number of receipts per person, you must fill in 0. | no | ||
service_phone | Call customer service. | no | ||
center_title | The buttons in the Gift Card Center, which are only displayed when the voucher form is normal (can be written off), are recommended for guiding the use or up-to-date process | no | ||
center_sub_title | Guide wording of the center button | no | ||
center_url | Link to the middle entrance to the house | no | ||
custom_url_name | Merchant custom entry name, used with custom_url field, the length is limited to 5 Chinese characters. | no | ||
center_app_brand_user_name | Custom cell corresponding Weixin Mini Program username, formatted as Service Account original id @ app | no | ||
center_app_brand_pass | Weixin Mini Program path corresponding to custom cell | no | ||
custom_url | The merchant customizes the entry to redirect the address link of the external link, and the content of the redirect page must match the name of the custom cell. | no | ||
custom_url_sub_title | The tips displayed on the right side of the entrance are limited to 6 characters in length. | no | ||
custom_app_brand_user_name | Custom cell corresponding Weixin Mini Program username, formatted as Service Account original id @ app | no | ||
custom_app_brand_pass | Weixin Mini Program path corresponding to custom cell | no | ||
promotion_url_name | Custom entry points for marketing scenarios. | no | ||
promotion_url | Enter Jump to the address link of the external link. | no | ||
promotion_app_brand_user_name | Custom cell corresponding Weixin Mini Program username, formatted as Service Account original id @ app | no | ||
promotion_app_brand_pass | Weixin Mini Program path corresponding to custom cell | no |
Advanced_info Field Description
Structure | field | Introductions | Is it compulsory? |
---|---|---|---|
advanced_info | If the voucher is a redeeming card, it can be set as a picture explaination to explain the detailed parameters of the item | no | |
text_image_list | Graphic List Structures | no | |
image_url | Product explaination drawings must be uploaded to cdn | no | |
text | Text explaination of the product | no |
Example of returned data:
{
"errcode":0,
"errmsg":"ok",
"card_id":"p1Pj9jr90_SQRaVqYI239Ka1erkI"
}
Returning data instructions
field | Introductions |
---|---|
errcode | Error code, 0 is normal |
errmsg | Error message |
NOTE:
.
For gift cards supporting dynamic codes, please refer to the documentation: https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1478005752&version=1&lang=zh_CN&platform=2
Gift Card Shelf
7.1 Shelf style
For information purposes, based on actual implementation:
7.2 Create - Gift Card Shelf Interface Interface explaination Developers can use this interface to create a gift card shelf and for Service Account, store gift card sales. Interface Invocation Request Dxplaination | Protocol | HTTPS |
|--------------|----------------------------------------------------------------------------|
| http Request Mode | POST |
| Request Url | https://api.weixin.qq.com/card/giftcard/page/add?access_token=ACCESS_TOKEN |
| POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"page": {
"page_title": "礼品卡",
"support_multi": true,
"banner_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"theme_list": [
{
"theme_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"title": "title",
"title_color": "#FB966E",
"show_sku_title_first": true,
"item_list": [
{
"card_id": "pbLatjiSj_yVRH5XTb2Zsln7DNQg",
"title": "焦糖拿铁"
},
{
"card_id": "pbLatjlq75CPBR_tYCRdPlxSGlOs",
"title": "焦糖拿铁"
}
],
"pic_item_list": [
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语1"
},
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语2"
},
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语3"
}
],
"category_index": 0
},
{
"theme_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"title": "title_lalala",
"title_color": "#FB966E",
"item_list": [
{
"card_id": "pbLatjiSj_yVRH5XTb2Zsln7DNQg",
"title": "焦糖拿铁"
},
{
"card_id": "pbLatjlq75CPBR_tYCRdPlxSGlOs",
"title": "蛋糕"
}
],
"pic_item_list": [
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语1",
"outer_img_id": "outer_img_id_1"
},
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语2",
"outer_img_id": "outer_img_id_2"
},
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语3",
"outer_img_id": "outer_img_id_3"
}
],
"category_index": 1
},
{
"theme_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"title": "title_lalala",
"title_color": "#FB966E",
"item_list": [
{
"card_id": "pbLatjiSj_yVRH5XTb2Zsln7DNQg"
},
{
"card_id": "pbLatjlq75CPBR_tYCRdPlxSGlOs"
}
],
"pic_item_list": [
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语1",
"outer_img_id": "outer_img_id_1"
},
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语2",
"outer_img_id": "outer_img_id_2"
},
{
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/p98FjXy8LafBWIJsGFe7tlPvtBFxXXTPdx5cEuFMcWWsiaR1DyrN5ML3jiaVYZibovA8OrwOylUia6ywvVU6Aqboibw/0",
"default_gifting_msg": "祝福语3",
"outer_img_id": "outer_img_id_3"
}
],
"is_banner": true
}
],
"category_list": [
{
"title": "主题分类一"
},
{
"title": "主题分类二"
}
],
"address": "广州市海珠区222号",
"service_phone": "020-12345678",
"biz_description": "退款指引",
"cell_1": {
"title": "申请发票",
"url": "https://open.weixin.qq.com"
},
"cell_2": {
"title": "申请退款",
"url": "https://mp.weixin.qq.com"
}
}
}
Dxplaination of requested data:
Structure | parameter | Introductions | Is it compulsory? |
---|---|---|---|
page | The shelf information structure, containing the following fields | ||
page_title | Gift Card Shelf Name | yes | |
support_multi | Whether to support a purchase of multiple and send to the group, fill in true or false, if filled in true support, default to false | no | |
support_buy_for_self | Gift card shelves support to buy their own, fill in true or false, if filled in true support, default to false | no | |
banner_pic_url | The banner image at the top of the theme page of the gift card shelf must be uploaded to the CDN first, the recommended size is 750px\ * 630px | yes | |
theme_list | The theme is a JSON structure. | yes | |
category_list | List of topic categories | no | |
address | Business address | yes | |
service_phone | Merchant service telephone | yes | |
biz_description | Merchants use instructions to describe the process of refunds, invoices, etc. | yes | |
need_receipt | Whether the order of the shelf supports invoicing, fill in true or false, if filled in true, you need to debug the process of document 2.2, default is false | no | |
cell_1 | Merchant custom links to carry out refunds, invoices, etc. | yes | |
cell_2 | Merchant custom links to carry out refunds, invoices, etc. | yes |
Theme_list is a JSON structure that contains the following fields
parameter | parameter | Introductions | Is it compulsory? |
---|---|---|---|
theme_list | Theme Structure that contains the following fields | yes | |
theme_pic_url | The cover image of the theme must be uploaded to the CDN first, and the size is controlled at 1000px\ * 600px | yes | |
title | Theme names such as "Christmas" and "Thank You to Your Family" | yes | |
title_color | The color of the theme title, directly passed in the color value | yes | |
item_list | List of gift cards, identifying the denominations available for the subject | yes | |
pic_item_list | List of cover | yes | |
category_index | Subject number, corresponding to the title field in category_list, if the category_list is filled in, the serial number is required for each topic | yes | |
show_sku_title_first | Does the subject purchase page highlight the trade name? | no | |
is_banner | Whether to set the current theme as a banner theme (main recommendation) | no |
Item_list and pic_item_list are JSON structures that contain the following fields
parameter | parameter | Introductions | Is it compulsory? |
---|---|---|---|
item_list | Product structure, containing the following fields | ||
card_id | The card_id to be listed | yes | |
title | Trade name, not filled in, default card name | yes | |
pic_url | Product thumbnail, 1000 pixels \ * 600 pixels below | yes | |
desc | Product Description | yes | |
pic_item_list | Card surface structure that contains the following fields | yes | |
background_pic_url | The card surface picture, must first upload the picture to the CDN, the size control is 1000 pixels\ * 600 pixels below | yes | |
outer_img_id | Identity for custom card surfaces | no | |
default_gifting_msg | The card has a default blessing message that is filled with the card when the user has not edited the content by default. | yes |
Cell1 and cell2 are JSON structures that contain the following fields
Structure | parameter | Introductions | Is it compulsory? |
---|---|---|---|
cell | Merchants customize the service entry structure, which contains the following fields | yes | |
title | Customize the entry name | yes | |
url | Custom entry links | yes |
Category_list is a JSON structure containing the following fields
Structure | parameter | Introductions | Is it compulsory? |
---|---|---|---|
category_list | Topic categorization structure contains the following fields | no | |
title | Name of the topic category | no |
# Return parameter explaination
Example of returned data:
{
"errcode": 0,
"errmsg": "ok",
"page_id": "abcedfghifk=+Uasdaseq14fadkf8123h4jk"
}
Return data explaination:
field | Introductions |
---|---|
errcode | Error code, 0 is normal |
errmsg | Error message |
page_id | The id of the shelf, which is used to check the shelf details and get the link to access the shelf |
Note
1. Shelf Link Splice Rules
Make the page_id UrlEncode After **Replace the value of the page_ID parameter to the link below to access the homepage of the shopping page.
https://mp.weixin.qq.com/bizmall/giftcard?action=homepage&page_id=123456#wechat_redirect
If page_id is: abcedfghifk = + Uasdaseq14fadkf8123h4jk
UrlEncode after: abcedfghifk% 3d% 2bUasdaseq14fadkf8123h4jk
After joining the link:
https://mp.weixin.qq.com/bizmall/giftcard?action=homepage&page_id= abcedfghifk%3d%2bUasdaseq14fadkf8123h4jk #wechat_redirect
2. Statistics on channels
Provide an outer_str field for channel differentiation, which will flow through the page, and then get the corresponding field in the query API or the relevant callback.
For example outer_str = abc:
The above link becomes:
https://mp.weixin.qq.com/bizmall/giftcard?action=homepage&page_id=123456&outer_str=abc#wechat_redirect
If page_id is: abcedfghifk = + Uasdaseq14fadkf8123h4jk
UrlEncode after: abcedfghifk% 3d% 2bUasdaseq14fadkf8123h4jk
After joining the link:
https://mp.weixin.qq.com/bizmall/giftcard?action=homepage&page_id=abcedfghifk%3d%2bUasdaseq14fadkf8123h4jk#wechat_redirect
3. The shelf outer link jump protocol
The url in the cell, the jump brings in order_id and openid in the GET parameter
For example, the original data is
https://mp.weixin.qq.com will become
https://mp.weixin.qq.com/?order_id=Z2y2rY4UxUZYitvVGA&openid=oAAAAAKe1ri5AAaAiB50-Ak6Vs1w
4. Set up a audit whitelist
The shelf created is awaiting review and cannot be viewed for purchase by outsiders, and must be applied for online and approved before it can be completed.
Developers can whitelist their WeChat numbers for testing processes. The interface can be found in [mp.weixin.qq.com] - [Cards section] - - [Place cards] - "Set a voucher whitelist"]
# 7.3 Queries - Gift Card Shelf Information Interface
Interface Dxplaination
Developers can query a gift card shelf information.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/giftcard/page/get?access_token=ACCESS_TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"page_id" : "abcedfghifk=+Uasdaseq14fadkf8123h4jk"
}
Dxplaination of requested data:
parameter | Introductions | Is it compulsory? |
---|---|---|
page_id | Previous Get the shelf id | yes |
Example of returned data:
Request Data Dxplaination: Parameter Dxplaination Is page_id required Previous step Get to the shelf id is Return Parameter Dxplaination Return Data Example:
{
"errcode": 0,
"errmsg": "ok",
"page": {
"banner_pic_url": "http://img.com/banner_pic",
"theme_list": [
{
"theme_pic_url": "http://img.com/theme_pic",
"title": "title_lalala",
"title_color": "#FFFFFF",
"item_list": [
{
"card_id": "card_id_lalala"
}
],
"pic_item_list": [
{
"background_pic_url": "http://img.com/bg_pic1",
"default_gifting_msg": "祝福语1"
},
{
"background_pic_url": "http://img.com/bg_pic2",
"default_gifting_msg": "祝福语2"
},
{
"background_pic_url": "http://img.com/bg_pic3",
"default_gifting_msg": "祝福语3"
}
]
}
]
}
}
Return data explaination:
parameter | parameter | Introductions |
---|---|---|
errcode | Error code | |
errmsg | Error message | |
page | The shelf information structure, containing the following fields | |
banner_pic_url | The banner image at the top of the theme page of the gift card shelf must be uploaded to the CDN first | |
support_multi | Do you support buying multiple copies at once and sending them to a group? | |
support_buy_for_self | Does Gift Card Shelf Support Buying For You? | |
theme_list | The theme is a JSON structure. | |
category_list | List of topic categories | |
address | Business address | |
service_phone | Merchant service telephone | |
biz_description | Merchants use instructions to describe the process of refunds, invoices, etc. | |
cell_1 | Merchant custom links to carry out refunds, invoices, etc. | |
cell_2 | Merchant custom links to carry out refunds, invoices, etc. |
Theme_list is a JSON structure that contains the following fields
parameter | parameter | Introductions |
---|---|---|
theme_list | Theme Structure that contains the following fields | |
theme_pic_url | The cover image of the theme must be uploaded to the CDN first | |
title | Theme names such as "Christmas" and "Thank You to Your Family" | |
title_color | The color of the theme title, directly passed in the color value | |
item_list | List of gift cards, identifying the denominations available for the subject | |
pic_item_list | List of cover | |
category_index | Subject number, corresponding to the title field in category_list, if the category_list is filled in, the serial number is required for each topic | |
is_banner | Whether to set the current theme as a banner theme (main recommendation) |
Item_list and pic_item_list are JSON structures that contain the following fields
parameter | parameter | Introductions |
---|---|---|
item_list | Product structure, containing the following fields | |
card_id | The card_id to be listed | |
pic_item_list | Card surface structure that contains the following fields | |
background_pic_url | Card picture, must first upload the picture to the CDN | |
outer_img_id | Identity for custom card surfaces | |
default_gifting_msg | The card has a default blessing message that is filled with the card when the user has not edited the content by default. |
Cell1 and cell2 are JSON structures that contain the following fields
parameter | parameter | Introductions |
---|---|---|
cell | Merchants customize the service entry structure, which contains the following fields | |
title | Customize the entry name | |
url | Custom entry links |
Category_list is a JSON structure containing the following fields
parameter | Introductions | |
---|---|---|
category_list | Topic categorization structure contains the following fields | |
title | Name of the topic category |
# 7.4 Modify - Gift Card Shelf Information Interface
Interface Dxplaination
Developers can update gift card shelf information through this interface.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/giftcard/page/update?access_token=ACCESS_TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"page": {
"page_id": "abcedfghifk=+Uasdaseq14fadkf8123h4jk",
"banner_pic_url": "http://img.com/banner_pic",
"theme_list": [
{
"theme_pic_url": "http://img.com/theme_pic",
"title": "title_lalala",
"title_color": "#FFFFFF",
"item_list": [
{
"card_id": "card_id_lalala"
}
],
"pic_item_list": [
{
"background_pic_url": "http://img.com/bg_pic1",
"default_gifting_msg": "祝福语1"
},
{
"background_pic_url": "http://img.com/bg_pic2",
"default_gifting_msg": "祝福语2"
},
{
"background_pic_url": "http://img.com/bg_pic3",
"default_gifting_msg": "祝福语3"
}
]
}
]
}
}
Dxplaination of requested data:
parameter | parameter | Introductions | Is it compulsory? |
---|---|---|---|
page | The shelf information structure, containing the following fields | ||
page_id | Shelf id to be modified | yes | |
banner_pic_url | The banner image at the top of the theme page of the gift card shelf must be uploaded to the CDN first | yes | |
theme_list | The theme is a JSON structure. | yes | |
category_list | List of topic categories | no | |
address | Business address | yes | |
service_phone | Merchant service telephone | yes | |
biz_description | Merchants use instructions to describe the process of refunds, invoices, etc. | yes | |
cell_1 | Merchant custom links to carry out refunds, invoices, etc. | yes | |
cell_2 | Merchant custom links to carry out refunds, invoices, etc. | yes |
Theme_list is a JSON structure that contains the following fields
parameter | parameter | Introductions | Is it compulsory? |
---|---|---|---|
theme_list | Theme Structure that contains the following fields | ||
theme_pic_url | The cover image of the theme must be uploaded to the CDN first | yes | |
title | Theme names such as "Christmas" and "Thank You to Your Family" | yes | |
title_color | The color of the theme title, directly passed in the color value | yes | |
item_list | List of gift cards, identifying the denominations available for the subject | yes | |
pic_item_list | List of cover | yes | |
category_index | Subject number, corresponding to the title field in category_list, if the category_list is filled in, the serial number is required for each topic | yes | |
is_banner | Whether to set the current theme as a banner theme (main recommendation) | no |
Item_list and pic_item_list are JSON structures that contain the following fields
parameter | parameter | Introductions | Is it compulsory? |
---|---|---|---|
item_list | Product structure, containing the following fields | ||
card_id | The card_id to be listed | yes | |
pic_item_list | Card surface structure that contains the following fields | ||
background_pic_url | Card picture, must first upload the picture to the CDN | yes | |
outer_img_id | Identity for custom card surfaces | no | |
default_gifting_msg | The card has a default blessing message that is filled with the card when the user has not edited the content by default. | yes |
Cell1 and cell2 are JSON structures that contain the following fields
parameter | parameter | Introductions | Is it compulsory? |
---|---|---|---|
cell | Merchants customize the service entry structure, which contains the following fields | ||
title | Customize the entry name | yes | |
url | Custom entry links | yes |
Category_list is a JSON structure containing the following fields
parameter | parameter | Introductions | Is it compulsory? |
---|---|---|---|
category_list | Topic categorization structure contains the following fields | ||
title | Name of the topic category | no |
# Return parameter explaination
Example of returned data:
{
"errcode" : 0,
"errmsg" : "ok"
}
Return data explaination:
parameter | Introductions |
---|---|
errcode | Error code |
errmsg | Error message |
# 7.5 Queries - Gift Card Shelf List Interface
Interface Dxplaination
Developers can query all the gift card shelf id under the current merchant through this interface.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/giftcard/page/batchget?access_token=ACCESS_TOKEN |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{}
# Return parameter explaination
Example of returned data:
{
"errcode": 0,
"errmsg": "ok",
"page_id_list": [
"abcedfghifk=+Uasdaseq14fadkf8123h4jk",
"abcedfghifk=+Uasdaseq14fadkf8123h4jl",
"abcedfghifk=+Uasdaseq14fadkf8123h4jm",
"abcedfghifk=+Uasdaseq14fadkf8123h4jn"
]
}
Return data explaination:
parameter | Introductions |
---|---|
errcode | Error code |
errmsg | Error message |
page_id_list | Gift Card Shelf ID List |
# 7.6 Removal - Gift Card Shelf Interface
Interface Dxplaination
Developers can query all the gift card shelf id under the current merchant through this interface.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/giftcard/maintain/set?access_token=ACCESS_TOKEN |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Dxplaination of request parameters:
parameter | Introductions |
---|---|
page_id | Page_id that needs to be taken down |
all | |
maintain |
Examples of POST data:
Set a shelf to leave shelves
{
"page_id": "abcedfghifk=+Uasdaseq14fadkf8123h4jk",
"maintain": true
}
Or set all shelves under this merchant to be off shelves
{
"all": true,
"maintain": true
}
Example of returned data:
{
"errcode": 0,
"errmsg": "ok",
"control_info": {
"biz_control_type": "E_PAGE_CONTROL_BIZ",
"system_biz_control_type": "E_PAGE_CONTROL_NORMAL",
"list": [
{
"page_id": "abcedfghifk=+Uasdaseq14fadkf8123h4jk",
"page_control_type": "E_PAGE_CONTROL_BIZ",
"system_page_control_type": "E_PAGE_CONTROL_SYSTEM"
}
]
}
}
Return data explaination:
parameter | Introductions |
---|---|
errcode | Error code |
errmsg | Error message |
control_info | Structures that control outcomes |
Control_info is a construct with the following fields
parameter | Introductions |
---|---|
biz_control_type | The merchant controls the status of all shelves under the AppID |
system_biz_control_type | The system controls all shelf status under the merchant AppID |
list | The completion of the page list, for all the page lists under the merchant |
Listo is a construct containing the following fields
parameter | Introductions |
---|---|
page_id | Unique id of the page |
page_control_type | The status of shelves controlled by merchants |
system_page_control_type | The shelf status controlled by the system |
# 8.Gift Card Weixin Mini Program
# 8.1 Open WeChat Payment Gift Card Access
# 8.1.1 Request WeChat Payment Gift Card Access Interface
url:
https://api.weixin.qq.com/card/giftcard/pay/whitelist/add?access_token=TOKEN
Example Requests
{
"sub_mch_id": "1900015421"//微信支付子商户号
}
Return an example
{
"errcode": 0,
"errmsg": "ok",
"url": "https://pay.weixin.qq.com/index.php/public/product/detail?pid=61&productType=0"
}
Note
- The incoming merchant number must be either a regular service provider model or a connected merchant number, which is recommended as a gift card-specific merchant number
2.Service Account must be the merchant number applied for, otherwise the error is reported
3.The token of the calling interface must be the token corresponding to Service Account, otherwise an error is reported
4.The Service Account of the calling interface must be the same subject as the merchant number, and the case of different subjects must contact the docking person for application. If the subject of Service Account and Weixin Mini Program of the Gift Card are inconsistent with the subject of the Merchant Number, the following process is required: 1. Find the corresponding WeChat payment BD to sign the Service Account -merchant number and Weixin Mini Program -merchant number joint operating letter, and file 2. Send the following to weixincard@tencent.com Email Name: xxx Gift Card Payment Binding Application Message content: Service Account Name Certification Service Account AppID Service Account Subject information Certification Weixin Mini Program AppID Weixin Mini Program Subject information Gift Card Special Merchant Number The company name corresponding to the merchant number
_3. Upon confirmation that the information is correct, we will process it within five business days;
# 8.1.2 Log in to the merchant platform's back office and click confirmation
After completing Step 4.1, the merchant must click on the URL returned from Step 4.1 to log in WeChat Pay the merchant back office, click on confirmation to open the gift card payment function, and complete the opening of the gift card pay function.
1 Click 4.1 to get the url,. Login WeChat Payment Merchant Background
2.Login and enter the product center, find [WeChat gift card] click to open
3. Click to open the Gift Card feature
8.2 Binding Merchant Number to Gift Card Weixin Mini Program interface
---- URL https://api.weixin.qq.com/card/giftcard/pay/submch/bind?access_token=TOKEN Sample request
{
"sub_mch_id": "1900015421",
"wxa_appid": "wx8638fbedaf138a87"
}
Return an example
{
"errcode": 0,
"errmsg": "ok"
}
Note
- The incoming merchant number must be either a regular service model or a connected merchant number, and it is recommended that the gift card specific merchant number be used;
2.The merchant number must be the merchant number applied for Service Account, otherwise the error is reported;
3.The token of the calling interface is the token of Service Account;
4.Service Account must be associated with the gift card Weixin Mini Program. For details, please see: https://mp.weixin.qq.com/debug/wxadoc/introduction/# service number associated Mini Program
# 8.3 Upload the Weixin Mini Program code
# 8.3.1 Upload Weixin Mini Program code
URL
https://api.weixin.qq.com/card/giftcard/wxa/set ?access_token=TOKEN
Example Requests
{
"wxa_appid": "wx123456789",
"page_id": "asdasdjkafkjaslfjasl+fjas="
}
Return an example
{
"errcode": 0,
"errmsg": "ok"
}
Note
1.Service Account must be bound to Weixin Mini Program;
2.Weixin Mini Program After the code is uploaded, you must log in the Mini Program background for submission for audit;
# 8.3.2 Log in to Weixin Mini Program background for publishing
Fill out the gift card Weixin Mini Program Basic information
Developers must log in to Weixin Mini Program background mp.weixin.qq.com after completing the 5.1 steps, fill in the relevant information about the Mini Program and release the audit
Release an Experienced Version Test
Click to submit an audit
Click to submit to post
# 9. Gift Card Orders
# 9.1 Queries - Single Gift Card Order Information Interface
Interface Dxplaination
Developers can use this interface to query the order details corresponding to an order number.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/giftcard/order/get?access_token=ACCESS_TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"order_id" : "Z2y2rY74ksZX1ceuGA"
}
Dxplaination of request parameters:
parameter | Introductions |
---|---|
order_id | Gift card order number, which merchants can obtain through event push of successful purchase or bulk inquiry of the order interface |
# Return parameter explaination
Example of returned data:
{
"errcode": 0,
"errmsg": "ok",
"order": {
"order_id": "Z2y2rY74ksZX1ceuGA",
"page_id": "abcedfghifk=+Uasdaseq14fadkf8123h4jk",
"trans_id": "4001562001201608292531663351",
"create_time": 123,
"pay_finish_time": 123,
"total_price": 123,
"open_id": "123",
"accepter_openid": "123",
"card_list": [
{
"card_id": "card_id_1",
"price": 123,
"code": "code_123456",
"default_gifting_msg": "",
"background_pic_url": "",
"accepter_openid": "123"
}
],
"outer_str": "web",
"IsChatRoom": true
}
}
Return data explaination:
parameter | parameter | Introductions | |
---|---|---|---|
errcode | Error code | ||
errmsg | Error message | ||
order | Order structure that contains the following fields | ||
order_id | order number | ||
page_id | The id of the shelf | ||
trans_id | WeChat Payment Transaction Order Number | ||
create_time | Order creation time, ten-digit timestamp (UTC + 8) | ||
pay_finish_time | Order payment completion time, ten-digit time stamp (UTC + 8) | ||
total_price | The total amount, divided into units | ||
open_id | Buyer's openid | ||
accepter_openid | Receiver's openid | ||
outer_str | Channel parameters for purchasing shelf | ||
IsChatRoom | Whether the corresponding gift card for the order was sent to the group | ||
card_list | Card list structure that contains the following fields | ||
card_id | List of purchased cards card_id | ||
price | The price of the card | ||
code | Code obtained by the user | ||
default_gifting_msg | Default blessing. The field is empty when the user fills in a blessing | ||
background_pic_url | Background chart chosen by the user | ||
outer_img_id | Custom Card Notes | ||
accepter_openid | When the gift card is sent to the group, the recipient's openid |
# 9.2 Queries - bulk queries for gift card order information interface
Interface Dxplaination
Developers can use this interface to query the details of all orders created by the merchant during a certain period of time.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/giftcard/order/batchget?access_token=ACCESS_TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"begin_time": 1472400000,
"end_time": 1472716604,
"sort_type": "ASC",
"offset": 0,
"count": 2
}
Dxplaination of request parameters:
parameter | Introductions |
---|---|
begin_time | Time start of the query, ten-digit timestamp (utc + 8) |
end_time | Time end of the query, ten-digit timestamp (UTC + 8) |
sort_type | Fill in "ASC" / "DESC," indicating the order creation time to "up / down" sort |
offset | The number of order shifts queried. If you fill in 100, you start pulling from the 100th order |
count | The number of inquiry orders, such as offset to fill in 100, count to fill in 10, it means that the inquiry from the 100th to the 110th order |
# Return parameter explaination
Example of returned data:
{
"errcode": 0,
"errmsg": "ok",
"total_count": 47,
"order_list": [
{
"order_id": "Z2y2rY74ksZX1ceuGA",
"page_id": "abcedfghifk=+Uasdaseq14fadkf8123h4jk",
"trans_id": "4001562001201608292531663351",
"create_time": 123,
"pay_finish_time": 123,
"total_price": 123,
"open_id": "123",
"accepter_openid": "123",
"card_list": [
{
"card_id": "card_id_1",
"price": 123,
"code": "code_123456",
"default_gifting_msg": "",
"background_pic_url": "",
"accepter_openid": "123"
}
],
"outer_str": "web","IsChatRoom": true
},
{
"order_id": "Z2y2rY74ksZX1ceuGA",
"page_id": "abcedfghifk=+Uasdaseq14fadkf8123h4jk",
"trans_id": "4001562001201608292531663351",
"create_time": 123,
"pay_finish_time": 123,
"total_price": 123,
"open_id": "123",
"accepter_openid": "123",
"card_list": [
{
"card_id": "card_id_1",
"price": 123,
"code": "code_123456",
"default_gifting_msg": "",
"background_pic_url": ""
}
],
"outer_str": "web"
}
]
}
Return data explaination:
parameter | Introductions | ||
---|---|---|---|
errcode | Error code | ||
errmsg | Error message | ||
total_count | Total orders | ||
order_list | Order List Structure | ||
order | Order structure that contains the following fields | ||
order_id | order number | ||
page_id | The id of the shelf | ||
trans_id | WeChat Payment Transaction Order Number | ||
create_time | Order creation time, ten-digit timestamp (UTC + 8) | ||
pay_finish_time | Order payment completion time, ten-digit time stamp (UTC + 8) | ||
total_price | The total amount, divided into units | ||
open_id | Buyer's openid | ||
accepter_openid | Receiver's openid | ||
outer_str | Channel parameters for purchasing shelf | ||
IsChatRoom | Whether the corresponding gift card for the order was sent to the group | ||
card_list | Card list structure that contains the following fields | ||
card_id | List of purchased cards card_id | ||
price | The price of the card | ||
code | Code obtained by the user | ||
default_gifting_msg | Default blessing. The field is empty when the user fills in a blessing | ||
background_pic_url | Background chart chosen by the user | ||
accepter_openid | When the gift card is sent to the group, the recipient's openid |
NOTE:
The total_count returned is the total_count under the current query condition, similar to the paging implementation changing the offset / count until the\ $offset + count of a request \ ge total_, count\ $indicates the end of pull.
begin_time and end_time cannot span more than 31 days.
The count cannot exceed 100.
The sort_type can be filled with "ASC" / "DESC," which indicates the "up / down" sort of order creation time.
# 10. Gift Card Related Events
Special Notes
As a money transaction, the merchant may have its own needs such as reconciliation, so the merchant's CallBack guarantees a higher stability.
If the merchant does not accept CallBack, within 24 hours, the maximum push, up to 30 times.
Unlike the normal CallBack event, after receiving the CallBack, the merchant in the Http protocol, in addition to returning 200 in the header, also needs to return in the Content:
<xml\>ok</xml\>
To tell the WeChat platform that the merchant really received the CallBack and successfully processed it
Otherwise, the WeChat platform will continue to retry the push.
# 10.1, user purchase gift card payment success CallBack
agreement
<xml>
<ToUserName><![CDATA[gh_3fcea188bf78]]></ToUserName>
<FromUserName><![CDATA[obLatjgoYejavUtHsWwrX-2GtFJE]]></FromUserName>
<CreateTime>1472631550</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[giftcard_pay_done]]></Event>
<PageId><![CDATA[OQK0R3MaFnCm74Phw5hwFJlz5sn+jy1zzM2amDidDbU=]]></PageId>
<OrderId><![CDATA[Z2y2rY74ksZX1ceuGA]]></OrderId>
</xml>
Dxplaination of request parameters:
parameter | Introductions |
---|---|
ToUserName | Receives the Service Account original id of the event |
FromUserName | Event initiator, in which the openid identifies the person placing the order |
CreateTime | Event creation time |
MsgType | Message Type |
Event | Event type, where giftcard_pay_done identifies the order completion event |
PageId | The id of the shelf |
OrderId | order number |
# 10.2, the user after purchase gift CallBack
agreement
<xml>
<ToUserName><![CDATA[gh_3fcea188bf78]]></ToUserName>
<FromUserName><![CDATA[obLatjgoYejavUtHsWwrX-2GtFJE]]></FromUserName>
<CreateTime>1472631550</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[giftcard_send_to_friend]]></Event>
<PageId><![CDATA[OQK0R3MaFnCm74Phw5hwFJlz5sn+jy1zzM2amDidDbU=]]></PageId>
<OrderId><![CDATA[Z2y2rY74ksZX1ceuGA]]></OrderId>
<IsChatRoom>true</IsChatRoom>
<IsReturnBack><![CDATA[true]]></IsReturnBack>
</xml>
Dxplaination of request parameters:
parameter | Introductions |
---|---|
ToUserName | Receives the Service Account original id of the event |
FromUserName | Event initiator, in which the openid identifies the person placing the order |
CreateTime | Event creation time |
MsgType | Message Type |
Event | Type of event, identification gift card has been given |
PageId | The id of the shelf |
OrderId | order number |
IsChatRoom | Whether the gift card is sent to the group, true is |
IsReturnBack | Identify whether the gift card is returned to the card bag because it has not been collected for more than 24 hours. True indicates a timeout to return the card package. |
# 10.3, the user receives the gift card successfully CallBack
agreement
<xml>
<ToUserName><![CDATA[gh_3fcea188bf78]]></ToUserName>
<FromUserName><![CDATA[obLatjgoYejavUtHsWwrX-2GtFJE]]></FromUserName>
<CreateTime>1472631800</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[giftcard_user_accept]]></Event>
<PageId><![CDATA[OQK0R3MaFnCm74Phw5hwFJlz5sn+jy1zzM2amDidDbU=]]></PageId>
<OrderId><![CDATA[Z2y2rY74ksZX1ceuGA]]></OrderId>
<IsChatRoom>true</IsChatRoom>
</xml>
Dxplaination of request parameters:
parameter | Introductions |
---|---|
ToUserName | Receives the Service Account original id of the event |
FromUserName | Event initiator, the openid of the recipient in the event |
CreateTime | Event creation time |
MsgType | Message Type |
Event | Event type, where giftcard_user_accept identifies the order completion event |
PageId | The id of the shelf |
OrderId | order number |
IsChatRoom | Whether the gift card is sent to the group, true is |
# 10.4. Event after giving a gift for 24 hours is not received back by the other party
If the other party does not collect the gift card for 24 hours, the gift card will automatically be placed in the user card package, and when the card is re-represented and collected again, the push event becomes a normal re-re-collect event.
Receive
agreement
<xml>
<ToUserName> <![CDATA[gh_fc0a06a20993]]> </ToUserName>
<FromUserName> <![CDATA[oZI8Fj040-be6rlDohc6gkoPOQTQ]]> </FromUserName>
<CreateTime>1472551036</CreateTime>
<MsgType> <![CDATA[event]]> </MsgType>
<Event> <![CDATA[user_get_card]]> </Event>
<CardId> <![CDATA[pZI8Fjwsy5fVPRBeD78J4RmqVvBc]]> </CardId>
<IsGiveByFriend>0</IsGiveByFriend>
<UserCardCode> <![CDATA[226009850808]]> </UserCardCode>
<FriendUserName> <![CDATA[]]> </FriendUserName>
<OldUserCardCode> <![CDATA[]]> </OldUserCardCode>
</xml>
Dxplaination of request parameters:
parameter | Introductions |
---|---|
ToUserName | Receives the Service Account original id of the event |
FromUserName | Event initiator, the openid of the recipient in the event |
CreateTime | Event creation time |
MsgType | Message Type |
Event | Event type, where the user_get_card identifies the ordinary card coupon collection |
CardId | Cardid |
IsGiveByFriend | Is it a gift from a friend? |
UserCardCode | Code received by the user |
FriendUserName | Initiator openid |
OldUserCardCode | The old code, if it is a non-custom code, when the gift WeChat will change the user's code, non-custom code merchants ignore the rule. |
Gift giving
agreement
<xml>
<ToUserName><![CDATA[gh_3fcea188bf78]]></ToUserName>
<FromUserName><![CDATA[obLatjjwDolFjRRd3doGIdwNqRXw]]></FromUserName>
<CreateTime>1474181868</CreateTime>
<MsgType><![CDATA[event]]></MsgType>
<Event><![CDATA[user_gifting_card]]></Event>
<CardId><![CDATA[pbLatjhU-3pik3d4PsbVzvBxZvJc]]></CardId>
<UserCardCode><![CDATA[297466945104]]></UserCardCode>
<IsReturnBack>0</IsReturnBack>
<FriendUserName><![CDATA[obLatjlNerkb62HtSdQUx66C4NTU]]></FriendUserName>
<IsChatRoom>0</IsChatRoom>
</xml>
Dxplaination of request parameters:
parameter | Introductions |
---|---|
ToUserName | Receives the Service Account original id of the event |
FromUserName | Event initiator, the openid of the recipient in the event |
CreateTime | Event creation time |
MsgType | Message Type |
Event | Event type, where the user_get_card identifies the ordinary card coupon collection |
CardId | Cardid |
IsReturnBack | Whether it is a re-gift return, 1 means a retreat return and 0 means an initiated gift |
UserCardCode | Code received by the user |
FriendUserName | Initiator openid |
IsChatRoom | Whether to send to a group |
# 11. Use Gift Cards
# 11.1 How Gift Cards Are Used
Offline Use Online Use
Offline use of : The gift card created by the developer uses a QR code or bar code as a debit identification code. When the user arrives at the store, the user presents the QR code / bar code, and the merchant's POS identification requests WeChat to ask for identity and make a balance debit action.
Online use : After a user purchases a gift card, on the gift card surface, the user jumps to the merchant's online store to select, purchase, and defaultly selects the "gift card" payment channel when placing an order.Upon receipt of a debit request, a merchant may request a balance change to WeChat.
# 11.2 Update the user gift card information interface
Interface Dxplaination
Once a gift card has been used, a developer can change the balance information of a giftcard through this interface.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/generalcard/updateuser?access_token=TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"code": "12312313",
"card_id": "p1Pj9jr90_SQRaVqYI239Ka1erkI",
"background_pic_url": "https://mmbiz.qlogo.cn/mmbiz/0?wx_fmt=jpeg",
"record_bonus": "消费30元,获得3积分",
"bonus": 3000,
"custom_field_value1": "xxxxx",
"can_give_friend": true
}
Dxplaination of request parameters:
parameter | Introductions | Is it compulsory? |
---|---|---|
code | Card Voucher Code Code. | yes |
card_id | Voucher ID. | yes |
background_pic_url | Supports merchants to assign custom gift card backgrounds to individual gift cards when they activate. | no |
balance | The full value of the balance needs to be set, and the incoming value is displayed directly. | no |
record_balance | The merchant customizes the amount consumption record, no more than 14 Chinese characters. | no |
custom_field_value1 | Custom_field1 is the most recent value of the type defined at creation time, limited to 4 characters and 12 bytes. | no |
custom_field_value2 | The custom_field2 field is the most recent value of the type defined at creation time, limited to 4 characters and 12 bytes. | no |
custom_field_value3 | The custom_field3 field is the latest value of the type defined at creation time, limited to 4 characters and 12 bytes. | no |
can_give_friend | Control whether the redeeming entrance appears after this points change | no |
# Return parameter explaination
{
"errcode": 0,
"errmsg": "ok",
"result_bonus": 100,
"result_balance": 200,
"openid": "oFS7Fjl0WsZ9AMZqrI80nbIq8xrA"
}
parameter | Introductions |
---|---|
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 |
errcode | Error code, 0 is normal |
errmsg | Error message |
# 11.3 Cancel User Gift Card Interface
Interface Dxplaination
When the gift card is used or after transfer, binding, etc., the developer can write off the user's gift card through this interface, so that the gift card becomes bottomed in the list and is no longer used.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/code/consume?access_token=TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"code": "12312313",
"card_id": "p1Pj9jr90_SQRaVqYI239Ka1erkI"
}
Dxplaination of request parameters:
parameter | Introductions | Is it compulsory? |
---|---|---|
code | Card Voucher Code Code. | yes |
card_id | Card voucher ID, custom code Card voucher required, otherwise not required. | yes |
# Return parameter explaination
{
"errcode": 0,
"errmsg": "ok",
}
parameter | Introductions |
---|---|
errcode | Error code, 0 is normal |
errmsg | Error message |
# 11.4 Query Gift Card Information Interface
Interface Dxplaination
Developers can query code-related information such as balance, expiration date, order number, etc. through this interface, mainly to prevent loss of order after transaction completion, and for write-off / balance change.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/code/get?access_token=TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{
"code": "12312313",
"card_id": "p1Pj9jr90_SQRaVqYI239Ka1erkI"
}
Dxplaination of request parameters:
parameter | Introductions | Is it compulsory? |
---|---|---|
code | Card Voucher Code Code. | yes |
card_id | Card voucher ID, custom code Card voucher required, otherwise not required. | yes |
# Return parameter explaination
{
"errcode": 0,
"errmsg": "ok",
"card": {
"card_id": "pbLatjoAAyLz6Pt36wGQNfxNrucU",
"begin_time": 1397577600,
"end_time": 1662724261,
"balance": 1,
"code": "027691806183",
"card_number": "027691806183"
},
"openid": "obLatjjwDolFjRRd3doGIdwNqRXw",
"can_consume": true,
"user_card_status": "NORMAL",
"order_id": "AQAAPdZIMrAvjeoKBmy2rY6RnF1D",
"background_pic_url": "http://mmbiz.qpic.cn/mmbiz_jpg/ibV1WeaY2IEuMzDp7RjSPib7GOIvMKPucibziaBPS0ialicialKWiaflOHMb5s1jGvCdZ9Z88kBUnfsUjq5Eo9NOGkH1Jg/0"
}
parameter | Introductions |
---|---|
errcode | Error code, 0 is normal |
errmsg | Error message |
card_id | The card_id of the gift card |
begin_time | Effective date |
end_time | End Time |
bonus | Current points (ignore if you don't have points) |
balance | Current balance lines |
code | The code of the gift card |
card_number | The card number displayed on the card surface of the gift card, if not set, is the same as the code |
openid | User's openid |
order_id | Gift Card Order Number |
# 12. Aftersales Process
# 12.1 Financial statements
Merchants can ensure that transactions are reconcilable by receiving orders to complete event notifications and checking the number of purchase orders on a regular basis.At the same time, merchants can login WeChat payment merchant background to check specific transactions and transaction details, reconciliation.
# 12.2 Refunds, Invoice Process
In accordance with the relevant national laws, gift card merchants must provide a refund-related process to safeguard the legitimate benefits of users.
Merchants can call the refund interface to complete the development of the refund process.
Currently, gift card shelves support merchants to incorporate links to invoices and refunds at the time of creation, and developers can develop pages to process user requests.
# 12.2.1 Refund Interface
Interface Dxplaination
Developers can use this interface to refund a certain order action. Note that this interface is relatively private, and developers are asked to raise the permission level to operate this feature.
Dxplaination of Interface Call Request
agreement | HTTPS |
---|---|
HTTP request mode | POST |
Request Url | https://api.weixin.qq.com/card/giftcard/order/refund?access_token=ACCESS_TOKEN |
POST data format | JSON |
Dxplaination of request parameters
parameter | Introductions | Is it compulsory? |
---|---|---|
access_token | Call Interface Credentials | yes |
JSON | JSON data | yes |
Examples of POST data:
{ "order_id": "xxx" }
Dxplaination of requested data:
parameter | Introductions | Is it compulsory? |
---|---|---|
order_id | Refundable order id | yes |
# Return parameter explaination
Example of returned data:
{
"errcode" : 0,
"errmsg" : "ok"
}
Return data explaination:
field | Introductions |
---|---|
errcode | Error code, 0 is normal |
errmsg | Error message |
Note: After the refund, the corresponding gift card will disappear in the user card package.
# 12.2.2 Invoices after payment
When creating gift cards, merchants can fill in the "need_reciept" field to open the function of invoicing after payment.Users can click the invoice page on the successful credential message and fill in the header and other information. After submitting, WeChat will be pushed to the merchant's server by event notification.
# 12.2.2.1 Overall Process
Set up WeChat To issue an electronic invoice after payment, follow the following steps:
Step 1: The merchant sets the merchant number, AppID and s_appid information after payment through the interface, and sets the information that users need to fill in the invoice page
Step 2: The merchant sets up the field information that users need to fill in on the header page;
Step 3 After the user has completed the payment, in the WeChat column I - Wallet, click the upper-right menu to open the transaction record, enter the transaction details of the corresponding order, and see the invoice button in the page.After filling in the relevant project content of the invoice, and [confirming the inquiry], WeChat will provide feedback on the acceptance result.After the receipt of the billing request is successful, WeChat will send the user a notification of the bill opened (if you follow the merchant Service Account, the notification of a bill opened will be sent through the service number, otherwise it will be sent via the service notification);
Step 4 The merchant receives the user's authorization for invoicing and sends the invoicing request to the invoicing platform, which sends the invoice to the merchant;
# 12.2.2.2 Set up invoicing functions after payment
Set ticketing information after payment
Interface Dxplaination
Merchants can use this interface to set up billing authorisation buttons on payment messages after a payment has been received on a merchant number.
request
url:
https://api.weixin.qq.com/card/invoice/setbizattr?action=set_pay_mch&access_token={access_token}
Request method: POST
Request parameters
Data format: JSON
parameter | type | Is it compulsory? | describe |
---|---|---|---|
paymch_info | Object | yes | Authorization page field |
Paymch_info contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
mchid | String | yes | WeChat Payment Merchant Number |
s_pappid | String | yes | Billing platform id, need to find billing platform to provide |
Return Parameters
Data format: JSON
parameter | type | Is it compulsory? | describe |
---|---|---|---|
errcode | Int | yes | Error code |
errmsg | String | yes | Error message |
Example
{
"paymch_info": {
"mchid": "1234",
"s_pappid": "wxabcd"
}
}
Back to:
{ "errcode": 0, "errmsg": "ok" }
Check the billing information interface after payment
request
url:
https://api.weixin.qq.com/card/invoice/setbizattr?action=get_pay_mch&access_token={access_token}
Request method: POST
Request parameters
Data format: JSON
The data is empty, pass {}
Return Parameters
Data format: JSON
parameter | type | Is it compulsory? | describe |
---|---|---|---|
errcode | Int | yes | Error code |
errmsg | String | yes | Error message |
When the error code is 0 is, there is the following information:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
paymch_info | Object | no | Authorization page field |
Paymch_info contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
mchid | String | yes | WeChat Payment Merchant Number |
s_pappid | String | yes | Billing platform id, need to find billing platform to provide |
Example
Request:
{}
Back to:
{
"errcode": 0,
"errmsg": "ok",
"paymch_info": {
"mchid": "1234",
"s_pappid": "wxabcd"
}
}
# 12.2.2.3 Set up the ticketing page information interface
Set up an authorization page field information interface
Instructions
Through this interface, merchants can set what users should fill out when authorizing
Dxplaination of request
url:
https://api.weixin.qq.com/card/invoice/setbizattr?action=set_auth_field&access_token={access_token}
Request method: POST
Request parameters
Data format: JSON
parameter | type | Is it compulsory? | describe |
---|---|---|---|
auth_field | Object | yes | Authorization page field |
The auth_field contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
user_field | Object | yes | Personal Invoices Field on the Authorization Page |
biz_field | Object | yes | Authorization page unit invoice field |
The user_field contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
show_title | Int | no | Do you fill in a head up, 0 is no and 1 is yes? |
show_phone | Int | no | Do you fill in the phone number, 0 is not, 1 is yes? |
show_email | Int | no | Would you like to fill in the mailbox? 0 is not, 1 is yes |
custom_field | Object | no | Custom fields |
The biz_field contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
show_title | Int | no | Do you fill in a head up, 0 is no and 1 is yes? |
show_tax_no | Int | no | Do you fill in the tax number, 0 is no, 1 is yes? |
show_addr | Int | no | Would you like to fill in the unit address, 0 is not, 1 is yes |
show_phone | Int | no | Do you fill in the phone number, 0 is not, 1 is yes? |
show_bank_type | Int | no | Do you fill in the bank to open your account? 0 is no, 1 is yes |
show_bank_no | Int | no | Do you fill in your bank account number, 0 is no, 1 is yes? |
custom_field | Object | no | Custom fields |
The custom_field is a list, and each object contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
key | String | yes | Customize field name, up to 5 words |
Return Parameters
Data format: JSON
parameter | type | Is it compulsory? | describe |
---|---|---|---|
errcode | Int | yes | Error code |
errmsg | String | yes | Error message |
Example
{
"auth_field": {
"user_field": {
"show_title": 1,
"show_phone": 1,
"show_email": 1,
"custom_field": [
{
"key": "field1"
}
]
},
"biz_field": {
"show_title": 1,
"show_tax_no": 1,
"show_addr": 1,
"show_phone": 1,
"show_bank_type": 1,
"show_bank_no": 1,
"custom_field": [
{
"key": "field2"
}
]
}
}
}
Back to:
{
"errcode": 0,
"errmsg": "ok"
}
Remarks
The title of the individual invoice and the title of the unit invoice are displayed by default
Query authorization page field information interface
Interface Dxplaination
Developers can view the fill-ins at the top of the authorization page through this interface.
Dxplaination of request
url:
https://api.weixin.qq.com/card/invoice/setbizattr?action=get_auth_field&access_token={access_token}
Request method: POST
Request parameters
Data format: JSON
The data is empty, pass {}
Return Parameters
Data format: JSON
parameter | type | Is it compulsory? | describe |
---|---|---|---|
errcode | Int | yes | Error code |
errmsg | String | yes | Error message |
When the error code is 0 is, there is the following information:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
auth_field | Object | yes | Authorization page field |
The auth_field contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
user_field | Object | no | Personal Invoices Field on the Authorization Page |
biz_field | Object | no | Authorization page unit invoice field |
The user_field contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
show_title | Int | no | Do you fill in a head up, 0 is no and 1 is yes? |
show_phone | Int | no | Do you fill in the phone number, 0 is not, 1 is yes? |
show_email | Int | no | Would you like to fill in the mailbox? 0 is not, 1 is yes |
custom_field | Object | no | Custom fields |
The biz_field contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
show_title | Int | no | Do you fill in a head up, 0 is no and 1 is yes? |
show_tax_no | Int | no | Do you fill in the tax number, 0 is no, 1 is yes? |
show_addr | Int | no | Would you like to fill in the unit address, 0 is not, 1 is yes |
show_phone | Int | no | Do you fill in the phone number, 0 is not, 1 is yes? |
show_bank_type | Int | no | Do you fill in the bank to open your account? 0 is no, 1 is yes |
show_bank_no | Int | no | Do you fill in your bank account number, 0 is no, 1 is yes? |
custom_field | Object | no | Custom fields |
The custom_field is a list, and each object contains the following fields:
parameter | type | Is it compulsory? | describe |
---|---|---|---|
key | String | yes | Customize field name, up to 5 words |
Example Requests
Request: {} Return: {"errcode": 0, "errmsg": "ok", "auth_field": { "user_field": { "show_title": 1, "show_phone": 1, "show_email": 1, "custom_field": [{"key": "field1"}] }, "biz_field " : { "show_title": 1, "show_tax_no": 1, "show_addr": 1, "show_phone": 1, "show_bank_type": 1, "show_bank_no": 1, "custom_field": [{"key": "field2"}] } } } |
---|
# 12.2.2.4 Receipt of bills incidents
Interface Description
After the user's authorization is completed, the merchant receives the completion of the authorization and requests the invoicing platform to open the bill.
For event push, please refer to:
http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025274&token=&lang=zh_CN
Request parameters
Data format: xml
parameter | type | describe |
---|---|---|
ToUserName | String | Service Account Identification |
FromUserName | String | User openid |
CreateTime | Int | The time of the event |
MsgType | String | Fixed as event |
Event | String | Fixed as user_authorize_invoice |
SuccOrderId | String | Order number successfully authorized |
FailOrderId | String | Order number that failed to authorize |
AppId | String | AppId for Service Account to receive event push |
Source | String | Authorization source, web indicates H5 from WeChat, app identifies from app |
Example
<xml>
<ToUserName> <![CDATA[gh_fc0a06a20993]]> </ToUserName>
<FromUserName> <![CDATA[oZI8Fj040-be6rlDohc6gkoPOQTQ]]> </FromUserName>
<CreateTime>1475134700</CreateTime>
<MsgType> <![CDATA[event]]> </MsgType>
<Event> <![CDATA[user_authorize_invoice]]> </Event>
<SuccOrderId> <![CDATA[1202933957956]]> </SuccOrderId>
<FailOrderId> <![CDATA[]]> </FailOrderId>
<AppId> <![CDATA[]]> </AppId>
<Source> <![CDATA[]]> </Source>
</xml>
# 12.2.2.5 Request ticketing information
Interface Dxplaination
After the user has completed the authorization, the merchant can call the interface to query a particular order
Request format
URL: https://api.weixin.qq.com/card/invoice/getauthdata ?access_token={access_token}
Request method: POST
Protocol: HTTPS
Request parameters
Data format: POST
parameter | type | Is it compulsory? | describe |
---|---|---|---|
order_id | string | yes | Invoice order_id |
s_appid | String | yes | Invoice platform ID |
Return Parameters
Data format: POST
parameter | type | Is it compulsory? | describe |
---|---|---|---|
errcode | Int | yes | Error code |
errmsg | String | yes | Error message |
When the error code is 0 is, there is the following information:
parameter | type | describe |
---|---|---|
invoice_status | String | For the status of order authorisation, see note |
auth_time | Int | Authorized time, ten digit time stamp (UTC + 8) |
user_auth_info | JSON | User authorization information is constructed, appearing only when type = 1 |
User_auth_info is a JSON structure that contains the following structures
parameter | type | describe |
---|---|---|
user_field | JSON | Authorized information structure for personal type invoices |
biz_field | JSON | Authorized information structure for unit type invoices |
title | String | Individuals / units look up |
phone | String | Personal / Organization Contact Phone |
String | Personal Email | |
title | String | Units look up |
tax_no | String | Unit tax number |
addr | String | Organization's registered address |
bank_type | String | A unit opens a bank |
bank_no | String | Organizations open bank accounts |
custom_field | JSON | Merchant customization of information structures |
User_auth_info is a JSON structure that contains the following structures
parameter | type | describe |
---|---|---|
key | String | Merchant customize the name of the item |
value | String | Merchant customize fill-in items Information filled out by users |
Example Requests
{
"s_pappid": "{s_pappid}",
"order_id": "{order_id}"
}
Return data:
The individual raises his head:
{
"errcode": 0,
"errmsg": "ok",
"invoice_status": "auth success",
"auth_time": 1480342498,
"user_auth_info": {
"user_field": {
"title": "Dhxhhx ",
"phone": "5554545",
"email": "dhxhxhhx@qq.cind",
"custom_field": [
{
"key": "field1",
"value": "管理理论"
}
]
}
}
}
Units rise:
{
"errcode": 0,
"errmsg": "ok",
"invoice_status": "auth success",
"auth_time": 1480342897,
"user_auth_info": {
"biz_field": {
"title": "王xx",
"tax_no": "6464646766",
"addr": "后过敏",
"phone": "1557548768",
"bank_type": "仔仔细细",
"bank_no": "545454646",
"custom_field": [
{
"key": "field2",
"value": "哈哈哈啊"
}
]
}
}
}
# 12.2.2.6 Entry of invoices
After receiving the above information, the merchant must forward the information to the corresponding invoicing platform for invoicing. If the invoicing platform supports electronic invoices, it can be invoked electronically, and if electronic invoices are not supported, they can be invoied by mail.
# 13.3 Online Customer Service
The merchant can define a custom cell in the aftersales help page of the shelf as online customer service, and when the user jumps, the user's order information and identity information will be brought into the page. The merchant may organize online customer service conversations based on the order to help the consumer complete the aftersales process.
# 14. Remarks
# 14.1 Gift Card Button Jump Protocol
When a user jumps to a merchant's custom center_url, custom_url, and promotion_url in a gift card, openid, encrypt_code, and card_id are included in the GET parameter.
Encrypt_code is a cryptographic code, and it needs to call the decoding interface to get the real Code. If the specified url is http://www.qq.com ,
When the user clicks, the jump url is:
http://www.qq.com?encrypt_code=ENCRYPT_CODE&card_id=CARDID&openid=xxxx&outer_str=xxxxx
Decode code interface See: code decode interface
When the user redirects to Weixin Mini Program corresponding to the merchant's custom center_url, custom_url, promotion_url on the gift card, the developer can obtain the corresponding parameter when they do so in the Mini Program's Page.onshow.
# 14.2 Gift card shelf bounce protocol
When the user jumps to the url in the merchant's custom aftermarket process cell on the order details page, the jump brings in order_id and openid in the GET parameter
For example, the original data is :
https://mp.weixin.qq.com
It's going to turn into something.
https://mp.weixin.qq.com/?order_id=Z2y2rY4UxUZYitvVGA&openid=oAAAAAKe1ri5AAaAiB50-Ak6Vs1w
Openid is the user's identification id under the merchant, and order_id is the unique identification id of the required order.
# 15. Offer features
Merchants can set WeChat to pay vouchers or cutbacks, control the use of only WeChat gift card channels, and when creating an event, the goods_tag must be mmbizgiftcard and ensure that other orders from this merchant number do not enter the goods-tag.
# 16. Contact Us
If you encounter technical problems during debugging,
Please send an email to wx_card\ @ tencent.com
The feedback format is as follows:
Email Title: [Gift Card Shelf Feedback] xxxxx
Problem Description: xxxx
The page_id in question: xxxxx
Problem user's WeChat number: xxx
Time of the problem: xxxxx
Connection mode: mobile phone number / WeChat number