Loading…

Full analysis of coupon usage conditions

# Get a list of all available coupons when placing an order Call the create order interface and pass the pre-order parameters, and the system will return to you the data after this simulated order: + A list of coupons available for this order + Each coupon returns the product ID that the coupon can be used to facilitate more flexible business processing on the front end; + The amount to be paid for this order ```javascript calculate: true ``` The `couponUserList` field returned by the interface is the coupons that users can choose to use when placing an order. When placing an order, pass the selected record ID to the `couponId` parameter (multiple selections are possible, and multiple IDs are separated by English commas) #How does the system determine whether it is available? If you have any questions about the available coupon list data returned by the system (or no available coupon list is returned), please follow the steps below to check to ensure that your coupons meet the conditions for use: ## Coupon status The system will search for available coupons under the name of the user who placed the order. Coupons that have expired or been used cannot be used again. ## Whether the product allows the use of coupons When publishing/editing products in the background, if the number of coupons that can be used is set to 0, the coupons will not be used. If all the products in the order are of this type, the coupon cannot be used for this order. ##Use object If the coupon is set to be used, such as + Can only be used under certain product categories; + Can only be used under certain specific products; Then, this coupon can only be used when the order contains matching categories or products. ##Usage threshold If you set a coupon usage threshold (for example, it is available for purchases over 500 yuan), then the system will calculate whether it meets the coupon usage threshold you set based on the effective product amount of this order. + If the order contains a product and it is set not to allow the use of coupons (that is, when publishing/editing the product in the background, set the number of usable coupons to 0), the amount of the product will not be included in the total effective product amount of this order; + If the coupon is not set to be used (that is, there are no restricted categories or products), then the amount of these products will be included in the total effective product amount of this order; + If the coupon is set to be used (limited to specific categories or specific products), then only the amount of this part of the product will be included in the total effective product amount of this order; # Deduction amount Calculate according to the two calculation methods set by the coupon: + Fixed amount: The fixed amount will be deducted according to the face value of the coupon, and no change will be given after one-time use (if the order is 5 yuan and a 10 yuan coupon is used, all the coupons will be used up); + By percentage: The system calculates the amount of this deduction based on the valid product amount calculated above ✖️Coupon deduction percentage, and then deducts it according to the same logic as the fixed amount above # Deduction logic + Deduct according to the order of the passed in ``couponId`` array; + Each coupon will be deducted according to the order of the products ordered; + Regardless of whether all incoming coupons have been deducted, the system will set them to used status, so users need to choose the best coupons to use; # Prompt that the coupon cannot be used / the interface does not return the list of available coupons ["Prompt that coupons cannot be used/the interface did not return the list of available coupons"](https://www.yuque.com/apifm/doc/ctfh1x)