API Description

This API is used to enter red packet information after the "Create Red Packet Campaign" API is called. Note that each call of this API adds the information of a new batch of red packets to a campaign. If the number of red packets is less than 100, add information of all red packets by calling the API once. If the number of red packets is greater than 100, the API can be called multiple times to add the red packet information. The total number of red packet tickets that are entered in batches cannot be greater than the "total" value set when the red packet campaign is created.

API Request Format

API request from server
HTTP request method: POST
URL:https://api.weixin.qq.com/shakearound/lottery/setprizebucket?access_token=ACCESSTOKEN

Request Parameters

Parameter Type Description
access_token string accesstoken, which is appended to the URL as a parameter.

POST BODY: A structure in JSON format.

Parameter Type Description
lottery_id string Red packet campaign ID, which should be same as the lottery_id from addlotteryinfo.
mchid string ID of the merchant who provides the red packets, which should be same as the mch_id specified when the Pre-Order API is called.
sponsor_appid string Appid of the Official Account owned by the merchant who provides the red packets. This should be same as the Official Account ID appid (wxappid) specified when the Pre-Order API is called.
prize_info_list JSON array Red packet ticket list. It there are a large number of red packets, you can enter multiple red packets at a time by setting the red packets information in batch with the API. A maximum number of 100 red packets can be entered in each API request.
ticket string The red packet tickets returned when the Pre-Order API is called. A maximum of 100,000 tickets are allowed for a red packet campaign. The tickets can be added multiple times.

Request Example

Content-Type: application/json Post Body:
{     
"lottery_id": "xxxxxxllllll",     
"mchid": "10000098",     
"sponsor_appid": "wx8888888888888888",   
"prize_info_list": [         
    {            
  "ticket": "v1|ZiPs2l0hpMBp3uwGI1rwp45vOdz/V/zQ/00jP9MeWT+e47/q1FJjwCIP34frSjzOxAEzJ7k2CtAg1pmcShvkChBWqbThxPm6MBuzceoHtj79iHuHaEn0WAO+j4sXnXnbGswFOlDYWg1ngvrRYnCY3g=="
    },
    {
  "ticket": "v1|fOhNUTap1oepSm5ap0hx1gmATM\/QX\/xn3sZWL7K+5Z10sbV5\/mZ4SwxwxbK2SPV32eLRvjd4ww1G3H5a+ypqRrySi+4oo97y63KoEQbRCPjbkyQBY8AYVyvD40V2b9slTQCm2igGY98mPe+VxZiayQ=="
    }
  ]
}

Response

Parameter Type Description
errcode int Error code. 0 indicates a successful request, and any value other than 0 indicates a failed request. For more information, see the list of error codes.
errmsg string Error message
repeat_ticket_list array Reused ticket list. If it is left empty, no such list is returned.
expire_ticket_list array Expired ticket list. If it is left empty, no such list is returned.
invalid_amount_ticket_list array List of tickets with an amount outside the range between 1 CNY and 1,000 CNY. If it is left empty, no such list is returned.
success_num int Number of red packets entered successfully.
wrong_authmchid_ticket_list array Reason: When the red packets are generated, the authorized merchant ID auth_mchid and auth_appid entered do not belong to a merchant who has activated Shake-Nearby feature.
invalid_ticket_list array Ticket parsing failed. There may be wrong or incomplete characters.

Example

{	    
"errcode":0,     
"errmsg":"",     
"repeat_ticket_list":[         
    {            
"ticket": "v1|ZiPs2l0hpMBp3uwGI1rwp45vOdz/V/zQ/00jP9MeWT+e47/q1FJjwCIP34frSjzOxAEzJ7k2CtAg1pmcShvkChBWqbThxPm6MBuzceoHtj79iHuHaEn0WAO+j4sXnXnbGswFOlDYWg1ngvrRYnCY3g=="                       
    },
    {
"ticket":"v1|ZiPs2l0zzXCsdfwe45dxCdHiukOdz/V/zQ/89xcnC5XnT+e47/q1FJjwCO4frSjzOxAEzJ7k2CtAg1pmcShvkChBWzc45dDGC32Dcxx4DGxczjDCGsdjowe9iHuaEn0WAO+GswFOlDYWg1ngvrRYnCY3g=="         }    	
    } 
 ], 
"success_num":100 
}