["Frontend API docs"](#)
For interface address and parameter description, please go to the above link to view detailed interface document description.
For how to use the interface document and how to call the interface, please refer to the following introductory tutorial:
["How to call the interface? 》](https://www.yuque.com/apifm/doc/mrwduw)
If you are developing WeChat Mini Program, you can use the packaged SDK, which is more convenient and faster and eliminates the need for the original docking API interface:
[《WeChat Mini ProgramSDK》](https://github.com/gooking/apifm-wxapi)
If you are developing Toutiao/Douyin Mini Program, you can use the packaged SDK, which is more convenient and faster and eliminates the need for the original docking API interface:
["Toutiao/Douyin Mini ProgramSDK"](https://www.yuque.com/apifm/doc/an59b0)
If you are doing web development, you can use the packaged SDK, which is more convenient and faster and eliminates the need for the original docking API interface:
["web development SDK"](https://github.com/gooking/apifm-webapi)
If you are developing Flutter, you can use the packaged SDK, which is more convenient and faster and eliminates the need for the original docking API interface:
["Flutter Development SDK"](https://github.com/gooking/apifm-flutter)
This tutorial describes in detail the parameters used by this interface to facilitate quick retrieval by developers:
# Pre-order
Parameter name: calculate
Sometimes, we do not want to place an order immediately, but to verify whether the order can be placed, and at the same time obtain the amount, points, etc. that need to be paid after placing the order. For example, it can be used to implement the order confirmation page, display the payment amount and other information for the user to confirm before officially placing the order.
At this time, you can pass this parameter, calculate = true
# User login credentials
Parameter name: token
+ required parameters
+ Pass in the login token information of the user who placed the order, and the system will save the order to the corresponding user name based on the incoming token.
# Inviter
Parameter name: orderInviterId
This parameter is passed in the user id, and the system will mark the inviter of this order as this user. At the same time, this field is also used as the basis for three-level distribution to grab customers. If the inviter is a distributor, and if the invitation to grab customers is turned on, the user's distributor relationship will be changed.
# Product type
Parameter name: goodsType
0 Self-operated products; 1 JD vop products; 2 JD equity products; 3 Retrieval of deposited products
For general applications, just pass 0 directly.
# Order items
Parameter name: goodsJsonStr
Order product information, the format is as follows:
```json
[
{
"goodsId": 11,
"number": 2,
"propertyChildIds": "",
"days": [
"2019-07-26",
"2019-07-27"
]
},
{
"goodsId": 8,
"number": 3,
"propertyChildIds": "2:9",
"inviter_id": 1234,
"days": [
"2019-07-26",
"2019-07-27"
]
}
]
```
Please note that this parameter is of string type, so you may need to convert it to a string through the following method and then pass it to the interface call:
```javascript
JSON.stringify(array)
```
The specific fields are described as follows:
+ goodsId
Product ID, numeric type, please distinguish between product barcode and product ID, do not confuse**[If it is a VOP product, here is the product list or the yyId field returned by the details interface]**
+ nativeGoodsId product ID, numeric type, please distinguish product barcode and product ID. Ordinary products are the same as `goodsId`. For VOP products, it is different from `goodsId`
+ number
Purchase quantity
+ propertyChildIds
SKU information of specifications and sizes, if not available, do not send it, such as:
2:9,3:8
In this example, 2 represents the ID of the color attribute, 9 represents the ID of the red sub-attribute; 3 represents the ID of the memory attribute, and 8 represents the ID of the 256G sub-attribute.
Just pass in as many specifications and sizes as you want, separated by commas.
+ inviter_id
The sharing user number of the product. If there is one, you don’t need to upload it.
This field mainly implements product sharing rewards ["Product Sharing Rewards Tutorial"](https://www.yuque.com/apifm/doc/uzf2xp)
Therefore, there are multiple products in the same order. It may happen that product A shares the reward with Zhang San, and product B shares the reward with Li Si.
+ days
Optional parameters, if not passed, they will not be passed
This parameter is used in business scenarios such as hotel reservations and ticket purchases. The same product has fixed inventory on different dates. A specific date needs to be set when placing an order;
For example, if the product is a hotel room, when making a reservation, the user must select the day of the month to check in. Multiple dates can be selected at the same time, for example:
```json
"days": [
"2019-07-26",
"2019-07-27"
]
```
+ goodsAdditionList
Product optional accessories information, optional parameters, if not available, it will not be passed
Some products can be set with optional accessories, such as spicy hotpot, how much extra for adding vegetables, how much extra for adding eggs; for example, moving service, optional floors: no extra charge for floors below 3, how much for below 5th floor, how much for below 10th floor; and for milk tea products, you can choose ice level: more ice, less ice, no ice, sweetness: 3 points, 5 points, 7 points, toppings: pearls, milk cap, milkshake, etc.
For example:
```json
[
{
"id": 869,
"pid": 1699
},
{
"id": 871,
"pid": 1588
}
]
```
In this example, there are optional accessory parameters for an order for braised chicken and rice. 1699 is the optional accessory ID for flavor, 869 is the accessory option ID for medium spicy; 1588 is the optional accessory ID for side dishes, and 871 is the accessory option ID for quail eggs.
+ goodsTimesDay and goodsTimesItem parameters
These two parameters appear at the same time or do not appear at the same time, mainly to adapt to appointment-type business scenarios, such as doctor registration, service appointment, etc.;
The difference between this parameter and the days parameter above is that for hotel reservations, you only need to select a date, so the product inventory follows the date. However, for doctor registration applications, the inventory follows the time period. For example, between 9:00 and 10:00 on a certain day, the total number of numbers in this time period is fixed. If someone makes a reservation, the inventory will be gone.
If you have such business needs, you can consider using the time period pricing function
GoodsTimesDay passes a value such as: 2021-06-12
goodsTimesItem passes values such as: 9:00-10:00
+ wholesaleId
Record ID for wholesale settings
# Shipping address
If the freight template of the product requires express delivery, the user's delivery address information must be passed in when placing the order, otherwise the interface will prompt the corresponding error message.
Detailed parameter descriptions are as follows:
## provinceId
The province code can be obtained through the province and city interface in the interface document.
## cityId
City code can be obtained through the province and city interface in the interface document.
## districtId
The district and county code can be obtained through the province and city interface in the interface document. This parameter does not need to be passed except for vop services.
## streetId
The street code can be obtained through the province and city interface in the interface document. This parameter does not need to be passed except for vop services.
## address
Detailed shipping address
## menpai
house number
## linkMan
Recipient name
## mobile
Recipient mobile phone number
##idcard
If it is an international shipment, usually for cross-border e-commerce business, you need to send the recipient’s ID number.
## code
Postal code, optional
## lat
The map positioning latitude of the delivery address. For general delivery orders, this parameter needs to be passed to facilitate calculation of distance and delivery fees.
## lng
The map positioning longitude of the delivery address. For general delivery orders, this parameter needs to be passed to facilitate calculation of distance and delivery fees.
# Shipping type
Parameter name: peisongType
+ kd means this order requires express delivery
+ zq means the user chooses to pick up the order at the store without sending express delivery.
+ keloop This order will automatically be connected to the KuaiRunner system and adopt the KuaiRunner delivery system.
+ pszq is connected to the distribution module of apifm, and is delivered by the merchants themselves
+ meituan Meituan delivery
+ shansong flash delivery
# Charge delivery fee
Parameter name: peisongFeeId
The delivery fee record ID set in the background can be passed in, and the system will automatically calculate the delivery fee.
# Automatically connect to the factory distribution plug-in
Parameter name: autoPeisong
Set autoPeisong = true to automatically connect to the factory delivery module. You can use it with the backend delivery module to build your own delivery team.
If `peisongFeeId` is not passed, after passing this parameter, the system will automatically decide which `peisongFeeId` is most appropriate to use.
**Prerequisites:**
1. **The lat and lng parameters must be passed so that the system can know the user's receiving position for calculating distance.**
2. **The product must belong to a store, and the longitude and latitude of the store must be set, so that the system can know the location and use it to calculate the distance.**
# tip
Parameter name: trips
Tipping is more popular overseas. After users purchase goods, they will voluntarily give a certain tip. The tip amount can be passed to this field, and the system will settle the order together.
# Order notes
Parameter name: remark
When users download, they can leave a message to the merchant and note some special requirements.
# Use coupons
Parameter name: couponId
The coupon number used. Please separate multiple coupons with English commas. If you do not use coupons, there is no need to pass this parameter.
# Membership card business
Parameter name: cardId
If the user has a membership card under his name, he can pass in the membership card record ID when placing an order. The system will give priority to settling from the membership card. If it is not enough, the user will be prompted to pay the remaining amount.
# Cash on delivery
Parameter name: payOnDelivery
If this parameter is passed as 1, then this order will be a cash on delivery order, no payment is required, and the order is ready to be shipped. In the background order details, the payment status of the order is unpaid. You can collect payment from the user after the goods are delivered.
# Solitaire order
Parameter name: listingId
This is the Solitaire ID. You can view the Solitaire setting ID on the "Marketing Assistance" - "Solitaire" list page in the background.
# Select a pick-up store
Parameter names: shopIdZt and shopNameZt
Allows users to choose a store for self-pickup. This parameter passes in the store ID and store name.
# Pickup point information
Parameter name: pickPointId
This parameter is passed in the pick-up point ID and is used in conjunction with the back-end pick-up point management.
# dadadelivery
You can easily access Dada Delivery. For specific operations, please refer to the tutorial:
["How to access Dada Delivery"](https://www.yuque.com/apifm/doc/gxk08t)
The map longitude and latitude parameters in the above parameter "delivery address" are required, otherwise Dada will not be able to push the prepared delivery address to the rider.
The specific parameters are explained as follows:
## dadaShopNo
Dada Merchant ID, please go to the Dada Merchant Backstage to view it.
# Bargain business
Parameter name: kjid
If you are purchasing a bargained product, you need to pass in this parameter. It is the user who initiates the bargaining record ID. The system will settle according to the current price of the current bargaining progress (if the lowest price has been reached, the introduction will be based on the lowest price; if the settlement has not been reached, the settlement will be based on the current bargaining price)
#Group business
Parameter name: pingtuanOpenId
If it is a group purchase order, you need to enter the group number. After the order is paid, you can join the group successfully.
# verification code
Parameter name: isCanHx
If this parameter is passed in isCanHx = true, then the order will automatically generate a write-off code. You can display it as a QR code, and then quickly implement the function of scanning the code to write off the order.
#Kami automatic delivery
Parameter name: autoDeliver
Pass in the parameter autoDeliver = true to realize the automatic delivery function of order card password, which can realize businesses such as selling game point cards, coupons, and recharge cards. For specific tutorials, please refer to:
["Card/Coupon Automatic Shipping Plug-in"](https://www.yuque.com/apifm/doc/gr9bgz)
#Points deduction
Parameter name: deductionScore
If points deduction rules are set up in the background, when users place an order, they can choose to use certain points to deduct the order amount.
For example, if 500 points are allowed to be used to deduct 10 yuan, then an order that costs 100 yuan will be shipped. After passing the number 500 into this parameter, the amount payable for the order will become 90 yuan, and the user's available points of 500 will need to be deducted.Easter eggs:
1. Pass 0 for automatic deduction, that is, the system will automatically maximize the deduction based on the user's remaining points;
2. Pass negative numbers, such as passing`-80`, the system will retain the absolute value and then perform intelligent automatic deductions, such as`-80`, the system will deduct the user’s available points`80`Afterwards, the remaining portion will be deducted to the maximum extent;# Points must be redeemed using the amount
Parameter name: `scoreForceExchange`
+ If true, points will not be settled. All points will be settled according to the amount of each point set in the background.
# Use the amount to redeem if the points are insufficient.
Parameter name: `scoreExchangeClose`
+ If it is not passed or false is passed, when the user's points are not enough to be deducted, the amount of one point set in the background will be exchanged and converted into fund settlement.
+ Pass true, the discount will not be automatically redeemed
# Periodic orders
Parameter name: orderPeriod
Common business scenarios include: regular door-to-door services for housekeeping and cleaning, ordering magazines and newspapers, ordering fresh milk, etc.
These businesses require that the system automatically generates orders according to a fixed cycle and deducts the amount payable for the order from the user's balance.
Parameter example:
```json
{
"unit": 1, // 0 days 1 month 2 years
"times": 3, //Number of subscriptions
"duration": 1, // interval
"dateStart": '2021-06-12', // The time when the sub-order was first generated
"periodAddProperty": "attendanDay", // Try generating sub-orders. The attributes here need to be added with period.
"autoPay": true // Whether to automatically pay orders, otherwise the user needs to periodically pay for orders generated by the system
}
```
In this example, the system will generate an order every month. If the user's available balance is sufficient, the order will be automatically paid.DateStart This time must be paid attention to. Be sure to set the time when the order will be automatically generated for the first time in the next cycle. If you change the time to set the current time, the system will immediately generate a new order, so generally this time must be used to calculate the time for the order in the next cycle.#Order extended attributes
Parameter name: extJsonStr
You can submit customized information content according to your actual needs, and then view this information on the background order details page, for example:
```json
{
"School": "Zhejiang University",
"Professional": "Computer",
"Class": "401"
}
```
You can see this information in the order details
#Order extension type
Parameter name: extType
You can mark the order type according to your actual needs. The corresponding fields reflected in the order list and order details interface are type2.
# service technician
Parameter name `attendantId`
# Service date
attendanDay
#Service hours
attendanTime
Reserved field: attendanTime2
# Offer
+ ignoreDiscountPrice If passed, the discount amount in the product settings will be ignored.