Overview
Api payin, also called fast collection, means that during the transaction process, the merchant needs to develop a separate page to encapsulate the request parameters, guide the user to complete the payment, and enable the merchant to recharge into the EPAY account.
Payment Process
Merchants can refer to the following flow chart to complete collection docking.
Flow Description
The user visits the merchant page to initiate a quick payin's (recharge) transaction.
The merchant backend service encapsulation request parameter sends the call payinApi/sendTransaction transaction interface to the EPAY gateway backend service.
The EPAY Gateway background service receives the request, creates a transaction order, and starts processing. At this time, the order status is in process (status = 0).
After the EPAY gateway back-end service creates a transaction order, it returns the payment Url address of the third-party bank to the merchant back-end service.
After receiving the Url address of the third-party bank payment, the merchant back-office service redirects to the third-party bank cashier page.
The user confirms the payment on the third-party bank cashier page.
The third-party bank AcquireerBank the callback result to the EPAY gateway background service.
EPAY Gateway backend service processing result, update order status is successful (status = 7).
The EPAY gateway background service sends the callback result to the merchant background service to notify the transaction order has been completed.
The merchant background service can choose to call the queryTransaction interface for information confirmation.
EPAY gateway background service response queryTransaction interface data.
The merchant back-office service updates the transaction data and completes the order status.
The merchant back-office service informs the user of the order completion status.
Create Order
The merchant's background requests the API interface of sendTransaction, passes in parameters such as the merchant's order number, order amount, currency and payment account number (for details, please see the following parameter description), and creates an EPAY proxy. Receive orders.
Note: At this time, the order status is processing (status=1), and the order details can be viewed through the query transaction interface queryTransaction.
Sample Code
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"param\": {\n \"epayAccount\": \"test2020@epay.com\",\n \"version\": \"V2.0.0\",\n \"merchantName\": \"epay\",\n \"merchantOrderNo\": \"lx083031\",\n \"receiveAmount\": \"\",\n \"receiveCurrency\": \"USD\",\n \"paymentAmount\": \"100\",\n \"paymentCurrency\": \"BRL\",\n \"paymentCountry\": \"BR\",\n \"payerAccount \":\"\",\n \"channelCode\": \"46\",\n \"notifyUrl\": \"http://localhost/paymentApi/channel/send.do\",\n \"remark\": \"\"\n },\n \"sign\": \"\"\n}");
Request request = new Request.Builder()
.url("http://29597375fx.epaydev.xyz/capi/openapi/payinApi/sendTransaction")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"param\": {\n \"epayAccount\": \"test2020@epay.com\",\n \"version\": \"V2.0.0\",\n \"merchantName\": \"epay\",\n \"merchantOrderNo\": \"lx083031\",\n \"receiveAmount\": \"\",\n \"receiveCurrency\": \"USD\",\n \"paymentAmount\": \"100\",\n \"paymentCurrency\": \"BRL\",\n \"paymentCountry\": \"BR\",\n \"payerAccount \":\"\",\n \"channelCode\": \"46\",\n \"notifyUrl\": \"http://localhost/paymentApi/channel/send.do\",\n \"remark\": \"\"\n },\n \"sign\": \"\"\n}");
Request request = new Request.Builder()
.url("http://29597375fx.epaydev.xyz/capi/openapi/payinApi/sendTransaction")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
python
import requests
import json
url = "http://29597375fx.epaydev.xyz/capi/openapi/payinApi/sendTransaction"
payload = json.dumps({
"param": {
"epayAccount": "test2020@epay.com",
"version": "V2.0.0",
"merchantName": "epay",
"merchantOrderNo": "lx083031",
"receiveAmount": "",
"receiveCurrency": "USD",
"paymentAmount": "100",
"paymentCurrency": "BRL",
"paymentCountry": "BR",
"payerAccount ": "",
"channelCode": "46",
"notifyUrl": "http://localhost/paymentApi/channel/send.do",
"remark": ""
},
"sign": ""
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://29597375fx.epaydev.xyz/capi/openapi/payinApi/sendTransaction"
method := "POST"
payload := strings.NewReader(`{
"param": {
"epayAccount": "test2020@epay.com",
"version": "V2.0.0",
"merchantName": "epay",
"merchantOrderNo": "lx083031",
"receiveAmount": "",
"receiveCurrency": "USD",
"paymentAmount": "100",
"paymentCurrency": "BRL",
"paymentCountry": "BR",
"payerAccount ":"",
"channelCode": "46",
"notifyUrl": "http://localhost/paymentApi/channel/send.do",
"remark": ""
},
"sign": ""
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
shell
printf '{
"param": {
"epayAccount": "test2020@epay.com",
"version": "V2.0.0",
"merchantName": "epay",
"merchantOrderNo": "lx083031",
"receiveAmount": "",
"receiveCurrency": "USD",
"paymentAmount": "100",
"paymentCurrency": "BRL",
"paymentCountry": "BR",
"payerAccount ":"",
"channelCode": "46",
"notifyUrl": "http://localhost/paymentApi/channel/send.do",
"remark": ""
},
"sign": ""
}'| http --follow --timeout 3600 POST 'http://29597375fx.epaydev.xyz/capi/openapi/payinApi/sendTransaction' \
Content-Type:'application/json'
Request Parameter
Parameter Name | Parameter Desc |
---|---|
epayAccount | Merchant EPAY account |
merchantName | Merchant name |
merchantOrderNo | The merchant order number must be unique in the merchant system and the maximum length cannot exceed 50 characters. |
payerAccount | payer account number |
paymentAmount | payment amount |
paymentCurrency | Payment currency |
paymentCountry | Payment country |
receiveAmount | receive amount |
receiveCurrency | Receive currency |
version | Version number, the current version number is v2.0.0, compatible version v1.0.0 |
notifyUrl | Callback address, used to receive order results from epay background notification: success or failure |
remark | order remarks, the maximum length cannot exceed 200 characters |
category | type: bank, cash |
extendFields | merchant extension field, json format required |
senderInfo | payer information, requires JSON format, specific input fields need to be obtained according to Query Interface |
The above is a description of business parameters. For parameter encapsulation structure and sign signature, please see Development Guidelines>Guide>API Rules>API Specification and Development Guidelines>API SIGN
Query Transaction
Sample Code
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"param\": {\n \"epayAccount\": \"test2020@epay.com\",\n \"version\": \"V2.0.0\",\n \"merchantOrderNo\": \"b48916e1-91fb-4ff9-9002-17e8431a5a15\"\n },\n \"sign\": \"\"\n}");
Request request = new Request.Builder()
.url("http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/queryTransaction")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"param\": {\n \"epayAccount\": \"test2020@epay.com\",\n \"version\": \"V2.0.0\",\n \"merchantOrderNo\": \"b48916e1-91fb-4ff9-9002-17e8431a5a15\"\n },\n \"sign\": \"\"\n}");
Request request = new Request.Builder()
.url("http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/queryTransaction")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
python
import requests
import json
url = "http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/queryTransaction"
payload = json.dumps({
"param": {
"epayAccount": "test2020@epay.com",
"version": "V2.0.0",
"merchantOrderNo": "b48916e1-91fb-4ff9-9002-17e8431a5a15"
},
"sign": ""
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/queryTransaction"
method := "POST"
payload := strings.NewReader(`{
"param": {
"epayAccount": "test2020@epay.com",
"version": "V2.0.0",
"merchantOrderNo": "b48916e1-91fb-4ff9-9002-17e8431a5a15"
},
"sign": ""
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
shell
printf '{
"param": {
"epayAccount": "test2020@epay.com",
"version": "V2.0.0",
"merchantOrderNo": "b48916e1-91fb-4ff9-9002-17e8431a5a15"
},
"sign": ""
}'| http --follow --timeout 3600 POST 'http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/queryTransaction' \
Content-Type:'application/json'
Request Parameter
Parameter Name | Parameter Desc |
---|---|
epayAccount | Merchant EPAY account |
merchantName | Merchant name |
merchantOrderNo | The merchant order number must be unique in the merchant system and the maximum length cannot exceed 50 characters. |
version | Version number, the current version number is v2.0.0, compatible version v1.0.0 |
status | click Order Status to query |
beginTime | press Start Time to query, the time format is such as: 2021-09-01 19:54:53 |
endTime | press end time to query, the time format is such as: 2021-09-03 19:54:53 |
pageNum | Current page |
pageSize | Number of items per page |
The above is a description of business parameters. For parameter encapsulation structure and sign signature, please see Development Guidelines>Guide>API Rules>API Specification and Development Guidelines>API SIGN
Asynchronous Notification
EPAY notifies the payment result as a parameter to notifyUrl (the address set when creating the order) through POST request(You can also set the request method of the callback through the successUrlMethod or failUrlMethod field passed in when creating the order). After receiving the asynchronous notification, the merchant can perform security verification on the sign signature value and determine that the source of the message is EPAY before checking its own business. Do logical processing. For specific sign signing methods, please see Development Guidelines>API SIGN.
For asynchronous notification examples, please view Development Guidelines>Callback>Callback Examples
Order Status Chart
API List
Name | Desc | Operation |
---|---|---|
sendTransaction | Create transaction | View documentation |
queryTransaction | Query transaction | View documentation |