概述

EPAY互转,是指商家通过接口方式从EPAY账号余额转账到另一个EPAY账号余额里。

支付流程

商家可以参考如下流程图,完成代付对接。

image

流程说明

  1. EPAY用户A 向EAPY用户B 发起转账申请。
  2. 您的后台服务调用转账交易 createEpayTransaction接口 到EPAY网关后台服务创建交易。
  3. EPAY网关后台服务处理订单完成,订单成功(status=7)。
  4. EPAY网关后台服务发送回调结果给您的后台服务,通知交易订单已完成。
  5. 您的后台服务可以选择调用 queryTransaction接口 进行信息确认。
  6. EPAY网关后台服务响应queryTransaction接口数据。
  7. 您的后台服务更新交易数据,完成订单状态。
  8. 您的后台服务通知用户订单完成状态。

创建订单

商家后台请求 createEpayTransaction 的API接口,传入商家订单号、订单金额、币种及对方EPAY账号等参数(具体可查看如下入参说明),创建EPAY代付订单。

注意:此时订单状态为成功(status=7),可通过查询交易接口 queryTransaction 查看订单详情。

示例代码

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\": \"merchantName\",\n        \"notifyUrl\": \"http://localhost/paymentApi/channel/send.do\",\n        \"merchantOrderNo\": \"2021041409022211\",\n        \"receiveEpayAccount\": \"11@qq.com\",\n        \"amount\": \"10\",\n        \"currency\": \"USD\",\n        \"extendFields\": {\n            \"test\": \"test\"\n        }\n    },\n    \"sign\": \"\"\n}");
Request request = new Request.Builder()
  .url("http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/createEpayTransaction")
  .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\": \"merchantName\",\n        \"notifyUrl\": \"http://localhost/paymentApi/channel/send.do\",\n        \"merchantOrderNo\": \"2021041409022211\",\n        \"receiveEpayAccount\": \"11@qq.com\",\n        \"amount\": \"10\",\n        \"currency\": \"USD\",\n        \"extendFields\": {\n            \"test\": \"test\"\n        }\n    },\n    \"sign\": \"\"\n}");
Request request = new Request.Builder()
  .url("http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/createEpayTransaction")
  .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/createEpayTransaction"

payload = json.dumps({
  "param": {
    "epayAccount": "test2020@epay.com",
    "version": "V2.0.0",
    "merchantName": "merchantName",
    "notifyUrl": "http://localhost/paymentApi/channel/send.do",
    "merchantOrderNo": "2021041409022211",
    "receiveEpayAccount": "11@qq.com",
    "amount": "10",
    "currency": "USD",
    "extendFields": {
      "test": "test"
    }
  },
  "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/createEpayTransaction"
  method := "POST"

  payload := strings.NewReader(`{
    "param": {
        "epayAccount": "test2020@epay.com",
        "version": "V2.0.0",
        "merchantName": "merchantName",
        "notifyUrl": "http://localhost/paymentApi/channel/send.do",
        "merchantOrderNo": "2021041409022211",
        "receiveEpayAccount": "11@qq.com",
        "amount": "10",
        "currency": "USD",
        "extendFields": {
            "test": "test"
        }
    },
    "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": "merchantName",
        "notifyUrl": "http://localhost/paymentApi/channel/send.do",
        "merchantOrderNo": "2021041409022211",
        "receiveEpayAccount": "11@qq.com",
        "amount": "10",
        "currency": "USD",
        "extendFields": {
            "test": "test"
        }
    },
    "sign": ""
}'| http  --follow --timeout 3600 POST 'http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/createEpayTransaction' \
 Content-Type:'application/json'

入参说明

参数名称 参数说明
epayAccount 商家开通的EPAY账号
merchantOrderNo 商家订单号
version 版本号,当前版本号为V2.0.0,兼容版本V1.0.0
merchantName 商家名称
amount 订单金额
currency 币种,要求 USD,EUR,HKD,GBP,JPY 其中一种
notifyUrl 回调地址,用于接收EPAY后台通知的订单结果:成功或失败
receiveEpayAccount 转账对方的收款EPAY账号
remark 备注
extendFields 商户扩展字段,要求JSON格式

以上为业务参数说明,参数封装结构及sign签名请查看 开发指引>接入指南>接口规则>接口规范开发指引>接口签名

查询交易

商家可调用 queryTransaction(交易查询接口),通过商家订单号查询对应订单支付情况。

示例代码

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\": \"20210708220\"\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\": \"20210708220\"\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": "20210708220"
  },
  "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": "20210708220"
  },
  "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": "20210708220"
  },
  "sign": ""
}'| http  --follow --timeout 3600 POST 'http://29597375fx.epaydev.xyz/capi/openapi/payoutApi/queryTransaction' \
 Content-Type:'application/json'

入参说明

参数名称 参数说明
epayAccount 商家开通的EPAY账号
merchantOrderNo 商家订单号
version 版本号,当前版本号为V2.0.0,兼容版本V1.0.0

以上为业务参数说明,参数封装结构及sign签名请查看 开发指引>接入指南>接口规则>接口规范开发指引>接口签名

异步通知

EPAY通过POST 请求的方式(也可以通过创建订单时传入的successUrlMethod或者failUrlMethod字段来设置回调的请求方式)将支付结果作为参数通知到notifyUrl(创建订单时设置的地址),商家收到异步通知后可以对sign签名值做安全性校验,判断消息来源是EPAY后再对自身业务做逻辑处理。具体sign签名方法请查看 开发指引>接口签名

异步通知示例,请查看 开发指引>异步通知>回调示例

订单状态图

image

API列表

API名称 API描述 操作
createEpayTransaction 创建订单 查看文档
queryTransaction 查询交易 查看文档

results matching ""

    No results matching ""