Third-party developer model

1, with certification Service Account of the business, the business can apply for their own service number card coupon function,Through WeChat open platform "service number login authorization" authorized to developers, on behalf of the development and application of card coupon function, card coupon data and membership belonging to the business under their own service number.This model is simply called "general authorization," and there are no additional development interfaces, but refer to the entire set of basic interfaces for coupons.

2, for no Service Account merchants, in order to reduce the cost of merchant access, access can be endorsed by a third party.The developer's business endorses the credit of the sub-merchants and can help merchants who do not have the ability to make coupons to make them.The developer model that reduces the merchant threshold and is supported by a third party is the third party-made model ( to view the introduction and guidance documents ).This pattern requires additional interfaces. Refer to the following interface documentation.

catalog 1 Third party substitution model 1.1 Create a submerchant interface 1.2 Sub-merchant audit event push 1.3 Card Voucher Open Category Query Interface 1.4 Update Submerchant Interface 1.5 Pull Single Submerchant Information Interface 1.6 Bulk Pull Submerchant Information Interface 1.7 Creating a Submerchant Coupon Interface 1.8 Error Code Dxplaination 1.9 Linking us

# 1 Third-party OEM Model

Model Overview

In order to reduce the difficulty of merchants accessing card coupons, WeChat public platform to all have a card coupon function Service Account open "third-party generation" function.After applying and opening this function, developers with development capabilities can help merchants without service numbers quickly access and use the card voucher through the API interface. Developers who assist in issuing coupons are referred to as "parent merchants" and merchants who are assisted in issuance are referred as "sub-merchants."

The parent merchant needs to upload the information of its sub-merchants in advance to pass the audit before it can be effective. During the issuance process, the parent merchant is permitted to select a sub-merchant from a list of reported sub-merchants to assist in the issuing of coupons.

Steps to Open

The application path: WeChat public platform - card coupon function - upper right corner - merchant information - third-party generation mode.

The second step, the merchant through the WeChat public platform or API interface, submit sub-merchant information, qualification, after the audit can use the sub-merchant information system voucher.

In the third step, when calling the API interface to create a card coupon, you need to pass in the unique field of the model, and the specific field refers to the return field explaination of creating the sub-merchant interface. Under this mode, only the creation of the voucher interface changes, and the use of the rest of the interface and the overall voucher interface stays the same.See Home Page

# 1.1 Create a sub-merchant interface

Interface Dxplaination

It supports the parent merchant to call the interface to pass in the relevant information of the child merchant, and obtain the child merchant ID for the card and voucher function management of the child merchant. The qualification of sub-merchants includes: merchant name, merchant logo (picture), card voucher category, authorization letter (scan or color photo), authorization letter valid deadline.

Interface details

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

Parameter explaination

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

Examples of POST data

{
 "info": {
 "brand_name": "aaaaaa",
 "app_id""xxxxxxxxxxx",
 "logo_url": "http://mmbiz.xxxx",
 "protocol": "xxxxxxxxxx",
 "agreement_media_id":"xxxxxxxxxx",
 "operator_media_id":"xxxxxxxx",
 "end_time": 1438990559,
 "primary_category_id": 1,
 "secondary_category_id": 101
 }
}

Field Dxplaination

Parameter Name Required to fill in type Example Introductions
info yes JSON structure
app_id no String(36) wxxxxxxxxxxx The Service Account app_id of the submerchant, and the app_id on the voucher face of the submerchant card is configured as the app_id.Note: The app_id must be authenticated
brand_name yes String(36) Lanzhou hand-pulled noodles Sub-merchant name (12 characters in Chinese characters), which will be entered and displayed on the voucher page when the voucher is made
logo_url yes string(128) http://mmbiz.xxxx The logo of the sub-merchant can be obtained through the upload image interface. The logo will be filled in and displayed on the voucher page
protocol yes String(36) mdasdfkl : Authorization ID, which is the media_id obtained after uploading the authorization by uploading the temporary material interface
end_time yes unsigned int 15300000 The expiration date of the letter of authorization (Eastern 8th District Time, in seconds) needs to be consistent with the scanned document submitted
primary_category_id yes int 2 First-level category id, which can be queried through the interface in this document
secondary_category_id yes int 2 Second-level category id, which can be queried through the interface in this document
agreement_media_id no string(36) 2343343424 A photo or scan of a business license or a self-employed business license
operator_media_id no string(36) 2343343424 A coloured or scanned identity card of the operator registered in the business licence

