Through this interface, you can combine multiple coupons in your name into one coupon for use.
It's a bit similar to weapon forging in the game. Low-level weapons are recycled, and the system issues you a high-level weapon.
# Get merge rules
```javascript
WXAPI.mergeCouponsRules()
```
```json
{
"code": 0,
"data": [
{
"dateAdd": "2021-01-09 19:12:31",
"dateUpdate": "2021-01-09 21:29:51",
"id": 39,
"isUse": true,
"name": "Call the Tyrannosaurus Rex",
"rules": [
{
"couponId": 222,
"couponName": "New store discount",
"id": 133,
"mergeId": 39,
"number": 3,
"type": 0,
"typeStr": "recycling",
"userId": 951
},
{
"couponId": 223,
"couponName": "New store discount",
"id": 134,
"mergeId": 39,
"number": 3,
"type": 0,
"typeStr": "recycling",
"userId": 951
},
{
"couponId": 5453,
"couponName": "One copy per person",
"id": 135,
"mergeId": 39,
"number": 1,
"type": 1,
"typeStr": "Generate",
"userId": 951
}
]
}
],
"msg": "success"
}
```
As shown in the example above, there is a coupon rule for "Calling the Tyrannosaurus Rex". The specific rules are as follows:
+ Need to recycle 3 coupons with 222 coupon rules
+ Need to recycle 3 coupons with 223 coupon rules
+ Successfully synthesized a coupon with 5453 coupon rules
Specific parameter description:
+ couponId coupon rule id
+ number number of coupons
+ type 0 is recycling; 1 is generation
# Synthetic Coupon
```javascript
WXAPI.mergeCoupons({
token: '0',
couponIds: '',
mergeId: 123
})
```
+ token user login credentials
+ mergeId merge rule id, in the above example the value is 39
+ couponIds is the coupon ID used for merging. Multiple coupons are separated by English commas; in the above example, this parameter is passed: 133,133,133,134,134,134
The interface returns the coupon information of this successful synthesis:
```json
{
"code": 0,
"data": [
{
"dateAdd": "2021-12-02 18:46:44",
"dateEnd": "2021-12-18 00:00:00",
"dateStart": "2021-12-02 18:46:44",
"id": 427331,
"money": 40,
"moneyHreshold": 3000,
"moneyType": 0,
"name": "New store discount",
"pid": 223,
"pwd": "",
"status": 0,
"statusStr": "Normal",
"type": ""
}
],
"msg": "success"
}
```
+ dateStart effective time
+ dateEnd expiration time
+ money Coupon denomination
+ moneyType 0 Fixed amount 1 Proportional deduction
+ moneyHreshold is the amount of money you need to spend before you can use it.
+ name Coupon name
+ pid coupon rule id
+ status Coupon status, please refer to statusStr