1. How to Push Orders
1. What is Order Push
Linkbest supports pushing publisher promotion effect orders to publisher platforms actively.
2. Fill in the Pushing Address
After publishers access Linkbest, fill in "Order Pushing Address" on the Linkbest website.
Log in to Linkbest, go to "My Tools" -> "Order Pushing Service". In the corresponding list item, click "Configure Pushing Address".
Then fill in the address you need to push the order in the pop-up window, note that entering a new address will override the original address and leaving it blank means canceling the setting.
When submitted, Linkbest will make a test push to verify the interface. The pushing interface needs to return 1, 0 to indicate that the test data has been received, and -1 means that the test data has not been received.More Details
3. Precautions
The Status of orders actively pushed by Linkbest includes: created, confirmed settlement, settled, invalidated. Publisher platforms will be actively pushed when the above states occur.
The confirmed settlement, settled, invalidated Statuses of Linkbest orders are currently marked as confirmed settlements, settlements, and invalidations when the settlement process is completed in Linkbest.
If publishers need the original order Status of the e-commerce platform (created, paid, returned, etc.), please use the Linkbest order details inquiry API. Currently, only online merchants that support real-time order Status updates will have Status updates, such as JD, Taobao.
2. Push Data
Linkbest will initiate a Get request to the pushing address and send the order data as a request parameter. Pushing one order each time, Linkbest will add a Sign parameter to the parameter list as a verification. See the following section for details.
1. Push Parameter Explanation
All parameter names are in upperCamelCase characters, and the values are UTF8 encoded
Parameter | Description |
---|---|
Id | Push ID |
ProgramId | Promotion plan ID |
ProgramName | Promotion plan name |
WebsiteId | Website ID |
SubId | Channel custom tag value of the order |
OrderSn | Order number |
OrderTime | Time when the order is placed |
OrdersPrice | Order amount: when the order Status is 1 or 2, the order_price indicates the confirmed order amount |
Commission | Order Commission: when the order Status is 1 or 2, Commission indicates the confirmed Commission, and other Status values are order estimated Commission |
Currency | Currency, CNY is RMB, USD is USD |
Status | Order Status: -1 invalid, 0 unconfirmed, 1 confirmed, 2 settled |
Remark | Order description information |
OriginalStatus | The original state of the business |
Sign | Sign of the push data, Sign = MD5 (the "parameter value" is spliced into a string according to the first letter of the parameter index in ascending order + AppSecret), the parameter value spliced does not include the parameter values of Sign and id |
2. Receiving Request Security Verification
The parameters of the request may increase or decrease according to the needs. For the recipient, we recommend verifying the Sign value. The verification logic and code example are as follows:
After receiving a request
-
First extract Sign, id.
-
Sort the remaining data in the array index in alphabetical order.
-
Concatenate the sorted array data in the order of value1+value2+value3+... to get string.
-
Check whether Sign equals to md5(string+AppSecret)
PHP code example:
$app_secret = 'your secret'; // interface key
$params = $_REQUEST;
$Sign = $params['Sign'];
$id = $params['Id'];
unset($params['Sign'], $params['Id']);
ksort($params);
$localSign = md5(join('', array_values($params)) . $app_secret);
//If $localSign == $Sign is a legal push
if($localSign != $Sign){
throw new Exception("Illegal push");
}
3. response requirements after receiving the request
If the push is successful, please output the following value from the receiver: 1 means that the push is successful and the order has been successfully placed in the warehouse. 0 means the push was successful, but the order already exists. -1 means push failed.
If the recipient does not feedback any data, we also consider the push to fail.
4. review the test push of the push address
In order to review the validity of the filled-in interface, we will construct a test push during the review. The pushed data is as follows:
Parameter | Value |
---|---|
ProgramId | 0 |
ProgramName | test |
WebsiteId | 0 |
SubId | |
OrderSn | 0 |
OrderTime | 0000-00-00 00:00:00 |
OrdersPrice | 0.00 |
Commission | 0.00 |
Currency | CNY |
Status | -1 |
Remark | |
OriginalStatus | To be paid |
After receiving the above information, please output 0 or 1 through the interface. By default, the interface does not receive data. For direct access, please output -1 or no output.