# 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)
This example requires product function support. How can we place an order without a product, so you need to understand first:
["Using apifm-wxapi to develop WeChat Mini Program stores/categories/products/collections"](https://www.yuque.com/apifm/doc/excd2w)
# Modules that need to be enabled
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 "Mall Management" --> "Order Management" + "Evaluation Management"_
1. Order management
2. Returns/exchanges/after-sales
---
### Create order
```javascript
WXAPI.orderCreate(Object object)
```
> Order function, please see the API interface document for specific parameter descriptions
>
> Passing true for the calculate parameter can realize pre-ordering. Pre-ordering will not actually place an order, but will return whether the order is allowed and the calculation of the cost [payment, freight].
>
### Close order
```javascript
WXAPI.orderClose(token, orderId)
```
### Delete order
```javascript
WXAPI.orderDelete(token, orderId)
```
> The user deletes the order, but the user cannot see it. The administrator can still see the order in the background.
>
### Pay order [use balance]
```javascript
WXAPI.orderPay(token, orderId)
```
> Use the user’s wallet balance to complete payment for the order
>
> If you use WeChat online payment to complete order payment, please review the "WeChat online payment chapter" and implement it by passing the nextAction parameter
>
### Confirm receipt
```javascript
WXAPI.orderDelivery(token, orderId)
```
> The administrator performs delivery operations for placing orders. After the user confirms that the package has been received and checked correctly, this method is used to confirm the receipt of the order.
>
> After confirmation of receipt, the order will enter the evaluation stage. Users can realistically evaluate the shopping experience, take screenshots of the buyer show, etc.
>
### Order write-off
```javascript
WXAPI.orderHX(hxNumber)
```
> hxNumber is the verification code, so please keep it properly. The merchant will perform verification based on the verification code.
>
> Orders will not generate a write-off code by default. If you need to enable the write-off function, please add isCanHx=true to the parameters of the order creation method.
>
> After write-off, the order will be successfully traded and will be transferred to pending evaluation status.
>
### Order summary statistics
```javascript
WXAPI.orderStatistics(token)
```
> Order statistics, used to display order statistics or a small red dot of order type. This method will return the following data:
>
1. count_id_no_pay: Number of orders to be paid
2. count_id_no_transfer: Number of paid orders waiting for merchant delivery
3. count_id_no_confirm: The merchant has shipped the goods and is waiting to confirm the quantity of the received order.
4. count_id_no_reputation: The transaction is successful and the number of orders waiting for evaluation
5. count_id_success: The transaction is successful and the number of orders that have been evaluated
6. count_id_close: Number of closed orders
### Get all orders
```javascript
WXAPI.orderList(Object object)
```
> Please refer to the API interface document for specific parameters.
>
> Can be filtered and displayed in pages based on order status, good or bad reviews, etc.
>
### Order details
```javascript
WXAPI.orderDetail(token, id)
```
> Read order details data: order information, shopping list, order log records, logistics tracking information, inventory details, extended attributes
>
> UI design and reasonable display according to your own needs
>
### Evaluation interface
```javascript
WXAPI.orderReputation(Object object)
```
> Order evaluation, conduct good, medium and negative reviews; leave comments and screenshots of buyer show
>
> Please refer to the interface documentation for specific parameters.
>
### Apply for return or exchange [After-sales]
```javascript
WXAPI.refundApply(Object object)
```
> User rights protection channel, through which after-sales processing such as refunds, returns, exchanges, etc. of orders can be achieved
>
> Please refer to the interface documentation for specific parameters.
>
### Details of application for return or exchange
```javascript
WXAPI.refundApplyDetail(token, orderId)
```
> Used to display return and exchange detailed data
>
### Cancel return or exchange application
```javascript
WXAPI.refundApplyCancel(token, orderId)
```
> Cancel / Cancel Rights Protection
>
### Pull all after-sales records of an order
```javascript
WXAPI.orderRefunds(token, orderId)
```
> One order allows multiple returns and exchanges, and this method can pull all after-sales records
>
**For more detailed parameter usage and more advanced advanced usage methods, please refer to the API interface documentation: **
["api interface document"](#)
_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!