# Promote data interfaces

# I. Generating promotional materials

# Interface Dxplaination

By docking the interface, the promoter can promote the bound business in the following two ways: A) Weixin Mini Program card: After entering the Mini Program, directly forward the product / activity page to the single chat / group chat, and promote it in the form of Mini Program card; B) Weixin Mini Program material: Forwarding the Mini Program code, tag and other Mini Program material generated through the platform link interface, and promoting it in the form of Mini Program pictures / link material. Note: Promotional material is valid for 30 days. Please re-access the material after it has expired.

# Request address

POST https://api.weixin.qq.com/promoter/getsharematerial?access_token=ACCESS_TOKEN

# Request parameters

parameter type Is it compulsory? Introductions
path string yes Weixin Mini Program Page path
openid string yes Promoter's openid or unionid
extra_info string no Custom parameters, no more than 80 characters in length
title string no Page name, no more than 20 characters long, defaults to "Promotion page"
share_type uint32 no 0: three kinds of sharing material all return 1, short chain 2, with reference path 3: Weixin Mini Program code (default return all)
env_version string no Default official version, develop: development version, trial: experience version, only short chain support jump development version / experience version

Note 1: Only if the merchant has declared it and the promoter has authorized can you generate shared material, otherwise you will return 10306 (data does not exist). NOTE 2: The sharing of the material is valid for 30 days. Please re-access the material when it expires. Note 3: Only the short chain (share_type = 1) supports jumping to the development / experience version.

# Example Requests

{
  "path": "xxxxx",
  "openid": "xxxxx",
  "extra_info": "xxxxx",
  "title": "xxxxx",
  "share_type": 0,
  "env_version": "trial"
}

# Return value

attribute type Introductions
share_path string Parameter path
qrcode string Weixin Mini Program code (image base64)
tag string Short Chains
errcode int32 Error code
errmsg string Error message

# Return data example

{
  "share_path": "xxxxx",
  "qrcode": "xxxxx",
  "tag": "xxxxx",
  "errcode": 0,
  "errmsg": "OK"
}

# II. Analysis of the effects of touch

# Interface Dxplaination

Through the interface, a merchant can query the status of access users brought by a particular promoter at a specific time.

# Request address

POST https://api.weixin.qq.com/promoter/getrelation?access_token=ACCESS_TOKEN

# Request parameters

parameter type Is it compulsory? Introductions
openid string yes Promoter's openid or unionid
begin_time uint32 no Touch time starting seconds timestamp
end_time uint32 no Touch time end seconds timestamp
scene uint32 no Touch Scene Values, Enumeration Values Reference Scene Values List
path string no The parameters in the native sharing path may be out of order, resulting in no search.
start_id string no For paging, the maximum number of pulls per page is 1000, and more than 1000 must be paged
need_unionid uint32 no Returns openid by default, fill 1: returns unionid

# Example Requests

{
  "openid": "xxxxx",
  "begin_time": 1668614400,
  "end_time": 1668666429,
  "scene": 1077,
  "path": "pages/xxxxx",
  "start_id": "123",
  "need_unionid": 1
}

# Return value

attribute type Introductions
promoter_openid string Promoter's openid or unionid
role_id uint32 Roleid
retail_id string Store ID
extra_info string Promoter parameters
openid string User openid or unionid accessing Weixin Mini Program upon touch
create_time uint32 Touch time Seconds timestamp
path string Touch the path
scene uint32 Touch Scene Values, Enumeration Values Reference Scene Values List
share_extra_info string Generate custom parameters when sharing material
total_cnt uint32 Total number of promoters in Ryder
start_id string Used for paging pages
errcode int32 Error code
errmsg string Error message

Note: When paging is required, insert the return start_id into the request. If total_cnt is less than 1000 or the return is empty (error code: 103006, data does not exist), the data pull is complete.

# Return data example