Note: Please download the authorization letter in https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1459357007&version=1&lang=zh_CN&platform=2] https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1459357007&version=1&lang=zh_CN&platform=2, fill it in by hand and affix the fresh seal, then upload the color scan or color photo.

(1) The letter of authorization must be sealed with the official seal of the enterprise, or with the legal effect of the self-employed shop seal, invoice special seal, financial seal, contract seal, etc., and no personal seal may be used;

(2) If the sub-merchant is a self-employed person and does not have the above-mentioned public seal, the authorization letter may be substituted for the public seal by the signature of the self-employee operator, and must also upload an additional photo of the selfemployed person's business license and the identity card of the operator registered in that license. (This program only applies to cases where the sub-merchant is a self-employed business and does not have a public seal.) Other scenarios must have public seal on the letter of authorization)

3, if the sub-merchants have Service Account, and do not want to operate their own, through the authorization of the third-party generation, support the configuration of the sub-merchant service number.After configuration, 1) the sub-merchant's coupons quota is no longer limited, and 2) the service number associated with the card details page configures the service number for the sub-trader.

Return data

{
"info": {
 "merchant_id": 12,
 "app_id":"xxxxxxxxxxxxx",
 "create_time": 1438790559,
 "update_time": 1438790559,
 "brand_name": "aaaaaa",
 "logo_url": "http://mmbiz.xxxx",
 "status": "CHECKING",
 "begin_time": 1438790559,
 "end_time": 1438990559,
 "primary_category_id": 1,
 "secondary_category_id": 101
}
}

Particular note:

Parameter Name describe
merchant_id Child Merchant ID, unique for a parent merchant Service Account
app_id If the sub-merchant has Service Account, and is not willing to operate their own, through the authorization of a third party generation, support the configuration of the sub-merchant service number.After configuration, 1) the sub-merchant's coupons quota is no longer limited, and 2) the service number associated with the card details page configures the service number for the sub-trader.
create_time When Submerchant Information was created
update_time When sub-merchant information is updated
brand_name Sub-merchant name (12 characters in Chinese characters), which will be entered and displayed on the voucher page when the voucher is made.
logo_url The submerchant logo can be obtained through the upload logo interface. The logo will be filled in and displayed on the voucher page
status Sub-merchant status, "CHECKING," "APPROVED," has passed; "REJECTED" is rejected, "EXPIRED" agreement has expired
bengin_time Creation time (non-protocol start time)
end_time Deadline of authorization letter (Eastern 8th District Time, in seconds)
primary_category_id Sub-merchant level category
secondary_category_id Sub-merchant category II

If the submerchant information is submitted through the WeChat public platform, you can view the submerchant ID in the WeChat Official Platform voucher function - Submerchant management - Subtrader details, or return the submerchantID through the Submerchant creation interface, or obtain the submerchantid through the Subtrader information pull interface.

# 1.2 Sub-merchants review events pushed

After the vendor is approved, it will receive an event push from the WeChat server.

<xml> 
  <ToUserName><![CDATA[toUser]]></ToUserName>  
  <FromUserName><![CDATA[FromUser]]></FromUserName>  
  <CreateTime>123456789</CreateTime>  
  <MsgType><![CDATA[event]]></MsgType>  
  <Event><![CDATA[card_merchant_check_result]]></Event>  
  <MerchantId>0</MerchantId>  
  <IsPass>1</IsPass>  
  <Reason><![CDATA[reason]]></Reason> 
</xml>

Field Dxplaination

