# Preface
This tutorial is based on the "apifm-wxapi" module and teaches you how to quickly implement small program development, so you may need to understand the following knowledge points first:
["Creating HelloWorld Project"](https://www.yuque.com/apifm/doc/hezlrm)
["Use "apifm-wxapi" to quickly develop small programs"](https://www.yuque.com/apifm/doc/mdldsd)
["Register for free to open the backend and obtain an exclusive domain name"](https://www.yuque.com/apifm/doc/qr6l4m)
In this case, some functions require the user to log in before they can be operated, which means token authorization is required. Please understand first:
["WeChat Mini Program login to obtain openid and third-party tokens"](https://www.yuque.com/apifm/doc/kaygbw)
# Function introduction
The function in this example can realize the "preferential payment" function similar to Meituan, Word of Mouth, and Dianping;
After the customer comes to the store to make a purchase, he or she asks the waiter for the purchase amount, and then the user enters the purchase amount and completes the online purchase;
The system automatically performs full discounts according to the preferential purchase rules set in the background.
# enable module
Log in to the "First Step" registration background, left menu --> Factory settings --> Module management
Find and enable the following modules, then press F5 to refresh the background interface. You will be able to see all the function menus required for this case:
_The menu in this case is "Buy Order Discount Settings"_
1. Buy order function
---
### Get purchase discount
```javascript
WXAPI.payBillDiscounts()
```
> Read the full and minus setting list of background settings
>
### Pay the order
```javascript
WXAPI.payBill(token, money)
```
> Please pass the actual consumption amount for the money parameter, and the system will automatically calculate the actual amount that needs to be paid based on the full reduction rule set in the background.
>
_More usage methods about apifm-wxapi: _
["apifm-wxapi Instructions for Use"](https://github.com/gooking/apifm-wxapi/blob/master/instructions.md)
_Download the Demo code of this case: _
["apifm-wxapi using Demo program"](https://github.com/gooking/apifm-wxapi-demo)
Looking forward to your progress!
grateful!