{
  "relation_list":
  [
    {
      "promoter_openid": "xxxxx",
      "role_id": 1,
      "retail_id": "xxxxx",
      "extra_info": "xxxxx",
      "openid": "xxxxx",
      "create_time": 1668667349,
      "path": "pages/xxxxx",
      "scene": 1077,
      "share_extra_info": "xxxxx"
    },
    {
      "promoter_openid": "xxxxx",
      "role_id": 1,
      "retail_id": "xxxxx",
      "extra_info": "xxxxx",
      "openid": "xxxxx",
      "create_time": 1668667349,
      "path": "pages/xxxxx",
      "scene": 1077,
      "share_extra_info": "xxxxx"
    }
  ],
  "total_cnt": 2,
  "start_id": "2",
  "errcode": 0,
  "errmsg": "OK"
}

# III. Enquire about promotional orders

# Interface Dxplaination

The order queried by this interface will be attributed to the promotion member who reached the user last before the order was generated (reached: the user entered Weixin Mini Program through the promotion material),If a merchant has other requirements (such as orders should be attributed to the promoter that the user is associated with, regardless of the order of communication between the promoter and the user), they can consider attributing promotional orders based on the promotional effect of the promoter on the user (refer to Section II) and combine it with their own order data.

# Request address

POST https://api.weixin.qq.com/promoter/getorder?access_token=ACCESS_TOKEN

# Request parameters

parameter type Is it compulsory? Introductions
openid string yes Promoter's openid or unionid
mch_id string no Merchant Number
trade_no string no WeChat Payment Order Number
out_trade_no string no Merchant's Order Number
status uint32 no Order Status 1: Payment Completed 2: Refund accepted
start_id string no For paging, the maximum number of pulls per page is 1000, and more than 1000 must be paged
need_unionid uint32 no Returns openid by default, fill 1: returns unionid
date uint32 no Order payment date, format yyyyMMdd, e.g. 20230801

# Example Requests

{
  "openid": "xxxxx",
  "mch_id": "xxxxx",
  "trade_no": "xxxxx",
  "out_trade_no": "xxxxx",
  "status": 1,
  "start_id": "123",
  "need_unionid": 1
}

# Return value

attribute type Introductions
promoter_openid string Promoter's openid or unionid
role_id uint32 Roleid
retail_id string Store ID
extra_info string Promoter parameters
openid string Payment user's openid or unionid
create_time uint32 Touch time Seconds timestamp
path string Touch the path
scene uint32 Touch Scene Values, Enumeration Values Reference Scene Values List
share_extra_info string Generate custom parameters when sharing material
mch_id string Merchant Number
trade_no string WeChat Payment Order Number
out_trade_no string Merchant's Order Number
status uint32 Order Status 1: Payment Completed 2: Refund accepted
paid_amount uint32 Amount paid by the user, in units
paid_time uint32 Payment completion time
refunded_time uint32 When the refund was created
total_cnt uint32 Total number of promoters in Ryder
start_id string Used for paging pages
errcode int32 Error code
errmsg string Error message

Note: When paging is required, insert the return start_id into the request. If total_cnt is less than 1000 or the return is empty (error code: 103006, data does not exist), the data pull is complete.

# Return data example

{
  "order_list":
  [
    {
      "promoter_openid": "xxxxx",
      "role_id": 1,
      "retail_id": "xxxxx",
      "extra_info": "xxxxx",
      "openid": "xxxxx",
      "create_time": 1668667349,
      "path": "pages/xxxxx",
      "scene": 1077,
      "share_extra_info": "xxxxx",
      "mch_id": "xxxxx",
      "trade_no": "xxxxx",
      "out_trade_no": "xxxxx",
      "status": 1,
      "paid_amount": 150,
      "paid_time": 1668667360
    },
    {
      "promoter_openid": "xxxxx",
      "role_id": 1,
      "retail_id": "xxxxx",
      "extra_info": "xxxxx",
      "openid": "xxxxx",
      "create_time": 1668667349,
      "path": "pages/xxxxx",
      "scene": 1077,
      "share_extra_info": "xxxxx",
      "mch_id": "xxxxx",
      "trade_no": "xxxxx",
      "out_trade_no": "xxxxx",
      "status": 2,
      "paid_amount": 150,
      "paid_time": 1668667360,
      "paid_time": 1668668000
    }
  ],
  "total_cnt": 2,
  "start_id": "2",
  "errcode": 0,
  "errmsg": "OK"
}