parameter Introductions
ToUserName Developer No. WeChat.
FromUserName Sender account (an OpenID).
CreateTime Message creation time (integer).
MsgType Message type, event.
Event Event type, card_merchant_check_result (submerchant audit event)
MerchantId Submerchant ID.
IsPass Whether or not it is passed, it is approved by approval at 1 a.m.
Reason Reasons for rejection

# 1.3 Coupon open category query interface

Interface Dxplaination

By calling the interface to query the open category ID of the card voucher, the category will change with the development of business, please use the interface to query the real-time card voucher category each time.

NOTE:

1.The returned value of this interface query also includes the voucher qualification ID, which here is the qualification required for a voucher functionality that has been certified by WeChat and applied for through the WeChat Official Platform.

2.In the third-party developer-made (no Service Account) model, no matter what category the submerchant selects, the return value is not required to provide credentials according to this, and the return value refers only to the category ID.

Interface details

Dxplaination of Interface Call Request

HTTP request mode: GET URL: https://api.weixin.qq.com/card/getapplyprotocol?access_token=TOKEN

Parameter explaination

parameter Do I have to? Introductions
access_token yes Call Interface Credentials
GET data yes Json data

Return data

{
   "category": [
       {
           "primary_category_id": 1,
           "category_name": "美食",
           "secondary_category": [
               {
                   "secondary_category_id": 101,
                   "category_name": "粤菜",
                   "need_qualification_stuffs": [
                       "food_service_license_id",
                       "food_service_license_bizmedia_id"
                   ],
                   "can_choose_prepaid_card": 1,
                   "can_choose_payment_card": 1
               },
                       }
   ],
   "errcode": 0,
   "errmsg": "ok"
}
Parameter Name describe
errcode Error code, 0 is normal.
errmsg Error message.
primary_category_id Primary directory id
secondary_category_id Secondary directory id

# 1.4 Update the sub-merchant interface

Interface Dxplaination

Supports invoking this interface to update submerchant information.

Interface details

Dxplaination of Interface Call Request

Http request method: POST https://api.weixin.qq.com/card/submerchant/update?access_token=TOKEN

Parameter explaination

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

Examples of POST data

{
  "info": {
  "merchant_id": 12,
  "app_id":"xxxxxxxxxxxxx",
  "brand_name": "aaaaaa",
  "logo_url": "http://mmbiz.xxxx",
  "protocol": "media_id",
  "agreement_media_id":"xxxxxxxxxx",
  "operator_media_id":"xxxxxxxx",
  "end_time": 1438990559,
  "primary_category_id": 1,
  "secondary_category_id": 101
 }
}
Parameter Name Required to fill in type Example Introductions
info yes JSON structure
merchant_id yes int 12 Child merchant id, unique under a parent merchant Service Account.
app_id no String(36) wxxxxxxxxxxx The Service Account app_id of the submerchant, and the app_id on the voucher face of the submerchant card is configured as the app_id.Note: The app_id must be authenticated
brand_name yes String(36) Lanzhou hand-pulled noodles Sub-merchant name (12 characters in Chinese characters), which will be entered and displayed on the voucher page when the voucher is made
logo_url yes string(128) http://mmbiz.xxxx The submerchant logo can be obtained through the upload logo interface. The logo will be filled in and displayed on the voucher page
protocol yes String(36) mdasdfkl Authorization ID, which is the media_id obtained after uploading the authorization by uploading the temporary material interface
end_time yes unsigned int 15300000 The expiration date of the letter of authorization (Eastern 8th District Time, in seconds) needs to be consistent with the scanned document submitted
agreement_media_id no string(36) dhskdjklfjk A photo or scan of a business license or a self-employed business license
operator_media_id no string(36) dhskdjklfjk A coloured or scanned identity card of the operator registered in the business licence
primary_category_id yes int 2 First-level category id, which can be queried through the interface in this document
secondary_category_id yes int 2 Second-level category id, which can be queried through the interface in this document

Return data

{
"info": {
 "merchant_id": 12,
 "create_time": 1438790559,
 "update_time": 1438790559,
 "brand_name": "aaaaaa",
 "logo_url": "http://mmbiz.xxxx",
 "status": "CHECKING",
 "begin_time": 1438790559,
 "end_time": 1438990559,
 "primary_category_id": 1,
 "secondary_category_id": 101
 }
}
Parameter Name describe
merchant_id The child merchant id is unique to a parent merchant.When creating a voucher, fill in the id number, the field structure is as follows: base_info: {sub_merchant_info: {merchant_id:}}, see the Create Voucher interface for details
create_time When Submerchant Information was created
update_time When sub-merchant information is updated
brand_name Sub-merchant name (12 characters in Chinese characters), which will be entered and displayed on the voucher page when the voucher is made.
logo_url The submerchant logo can be obtained through the upload logo interface. The logo will be filled in and displayed on the voucher page
status Sub-merchant status, "CHECKING," "APPROVED," has passed; "REJECTED" is rejected, "EXPIRED" agreement has expired
bengin_time Creation time (non-protocol start time)
end_time Deadline of authorization letter (Eastern 8th District Time, in seconds)
primary_category_id Sub-merchant level category
secondary_category_id Sub-merchant category II

Particular note:

If the submerchant information is submitted through the WeChat public platform, you can view the submerchant ID in the WeChat Official Platform voucher function - Submerchant management - Subtrader details, or return the submerchantID through the Submerchant creation interface, or obtain the submerchantid through the Subtrader information pull interface.

# 1.5 Pull up a single sub-merchant information interface

Interface Dxplaination

Pull the basic information for a specified submerchant AppID.Note that the parent merchant is used to call the interface, but the child merchant's appid is passed in the interface.

Interface details

Dxplaination of Interface Call Request

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

Parameter explaination

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

Examples of POST data

{  "merchant_id": 12 }

Return data

{
 "info": {
 "merchant_id": 12,
 "create_time": 1438790559,
 "update_time": 1438790559,
 "brand_name": "aaaaaa",
 "logo_url": "http://mmbiz.xxxx",
 "status": "CHECKING",
 "begin_time": 1438790559,
 "end_time": 1438990559,
 "primary_category_id": 1,
 "secondary_category_id": 101
 }
}

Query failure returns an example (errcode is not 0, errmsg is the corresponding error message):

{  "errcode":xxxx,  "errmsg":"xxxx" }
Parameter Name describe
merchant_id Child merchant id, unique under a parent merchant Service Account.
create_time When Submerchant Information was created
update_time When sub-merchant information is updated
app_id Submerchant's Service Account app_id
brand_name Sub-merchant name (12 characters in Chinese characters), which will be entered and displayed on the voucher page when the voucher is made
logo_url The submerchant logo can be obtained through the upload logo interface. The logo will be filled in and displayed on the voucher page
status In the "CHECKING" audit, "APPROVED" has passed; "REJECTED" is rejected, "EXPIRED" agreement has expired
begin_time Create time (non-protocol start time), repeat with create_time, and remove the field later
end_time Agreement deadline
primary_category_id Sub-merchant level category
secondary_category_id Sub-merchant category II

# 1.6 Bulk pull sub-merchant information interface

Interface Dxplaination

The parent merchant can pull the relevant information of the sub-merchants in bulk through this interface, and the information of up to 100 sub-merchant can be pulled multiple times to meet different query requirements.

Interface details

Dxplaination of Interface Call Request

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

Parameter explaination

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

Examples of POST data

{
  "begin_id": 0,
  "limit": 50,
  "status": "CHECKING"
}

Field Dxplaination

Parameter Name describe
begin_id Initial child merchant ID, a parent merchant Service Account unique
limit Number of child businesses pulled, with a maximum value of 100
status Submerchants are reviewed for status, and after filling in, only the submerchants with the current status will be pulled out

Return data

{ "info_list": [ {
  "merchant_id": 12,
  "create_time": 1438790559,
  "update_time": 1438790559,
  "brand_name": "aaaaaa",
  "logo_url": "http://mmbiz.xxxx",
  "status": "CHECKING",
  "begin_time": 1438790559,
  "end_time": 1438990559,
  "primary_category_id": 1,
  "secondary_category_id": 101 }, {
  "merchant_id": 13,
  "create_time": 1438790559,
  "update_time": 1438790559,
  "brand_name": "bbbbbb",
  "logo_url": "http://mmbiz.xxxx",
  "status": "APPROVED",
  "begin_time": 1438790559,
  "end_time": 1438990559,
  "primary_category_id": 1,
  "secondary_category_id": 101 } ] "next_begin_id": 13
}

Parameter Name describe
merchant_id Child merchant id, unique under a parent merchant Service Account.
create_time When Submerchant Information was created
update_time When sub-merchant information is updated
brand_name Sub-merchant name (12 characters in Chinese characters), which will be entered and displayed on the voucher page when the voucher is made
logo_url The submerchant logo can be obtained through the upload logo interface. The logo will be filled in and displayed on the voucher page
status In the "CHECKING" audit, "APPROVED" has passed; "REJECTED" is rejected, "EXPIRED" agreement has expired
begin_time Create time (non-protocol start time), repeat with create_time, and remove the field later
end_time Agreement deadline
primary_category_id Sub-merchant level category
secondary_category_id Sub-merchant category II
next_begin_id Pull the id of the last submerchant in the channel list

Developers are advised:

When the number of children of the parent merchant exceeds 100, the query needs can be satisfied by filling in the value of begin_id, thus pulling the list many times. This is done by taking the value of next_begin_id in the return from the previous call as the value of begin_id in the next call.

# 1.7 Create a sub-merchant voucher interface

If the parent merchant needs to create its own voucher, refer to the original voucher creation interface

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 data

Examples of POST data

{
    "card": {
        "card_type": "GROUPON",
        "groupon": {
            "base_info": {
                "sub_merchant_info": {
                    "merchant_id": 123456
                },
                "logo_url": "http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7hicFNjakmxibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0",
                "brand_name": "海底捞",
                "code_type": "CODE_TYPE_TEXT",
                "title": "132元双人火锅套餐",
                "sub_title": "周末狂欢必备",
                "color": "Color010",
                "notice": "使用时向服务员出示此券",
                "service_phone": "020-88888888",
                "description": "不可与其他优惠同享\n如需团购券发票,请在消费时向商户提出\n店内均可使用,仅限堂食",
                "date_info": {
                    "type": "DATE_TYPE_FIX_TIME_RANGE",
                    "begin_timestamp": 1397577600,
                    "end_timestamp": 1422724261
                },
                "sku": {
                    "quantity": 500000
                },
                "get_limit": 3,
                "use_custom_code": false,
                "bind_openid": false,
                "can_share": true,
                "can_give_friend": true,
                "location_id_list": [
                    123,
                    12321,
                    345345
                ],
                "custom_url_name": "立即使用",
                "custom_url": "http://www.qq.com",
                "custom_url_sub_title": "6个汉字tips",
                "promotion_url_name": "更多优惠",
                "promotion_url": "http://www.qq.com",
                "source": "大众点评"
            },
            "deal_detail": "以下锅底2选1(有菌王锅、麻辣锅、大骨锅、番茄锅、清补凉锅、酸菜鱼锅可选):\n大锅1份 12元\n小锅2份 16元 "
        }
    }

 }

See Create a voucher

See Create a membership card

# 1.8 Error code explaination

Error code describe
-1 There is a system error.
40070 The stock information SKU filled in the baseinfo is illegal, refer to CreateCard to create a card coupon interface
40104 Incorrect category id when creating a submerchant
40140 The status of the submerchant is not correct. The request was reviewed when creating the voucher, the request was rejected when updating the submerchant information
40139 Submerchant ID is incorrect
40079 The time was not filled out correctly.
45021 Parameters are too long
43014 You cannot create a submerchant without a platform authorization.

# 1.9 Contact Us

Questions regarding the development of third-party OEM models can be reached via email weixin_card@foxmail.com Contact us.