Loading…

Get coupons

```javascript WXAPI.fetchCoupons({ detect: true, id: 123, pwd: '', token: '00000000000000' }) ``` + id is the record id returned from the list of coupons that can be collected. This is the ID of the coupon rule created in the background. + pwd is the password when receiving it. If you are receiving a password coupon, this parameter must be passed + detect, if true is passed in this field, the interface only detects whether the current user can receive it, but will not actually receive the coupon; if false is passed, then the coupon is actually received. + token passes the token obtained after the current user logs in ```json { "code": 0, "data": { "dateEnd": "2021-12-18 00:00:00", // Expiration time "dateStart": "2021-12-02 18:46:44", // Effective time "id": 427331, "money": 40, // Coupon face value "moneyHreshold": 3000, // The amount required to use this coupon "moneyType": 0, // 0 fixed amount 1 ratio "name": "New store discount", // Coupon name "pid": 223, "pwd": "", "type": "" }, "msg": "success" } ``` + code If 30002 is returned, it means that this is a voucher that needs to be purchased, but the available balance is insufficient. You can refer to calling the online payment interface, passing nextAction, and after realizing online payment, complete the purchase of the current voucher ["Detailed Explanation of NextAction Parameter Usage"] (https://www.yuque.com/apifm/doc/aetmlb). When the code is 30002, the data field returns the amount you need to pay.