One, the introduction


1.1 Document Overview
This document describes the solutions provided by Mob ShopSDK for the developer’s own payment system (that is, you can use your own payment system to access ShopSDK, and the financial reconciliation system connected with the payment system can not be modified, so that you can better access ShopSDK). The document introduces the working mode and development process of Mob ShopSDK in detail from the aspects of signature, interface and matters for attention, which can help developers quickly start and master development skills, and also serve as a quick reference manual for interface parameters and parameter types in the future.
1.2 Reading Objects
For reference and inquiry of technical or business people who use your own payment system to access ShopSDK.
1.3 Service Terms



Ii. Program Overview
2.1 Industry Background
In electronic commerce, merchants, buyers and intermediate service parties are the three links in transaction activities. Buyers purchase goods to issue orders, businesses confirm the order, buyers through the payment service to pay for goods to businesses, businesses deliver goods to fulfill orders.
For developer-owned payment service,EtradeSdk provides interface to connect with developer-owned payment service, providing more friendly experience for developers.
The interface is introduced



2.2 Encryption and decryption flow chart



2.3 Service Flow Chart





Data format
3.1 Request Mode
The HTTP standard POST protocol is adopted. In order to ensure that the data received by the receiver is correct, URL Encode is required if there are special characters (such as &, =, etc.) in the transmitted parameters.
3.2 Response Format
A simple string is directly used as the data content, which is generally used for interface feedback in background notification mode to indicate whether the processing is successful.



Digital signature
To ensure the authenticity and integrity of data during data transmission, we need to digitally sign the data and verify the signature after receiving the signature data.
Digital signature consists of two steps: first, combine the original string to be signed according to certain rules, and then select a specific algorithm and key to calculate the signature result.
Generally the result of failure is not signed.
4.1 Signature Original String
All parameters are sorted by the ASCII characters of the field name in ascending order using the QueryString format (key1=value1&key2=value2…). patchwork
The last bit of the parameter is appSecret: value (the value is the association information of the developer appkey)
3. In the original string of signature, the field name and field value are both original values, without URL Encode.
For example:
To invoke an interface, the interface has the following fields:
Partner, Total_fee, DESC, ATTACH
When the interface is actually called, the values of each field are:
Partner =1900000109, Total_fee =1, desc= a&B, attach=, test=1
The correct signature string is:
desc=a&b&partner=1900000109&test=1&total_fee=1
Common mistakes include:
desc=a%26b&partner=1900000109&test=1&total_fee=1
desc=a&b&partner=1900000109&total_fee=1
attach=&desc=a&b&partner=1900000109&test=1&total_fee=1
partner=1900000109&total_fee=1&desc=a&b&test=1
4.2 Signature Algorithm
Currently, only THE MD5 signature is supported
The MD5 signature
MD5 is a summary generation algorithm. The original signature string is followed by the content of the merchant’s communication key, and the MD5 operation is performed. The summary string formed is the signature result. For easy comparison, the signature results are converted to uppercase characters.
Note: The encoding character set specified when signing a string into a byte stream should be UTF-8.
Formula for calculating MD5 signatures:
Sign = Md5(original string & AppSecret = developer appSecret).toupperCase
Such as:
The original signature string is: Partner =1900000109& Total_fee =1
E7d15453e97507ef794cf7b0519d developers appsecret is: 8934
The result of signing is:
sign=md5(input_charset=GBK&partner=1900000109&total_fee=1&appsecret=8934e7d15453e97507ef794cf7b0519d)= 4C513CB879523CA9D717EEA7819DEB0C
Five, the interface
5.1 Interface for changing order payment status of self-owned payment system
5.1.1 Service Functions
Order payment status changed
5.1.2 Request Parameter List
Request url:http://openapi.shop.mob.com/thirdparty/ertrance/updateOrderStatus
Request via POST



JSON format:
{
“OrderId” : 90892555608600576,
“Appkey” : “221 a0c04f52d4”,
“TotalMoney” : 1000,
“PayTicket” : “123 a”,
“PaidMoney” : 800,
“PayStatus” : 1
}
5.1.3 Returning the Result Parameter list
The data is returned in real time in JSON format



Successful examples:
{
“Status” : 200,
“Message” : “”,
“Data” : “”
}
5.2 Connect to the order query interface of the self-owned payment system
5.2.1 Service Functions
Order query interface
5.2.2 Request Parameter List
The requested url: http://openapi.shop.mob.com/thirdparty/ertrance/queryOrderDetail
Request via POST



JSON format:
{
“OrderId” : 90892555608600576,
“Appkey” : “221 a0c04f52d4”
}
5.2.3 Returning the Result Parameter list



Successful examples:
{
“Status” : 200,
“Message” : “”,
“Data” : {
“OrderId” : 2,
“PaidMoney” : 201,
“TotalMoney” : 1000
}
}
5.3 Connect to the refund product query interface of the self-owned payment system
5.3.1 Service Functions
Refund goods query interface
5.3.2 Request Parameter List
Request url:http://openapi.shop.mob.com/thirdparty/ertrance/queryRefundList
Request via POST



JSON format:
{
“Appkey” : “221 a0c04f52d4”,
“OrderBeginAt” : “2017-11-28 11:50:13”,
“OrderEndAt” : “2017-12-28 11:50:13”,
“RefundApplyBeginDate” : “2017-11-28 11:50:13”,
“RefundApplyEndDate” : “2017-12-28 11:50:13”,
“OrderId” : 12346567512,
“ProductName” : “towel”,
“BuyerId” : “1245233 a”,
“PageIndex” : 1,
“PageSize” : 10
}
5.3.3 Returning the Result Parameter list



Successful examples:
{
“Status” : 200,
“Message” : “”,
“Data” : {
“PageIndex” : 1,
“Count” : 1,
“A list” :
{
“RefundCommodityId” : “98830451051405312”,
“RefundFee” : 100,
“OrderPaidMoney” : 100,
“OrderId” : “99140624904790016”
}
]
}
}
5.4 Connect to the interface for changing self-paid refund status
5.4.1 Service Functions
The refund progress status of the self-owned payment system is changed.
5.4.2 Request Parameter List
Request url:http://openapi.shop.mob.com//thirdparty/ertrance/updateRefundStatus
Request via POST



JSON format:
{
“Appkey” : “221 a0c04f52d4”,
“RefundList” :
[
{
“RefundCommodityId” : 90892555608600576,
“RefundFee” : 100,
“Status” : 0
}
]
}
5.4.3 Returning the Result Parameter list
The data is returned in real time in JSON format



Successful examples:
{
“Status” : 200,
“Message” : “SUUCCESS”,
“Data” : “”
}
Six, notes
All units involved in the amount of money are cents, the smallest unit is 1 cent, can not be decimal
The request header must carry appKey and MobSign information
RSA encryption algorithm and MD5 signature algorithm are detailed in the attachment
Encryption methods
Before interconnection, obtain the public key on the MOB background management page and enter the external IP address of the server