# Users are notified of coupons

Users in WeChat initiated the coupon operation, will take the initiative to call back the business to receive coupons, businesses need to be based on their own coupon inventory, etc., return a specific coupon results. If the merchant returns successfully, the platform side will record the returned user coupons, in order to avoid record failure due to network exceptions, etc. It is suggested that merchants call the "add user coupon" interface when the coupon is successful, and the platform side will ensure the uniqueness according to the merchant side coupon ID returned by the merchant and the merchant side user coupon ID; It is also recommended to call the "Update coupon inventory" interface for inventory updates.

# Example of callback request parameters

Depending on the data format (json or xml) set by the merchant, take xml as an example

<xml>
    <ToUserName>gh_abcdefg</ToUserName> 
    <FromUserName>oABCD</FromUserName> 
    <CreateTime>12344555555</CreateTime>
    <MsgType>event</MsgType> 
    <Event>open_product_receive_coupon</Event>
    <out_coupon_id>real_out_coupon_id</out_coupon_id>
    <request_id>real_request_id</request_id>
</xml>

# Example of a callback callback

Depending on the data format (json or xml) set by the merchant, take xml as an example

<xml> 
  <out_user_coupon_id>real_out_user_coupon_id</out_user_coupon_id>  
  <request_id>real_request_id</request_id>  
  <ret_code>0</ret_code>
  <ret_msg>ok</ret_msg>
  <out_coupon_id>real_out_coupon_id</out_coupon_id> 
</xml>

# Dxplaination of callback request parameters

参数 type Introductions
ToUserName string Merchant Weixin Mini Program Name
FromUserName string WeChat OpenID for users
CreateTime number Time of Event, Unix Timestamp
MsgType string Message type, fixed as event
Event string Event type, this interface is fixed to open_product_receive_coupon
out_coupon_id string Merchant Side Coupon ID
request_id string Request a unique ID

# Dxplaination of callback callback parameters

参数 type Introductions
ret_code number 0: successful, 1090029: insufficient stock, 1090030: personal limit exceeded, 109031: request limit, 109057: voucher does not exist, 109058: voucher status is not correct, 109032: system failure, 109033: other logical failure;
ret_msg string This return description will not be shown when users attempt to redeem coupons but fail in the WeChat Channels scenario.
out_user_coupon_id string Merchant Side User Coupon ID
out_coupon_id string Merchant Side Coupon ID
request_id string Request a unique ID

# Error message displayed when WeChat Channels scene coupons cannot be redeemed

返回码 False copywriting
1090029 We took it all away.
1090030 The maximum claim limit has been reached
1090031 Receiving tickets too often. Please try again later.
1090032 Collection failed. Please try again later
1090033 Collection failed. Please try again later
1090057 This coupon is not valid.
1090058 Collection failed. Please try again later