NAV Navbar
Logo text
cURL PHP Java Go

介绍

欢迎使用圆支付API文档! 本文档包括数字签名,Online API,In-Store API,微信小程序支付,数据查询几个部分
click here to view english document.

API 基本事项

Yuansfer提供RESTful接口,为您提供跨境支付解决方案。通过API,您可以将支付宝、微信、银联等支付方式结合起来,让客户在电脑或手机上进行支付。

开始

Yunsfer API使用HTTP协议和RESTful结构。API响应格式为JSON。

认证与授权

Yuansfer API 的认证与授权凭证为 API token, MerGroup NO, Merchant NO, Store NO, Store Admin NO ,签约的商户可以在Yuansfer后台获得相关信息。
每个签约商户均有唯一的API凭证内容,请妥善保管,不要在公共可访问区域(如GitHub、客户端代码等)共享凭据。
没有通过认证的请求将会失败。所有API请求建议使用Https协议



数字签名

<?php
function getVerifySign()
{
    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'date' => '20180620',
        'currency' => 'USD',
        'vendor' => 'alipay'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
}

getVerifySign();
?>
import java.util.Map;
import java.util.TreeMap;
import org.json.simple.JSONObject;
import com.nengjian.yuansfer.pos.utils.MapUrlUtils;
import com.nengjian.yuansfer.pos.utils.Md5Utils;

public class VerifySignExample {
    public static void main(String[] args) {
        Map<String, Object> map = new TreeMap<String, Object>();
        String yuansferToken = "59600f2a9ad644c6a9570233560cc94e";
        map.put("merchantNo", "200043");
        map.put("merGroupNo", "900001");
        map.put("storeNo", "300014");
        map.put("storeAdminNo", "3000140001");
        map.put("amount","0.01");
        VerifySignExample example = new VerifySignExample();
        String verifySign = example.getYuansferVerifySign(map, yuansferToken);
        JSONObject json = new JSONObject();
        json.put("verifySign", verifySign);
        System.out.println(json);
    }

    public String getYuansferVerifySign(final Map<String, Object> map, final String yuansferToken) {
        String calculateValue = commonGetVerifySign(map, yuansferToken);
        return calculateValue;
    }

    private String commonGetVerifySign(final Map<String, Object> map, final String yuansferToken) {
        Map<String, Object> treeMap = new TreeMap<String, Object>(map);
        String str = MapUrlUtils.getUrlParamsByMap(treeMap);
        str = str + "&" + Md5Utils.cryptHash(yuansferToken);

        String calculateValue = Md5Utils.cryptHash(str);
        return calculateValue;
    }
}


public class MapUrlUtils {
    public static String getUrlParamsByMap(Map<String, Object> map) {
        if (map == null) {
            return "";
        }
        StringBuilder sbuilder = new StringBuilder();
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            sbuilder.append(entry.getKey()).append("=").append(entry.getValue());
            sbuilder.append("&");
        }
        String s = sbuilder.toString();
        if (s.endsWith("&")) {
            s = StringUtils.substringBeforeLast(s, "&");
        }
        return s;
    }
}


public class Md5Utils {
    public static String cryptHash(String hashStr) {
        String strCrypt = hashStr;
        if (strCrypt.length() > 0) {
            strCrypt = hash(strCrypt);
        }
        return strCrypt;
    }

    public static  String hash(String str) {
        try {  
            MessageDigest md = MessageDigest.getInstance("MD5");  
            md.update(str.getBytes());  
            byte b[] = md.digest();  

            int i;  

            StringBuilder buf = new StringBuilder("");  
            for (int offset = 0; offset < b.length; offset++) {  
                i = b[offset];  
                if (i < 0)  
                    i += 256;  
                if (i < 16)  
                    buf.append("0");  
                buf.append(Integer.toHexString(i));  
            }  
            //32-bit Encryption
            return buf.toString();  
            //16-bit Encryption
            //return buf.toString().substring(8, 24);  
        } catch (NoSuchAlgorithmException e) {  
            e.printStackTrace();  
            return null;  
        } 
    }
}

package main

import (
    "crypto/md5"
    "encoding/hex"
    "sort"
)

func main() {
    var token string = "5cbfb079f15b150122261c8537086d77a"
    var data = make(map[string]string)

    data["amount"] = "1.00"
    data["storeNo"] = "300014"
    data["currency"] = "USD"
    data["merGroupNo"] = "900001"
    data["merchantNo"] = "200043"
    data["callbackUrl"] = "https://wx.yuansfer.yunkeguan.com/wx"
    data["terminal"] = "ONLINE"
    data["ipnUrl"] = "https://wx.yuansfer.yunkeguan.com/wx"
    data["reference"] = "seq_1525922323"
    data["vendor"] = "alipay"
    data["timeout"] = "120"
    data["goodsInfo"] = `[{"goods_name":"Yuansfer","quantity":"1"}]`

    //Step 1, 2:
    step2 := map2Str(data)
    //Step 3:
    step3 := step2 + md5Token(token)
    //Step 4:
    verifySign := md5Token(step3)
}

func md5Token(data string) string {
    md5 := md5.New()
    md5.Write([]byte(data))
    md5Data := md5.Sum([]byte(""))
    return hex.EncodeToString(md5Data)
}

func map2Str(m map[string]string) string {
    var keys []string
    for k := range m {
        if m[k] != "" {
            keys = append(keys, k)
        }
    }
    sort.Strings(keys)
    dec := ""
    for _, key := range keys {
        dec += key + "=" + m[key] + "&"
    }
    return dec
}

数字签名使用MD5散列,您可以从Yuansfer后台获得 API token 用来生成数字签名

数字签名生成规则

生成数字签名,需要遵循以下步骤:
1. 按字母顺序对参数名进行排序
2. 使用 '=' 和 '&' 来连接参数名称和值
3. 将API token 进行MD5散列,得到的散列值再追加前缀 '&' ,一起拼接到步骤2所得到的字符串后,得到一个新的字符串
4. 将步骤3的结果进行MD5散列,得到最终的数字签名

数字签名的示例

我们假设有如下参数:


1. 按字母顺序对参数名进行排序


2. 使用 '=' 和 '&' 来连接参数名称和值

amount=1.00&callbackUrl=https://wx.yuansfer.yunkeguan.com/wx&currency=USD&goodsInfo=[{"goods_name":"Yuansfer","quantity":"1"}]&ipnUrl=https://wx.yuansfer.yunkeguan.com/wx&merGroupNo=900001&merchantNo=200043&reference=seq_1525922323&storeNo=300014&terminal=ONLINE&timeout=120&vendor=alipay


3. 将 API token的散列值追加前缀 '&' 后拼接到步骤2得到的字符串之后。

假设 API token 值为 5cbfb079f15b150122261c8537086d77a, 它的 MD5 散列值为 is 186abea4b8610d7ff03768255588597a
所以得到 新的字符串 为 :
amount=1.00&callbackUrl=https://wx.yuansfer.yunkeguan.com/wx&currency=USD&goodsInfo=[{"goods_name":"Yuansfer","quantity":"1"}]&ipnUrl=https://wx.yuansfer.yunkeguan.com/wx&merGroupNo=900001&merchantNo=200043&reference=seq_1525922323&storeNo=300014&terminal=ONLINE&timeout=120&vendor=alipay&186abea4b8610d7ff03768255588597a


4. 将步骤3的结果进行MD5散列,得到最终的数字签名值

MD5 hash value is b6bfd66531ae7c9499115c7480a2c8aa


Online Payments API文档

使用Online Payments API 可以实现在线支付功能。Yuansfer提供的在线支付功能,支持支付宝,微信和银联。

Online Payments API 流程图

Sflow en 1. 当客户下单时,商户系统提交相关订单信息到Yuansfer
2. Yuansfer系统检查请求合法性
3. 如果请求合法,将根据订单选择的支付方式会返回相应的收银台页面
4. 客户在 收银台进行支付操作
5. Yuansfer系统将支付结果返回给商户系统
6. 商户系统向客户展示支付结果


备注:收银台页面截图如下:

Cashier alipay

支付宝收银台

Cashier wechatpay

微信收银台

Cashier unionpay

银联收银台

支付接口

Endpoint

POST https://mapi.yuansfer.com/online/v2/secure-pay
POST https://mapi.yuansfer.com/online/v2/secure-pay
POST https://mapi.yuansfer.com/appTransaction/v2/securepay
POST https://mapi.yuansfer.com/appTransaction/v2/securepay

Example Request

curl "https://mapi.yuansfer.com/online/v2/secure-pay" \
-d amount="1.00" \
-d storeNo="300014" \
-d currency="USD" \
-d merchantNo="200043" \
-d merGroupNo="900001" \
-d callbackUrl="https://wx.yuansfer.yunkeguan.com/wx" \
-d terminal="ONLINE" \
-d ipnUrl="https://wx.yuansfer.yunkeguan.com/wx" \
-d reference="seq_1525922323" \
-d vendor="alipay" \
-d verifySign="4f0cc35728849e4b4aa4a176f4a5edac"
<?php
function securepay()
{
    $url = 'https://mapi.yuansfer.com/online/v2/secure-pay';
    $token = '5cbfb079f15b150122261c8537086d77a';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'amount' => '0.01',
        'currency' => 'USD',
        'vendor' => 'alipay',
        'ipnUrl' => 'https://nengjtian.s1.natapp.cc/login/test',
        'callbackUrl' => 'https://nengjtian.s1.natapp.cc/login/test2?yuansferId={yuansferId}&status={status}&amount={amount}&time={time}&reference={reference}&note={note}',
        'terminal' => 'ONLINE',
        'reference' => 'test2018070101',
        'description' => 'test_description',
        'note' => 'test_note',
        'timeout' => '120'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

securepay();
?>
/**
 * testing class of securepay API
 * @author zhoukai
 *
 */
public class SecurepayTest {
    public static final String TEST_URL = "https://mapi.yuansfer.yunkeguan.com";            //Testing domain
    public static final String PROD_URL = "https://mapi.yuansfer.com";                      //Production domain
    public static final String YUANSFER_TOKEN = "5c5fe30183be69fceff8174358d4b8ae";

    public static void main(String[] args) {
        YuansferVerifySignHelper helper = new YuansferVerifySignHelper();

        YuansferSecurepayDto dto = paramSetting();
        Map<String, Object> params = ReflectionUtils.convertBean2MapIgnoreNullVal(dto, new String[]{"serialVersionUID"});
        String verifySign = helper.getYuansferVerifySign(params, YUANSFER_TOKEN); 
        params.put("verifySign", verifySign);

        String url = TEST_URL + "/appTransaction/v2/securepay";
        String ret = HttpClientUtils.post(url, null, params);
        System.out.println(ret);
    }

    public static YuansferSecurepayDto paramSetting() {
        YuansferSecurepayDto dto = new YuansferSecurepayDto();
        /**
         * merGroupNo, merchantNo,storeNo is necessory, and they are provided by Yuansfer
         */
        dto.setMerGroupNo("900001");                                                //The ISV NO.
        dto.setMerchantNo("200043");                                                //The Merchant NO.
        dto.setStoreNo("300014");                                                   //The Store NO.

        /**
         * transaction infomation is necessory
         */
        dto.setAmount("0.01");                                                      //The amount, unit "division"
        dto.setCurrency("USD");                                                     //currency, "USD"
        dto.setIpnUrl("https://nengjtian.s1.natapp.cc/login/test");                 //Asynchronous callback address
        dto.setCallbackUrl("https://nengjtian.s1.natapp.cc/login/test2");           //Synchronous callback address
        dto.setReference("9091023122");                                             //order NO. of client's system
        dto.setTerminal("ONLINE");                                                  //"ONLINE" or "WAP"
        dto.setTimeout("120");                                                      //unit "minute"
        dto.setVendor("alipay");                                                    //“alipay","wechatpay" or "unionpay"

        /**
         * note,desription are optional 
         */
        dto.setDescription("test-description");                                     //description
        dto.setNote("test-note");                                                   //note

        return dto;
    }
}
import (
    "fmt"
    "time"

    yuan "github.com/yuansfer/golang_sdk"
)

func securepay() {
    req := &yuan.Securepay{
        MerGroupNo:  "900001", //customer The ISV NO.
        MerchantNo:  "200043", //customer The merchant NO.
        StoreNo:     "300014",
        Currency:    "USD",
        Amount:      "0.01",
        Vendor:      "wechatpay",
        Reference:   fmt.Sprintf("demo_%d", time.Now().Unix()), //sequence number of customer system
        IpnUrl:      "https://customer-ipn",        //internet accessible 
        CallbackUrl: "https://customer-callback",   //internet accessible 
        Description: "description",
        Note:        "note",
        Terminal:    "ONLINE",
        Timeout:     "120",
    }

    goods := "Yuansfer"
    quantity := "1"
    if quantity != "" && goods != "" {
        goodsInfos := []yuan.GoodsInfomation{
            yuan.GoodsInfomation{
                GoodsName: goods,
                Quantity:  quantity,
            },
        }
        _ = req.Format(goodsInfos)
    }

    resp, err := req.PostToYuansfer(yuansferToken)
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println(resp)
}

Example Response

{
    "result":{
        "amount": "0.01",
        "reference": "44444",
        "transactionNo": "297245675773319174",
        "cashierUrl": "https://*****"
    },
    "ret_msg": "prepay success ",
    "ret_code": "000100"
}
{
    "result":{
        "amount": "0.01",
        "reference": "44444",
        "transactionNo": "297245675773319174",
        "cashierUrl": "https://*****"
    },
    "ret_msg": "prepay success ",
    "ret_code": "000100"
}
{
    "result":{
        "amount": "0.01",
        "reference": "44444",
        "transactionNo": "297245675773319174",
        "cashierUrl": "https://*****"
    },
    "ret_msg": "prepay success ",
    "ret_code": "000100"
}
{
    "result":{
        "amount": "0.01",
        "reference": "44444",
        "transactionNo": "297245675773319174",
        "cashierUrl": "https://*****"
    },
    "ret_msg": "prepay success ",
    "ret_code": "000100"
}

使用secure-pay() API进行下单,接口成功则返回收银台源码,商户系统直接将收银台页面展示即可

HTTP 请求

POST https://mapi.yuansfer.com/online/v2/secure-pay

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
amount

optional

decimal 订单美金金额
amount or rmbAmount有且只能存在一个
rmbAmount

optional

decimal 订单人民币金额
amount or rmbAmount有且只能存在一个
currency

required

enum 币种
目前仅支持: "USD"
vendor

required

enum 支付渠道
包括: "alipay", "wechatpay", "unionpay".
ipnUrl

required

string 异步通知url地址
更多详情参看 here.
异步通知参数参看 here.
callbackUrl

required

string 同步回调url地址。同步回调地址支持宏替换规则 xxxcallback_url?trans_no={amount}&amount={amount}, Yuansfer系统会替换{}中的内容.
同步回调参数参看 here.
terminal

required

enum 客户端类型
包括: "ONLINE", "WAP".
reference

required

string 商户系统支付流水号,要求唯一
description

optional

string 订单信息描述,该信息将会展示在收银台,不支持特殊字符
note

optional

string 订单备注信息,该信息将会在回调的时候原样返回给商户系统,不支持特殊字符
timeout

optional

integer 超时时间
默认120,单位分钟
goodsInfo

required

string 订单商品信息,使用JSON格式,不支持特殊字符
例如: [{"goods_name":"name1","quantity":"quantity1"},{"goods_name":"name2","quantity":"quantity2"}]
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
result object 详情
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

result object

参数 类型 描述
amount string 美金金额,当使用美金标价的时候返回此字段
rmbAmount string 人民币金额,当使用人民币标价的时候返回此字段
transactionNo string Yuansfer系统订单ID
reference string 商户系统支付流水号
cashierUrl string 跳转收银台页面的链接, 商户直接跳转到此链接即可打开收银台页面

In-Store Payments API文档

使用In-Store Payments API 可以实现线下支付功能
Yuansfer提供两种线下支付方案 商户扫码动态二维码

商户扫码

"商户扫码方案"用于线下门店支付,它使得商户能够通过扫描顾客的支付宝、微信或者银联云闪付的支付条形码/二维码完成支付 Pos workflow 1. 商户根据顾客所选择的商品信息,提交请求到Yuansfer系统创建其关联的订单
2. Yuansfer系统返回订单信息到商户系统
3. 顾客展示支付宝、微信或银联云闪付的支付条形码/二维码
4. 商户将订单信息和用户手机的支付条形码/二维码信息一起发送到Yuansfer
5. Yuansfer系统将支付结果返回给商户系统
6. 商户系统将支付结果展示给顾客

动态二维码

"动态二维码方案"用于线下门店支付,它使得顾客能够通过扫描二维码进行支付 Trans qrcode flow 1. 商户根据顾客所选的商品发送请求到Yuansfer系统创建相关的动态二维码
2. 商户将Yuansfer返回的动态二维码展示给顾客
3. 顾客通过支付宝、微信或银联云闪付APP扫描动态二维码来完成支付
4. Yuansfer系统将支付结果返回给商户系统

新增交易(商户扫码)

Endpoint

POST https://mapi.yuansfer.com/app-instore/v2/add
POST https://mapi.yuansfer.com/app-instore/v2/add
POST https://mapi.yuansfer.com/app-instore/v2/add
POST https://mapi.yuansfer.com/app-instore/v2/add

Example Request

curl "https://mapi.yuansfer.com/app-instore/v2/add" \
-d "storeNo=300014" \
-d "merchantNo=200043" \
-d "merGroupNo=900001" \
-d "amount=0.01" \
-d "verifySign=verifySign"
<?php
function transAdd()
{
    $url = 'https://mapi.yuansfer.yunkeguan.com/app-instore/v2/add';
    $token = '59600f2a9ad644c6a9570233560cc94e';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'vendor' => 'alipay',
        'amount' => '0.01'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

transAdd();
?>
//add
public static String transactionAdd() {
    String url = DOMAIN_URL + TRANSACTION_ADD;
    Map<String, Object> params = new TreeMap<String, Object>();
    params.put("merGroupNo", MER_GROUP_NO);
    params.put("merchantNo", MERCHANT_NO);
    params.put("storeNo", STORE_NO);
    if (StringUtils.isNotEmpty(STORE_ADMIN_NO)) {
        params.put("storeAdminNo", STORE_ADMIN_NO);
    }

    params.put("amount", "0.01");
    String verifySign = verifySignHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
    params.put("verifySign", verifySign);
    String ret = HttpClientUtils.post(url, null, params);
    System.out.println("---transaction add----");
    System.out.println(ret);
    JSONObject retInfo = (JSONObject)JSONValue.parse(ret);
    JSONObject transaction = (JSONObject)retInfo.get("transaction");
    String transactionNo = transaction.get("transactionNo").toString();
    return transactionNo;
}

Example Response

{
    "ret_msg": "add success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": null,
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "init",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "add success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": null,
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "init",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "add success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": null,
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "init",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "add success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": null,
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "init",
        "transactionType": "payment"
    }
}

使用 add() API 可以创建一个 商户扫码 订单

HTTP 请求

POST https://mapi.yuansfer.com/app-instore/v2/add

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
amount

required

decimal 金额
currency

required

enum 币种,目前仅支持USD
reference

optional

string 商户系统支付流水号
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
transaction object 订单信息 对象
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

支付(商户扫码)

Endpoint

POST https://mapi.yuansfer.com/app-instore/v2/pay
POST https://mapi.yuansfer.com/app-instore/v2/pay
POST https://mapi.yuansfer.com/app-instore/v2/pay
POST https://mapi.yuansfer.com/app-instore/v2/pay

Example Request

curl "https://mapi.yuansfer.com/app-instore/v2/pay" \
-d "storeNo=300014" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "transactionNo=transactionNo" \
-d "paymentBarcode=paymentBarcode" \
-d "vendor=alipay" \
-d "verifySign=verifySign"
<?php
function transPay()
{
    $url = 'https://mapi.yuansfer.yunkeguan.com/app-instore/v2/pay';
    $token = '59600f2a9ad644c6a9570233560cc94e';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'transactionNo' => '297553565108438359',
        'vendor' => 'alipay',
        'amount' => '0.01',
        'paymentBarcode' => '280526696410694666'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

transPay();
?>
//pay
public static void transactionPay(String transactionNo) {
    String url = DOMAIN_URL + TRANSACTION_PAY;
    Map<String, Object> params = new TreeMap<String, Object>();
    params.put("merGroupNo", MER_GROUP_NO);
    params.put("merchantNo", MERCHANT_NO);
    params.put("storeNo", STORE_NO);
    if (StringUtils.isNotEmpty(STORE_ADMIN_NO)) {
        params.put("storeAdminNo", STORE_ADMIN_NO);
    }

    params.put("transactionNo", transactionNo);
    params.put("paymentBarcode", "286754322648217439");
    params.put("vendor", "alipay");
    String verifySign = verifySignHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
    params.put("verifySign", verifySign);
    String ret = HttpClientUtils.post(url, null, params);
    System.out.println("---transaction pay----");
    System.out.println(ret);
}

Example Response

{
    "ret_msg": "pay success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "pay success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "pay success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "pay success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}

使用 pay() API 将add() 所创建的订单提交支付

HTTP 请求

POST https://mapi.yuansfer.com/app-instore/v2/pay

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
transactionNo

optional

string Yuansfer系统订单ID
transactionNoreference 有且只能存在一个
reference

optional

string 商户系统支付流水号
Either transactionNo or reference 有且只能存在一个
paymentBarcode

required

string 顾客支付条形码/二维码内容
vendor

required

enum 支付渠道
包括: "alipay", "wechatpay","unionpay".
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
transaction object 订单信息 对象
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

新增交易(用户扫码)

Endpoint

POST https://mapi.yuansfer.com/app-instore/v2/create-trans-qrcode
POST https://mapi.yuansfer.com/app-instore/v2/create-trans-qrcode
POST https://mapi.yuansfer.com/app-instore/v2/create-trans-qrcode
POST https://mapi.yuansfer.com/app-instore/v2/create-trans-qrcode

Example Request

curl "https://mapi.yuansfer.com/app-instore/v2/create-trans-qrcode" \
-d "storeNo=300014" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "currency=USD" \
-d "reference=reference" \
-d "vendor=alipay" \
-d "ipnUrl=IPN URL" \
-d "amount=0.01" \
-d "verifySign=verifySign"
<?php
function transQrcode()
{
    $url = 'https://mapi.yuansfer.yunkeguan.com/app-instore/v2/create-trans-qrcode';
    $token = '59600f2a9ad644c6a9570233560cc94e';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'vendor' => 'alipay',
        'amount' => '0.01',
        'ipnUrl' => 'https://nengjtian.s1.natapp.cc/login/test',
        'reference' => 'test2018061901',
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

transQrcode();
?>

public static void transQrcode() {
    String url = DOMAIN_URL + TRANS_QRCODE;
    Map<String, Object> params = new TreeMap<String, Object>();
    params.put("merGroupNo", MER_GROUP_NO);
    params.put("merchantNo", MERCHANT_NO);
    params.put("storeNo", STORE_NO);
    if (StringUtils.isNotEmpty(STORE_ADMIN_NO)) {
        params.put("storeAdminNo", STORE_ADMIN_NO);
    }

    params.put("vendor", "alipay");
    params.put("amount", "0.01");
    params.put("ipnUrl", "https://nengjtian.s1.natapp.cc/login/test");
    params.put("reference", "testabc100");
    String verifySign = verifySignHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
    params.put("verifySign", verifySign);
    String ret = HttpClientUtils.post(url, null, params);
    System.out.println("---trans-qrcode-create ----");
    System.out.println(ret);
}

Example Response

{
    "amount":"0.01",
    "reference":"testabc1001",
    "deepLink":"url1",
    "transactionNo":"297553556919345525",
    "ret_code":"000100",
    "timeout":"120",
    "qrcodeUrl":"url2"
}
{
    "amount":"0.01",
    "reference":"testabc1001",
    "deepLink":"url1",
    "transactionNo":"297553556919345525",
    "ret_code":"000100",
    "timeout":"120",
    "qrcodeUrl":"url2"
}
{
    "amount":"0.01",
    "reference":"testabc1001",
    "deepLink":"url1",
    "transactionNo":"297553556919345525",
    "ret_code":"000100",
    "timeout":"120",
    "qrcodeUrl":"url2"
}
{
    "amount":"0.01",
    "reference":"testabc1001",
    "deepLink":"url1",
    "transactionNo":"297553556919345525",
    "ret_code":"000100",
    "timeout":"120",
    "qrcodeUrl":"url2"
}

使用 create-trans-qrcode() API 创建交易二维码,顾客可以通过扫描交易二维码完成支付

HTTP 请求

POST https://mapi.yuansfer.com/app-instore/v2/create-trans-qrcode

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
amount

required

decimal 金额
currency

required

enum 币种
vendor

required

enum 支付渠道
包括: "alipay", "wechatpay".注意,动态二维码暂不支持银联闪付
reference

required

string 商户系统支付流水号
ipnUrl

optional

string 异步通知url地址
更多详情参看 here.
异步通知参数参看 here.
needQrcode

optional

string 值为: true 或者 false. 默认为 true.
如果值为 true, Yuansfer系统将会创建二维码图片
如果值为 false, Yuansfer系统将不会创建二维码图片
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
transactionNo string Yuansfer系统订单ID
reference string 商户系统支付流水号
amount decimal 金额
timeout integer 超时时间,默认120,单位分钟
deepLink string 支付宝或者微信的deepLink,即支付链接
qrcodeUrl string 根据deepLink生成的二维码
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

取消交易

Endpoint

POST https://mapi.yuansfer.com/app-instore/v2/reverse

Example Request

curl "https://mapi.yuansfer.com/app-instore/v2/reverse" \
-d "storeNo=300014" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "transactionNo=transactionNo" \
-d "verifySign=verifySign"

<?php
function transReverse()
{
    $url = 'https://mapi.yuansfer.yunkeguan.com/app-instore/v2/reverse';
    $token = '59600f2a9ad644c6a9570233560cc94e';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'transactionNo' => '297553565108438359'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

transReverse();
?>
//reverse
public static void transactionReverse(String transactionNo) {
    String url = DOMAIN_URL + TRANSACTION_REVERSE;
    Map<String, Object> params = new TreeMap<String, Object>();
    params.put("merGroupNo", MER_GROUP_NO);
    params.put("merchantNo", MERCHANT_NO);
    params.put("storeNo", STORE_NO);
    if (StringUtils.isNotEmpty(STORE_ADMIN_NO)) {
        params.put("storeAdminNo", STORE_ADMIN_NO);
    }

    params.put("transactionNo", transactionNo);
    String verifySign = verifySignHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
    params.put("verifySign", verifySign);
    String ret = HttpClientUtils.post(url, null, params);
    System.out.println("---transaction reverse----");
    System.out.println(ret);
}

Example Response

{
    "ret_msg": "reverse success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "reversed",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "reverse success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "reversed",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "reverse success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "reversed",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "reverse success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "reversed",
        "transactionType": "payment"
    }
}

使用 reverse() API 来取消交易
如果顾客还没有支付,取消订单后订单变为关闭状态,顾客也将不能继续支付
如果顾客已经支付完成,取消订单后Yuansfer将原路径退款给顾客

HTTP 请求

POST https://mapi.yuansfer.com/app-instore/v2/reverse

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
transactionNo

optional

string Yuansfer系统订单ID
transactionNoreference 有且只能存在一个
reference

optional

string 商户系统支付流水号
transactionNoreference 有且只能存在一个
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
transaction object 订单信息 对象
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

预付款扣款

Endpoint

POST https://mapi.yuansfer.com/app-instore/v2/auth-capture

Example Request

curl "https://mapi.yuansfer.com/app-instore/v2/auth-capture" \
-d "storeNo=300014" \
-d "merchantNo=200043" \
-d "merGroupNo=900001" \
-d "amount=0.01" \
-d "transactionNo=transactionNo" \
-d "verifySign=verifySign"


Example Response

{
    "ret_msg": "pay success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "pay success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "pay success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "pay success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}

使用 auth-capture() API 来针对预授权订单进行扣款

HTTP 请求

POST https://mapi.yuansfer.com/app-instore/v2/auth-capture

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
transactionNo

optional

string Yuansfer系统订单ID
transactionNoreference 有且只能存在一个
reference

optional

string 商户系统支付流水号
transactionNoreference 有且只能存在一个
amount

required

string 金额
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
transaction object 订单信息 对象
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

预付款解冻

Endpoint

POST https://mapi.yuansfer.com/app-instore/v2/auth-unfreeze

Example Request

curl "https://mapi.yuansfer.com/app-instore/v2/auth-unfreeze" \
-d "storeNo=300014" \
-d "merchantNo=200043" \
-d "merGroupNo=900001" \
-d "unfreezeAmount=0.01" \
-d "transactionNo=transactionNo" \
-d "verifySign=verifySign"


Example Response

{
    "ret_msg": "unfreeze success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "unfreeze success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "unfreeze success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}
{
    "ret_msg": "unfreeze success ",
    "ret_code": "000100",
    "transaction":{
        "amount": 0.01,
        "createTime": "2018-02-16 18:17:57",
        "currency": "USD",
        "exchangeRate": null,
        "merchantNo": "200043",
        "originalTransactionNo": null,
        "paymentTime": "2018-02-16 18:17:57",
        "refundAmount": 0,
        "storeAdminNo": "3000140001",
        "storeNo": "300014",
        "transactionNo": "297553554508274472",
        "transactionStatus": "success",
        "transactionType": "payment"
    }
}

使用 auth-unfreeze() API 来针对预授权订单进行解冻

HTTP 请求

POST https://mapi.yuansfer.com/app-instore/v2/auth-unfreeze

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
transactionNo

optional

string Yuansfer系统订单ID
transactionNoreference 有且只能存在一个
reference

optional

string 商户系统支付流水号
transactionNoreference 有且只能存在一个
unfreezeAmount

required

string 解冻金额
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
transaction object 订单信息 对象
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

移动应用支付API文档

Yuansfer系统提供移动应用支付接口,包含APP和微信小程序,关于微信小程序参见WeChat Mini-Program

微信小程序API支付权限开通流程
1. 申请公司的主体须是美国公司
2. 提供小程序连接和openid
3. Yuansfer提交给微信官方进行审核
4. 商户微信开通支付权限,根据微信开发文档对接小程序支付

See 微信小程序支付官方文档.

预付款

使用 prepay() API 获得微信小程序支付能力

Example Request:

curl "https://mapi.yuansfer.com/micropay/v2/prepay" \
-d amount="1.00" \
-d storeNo="300014" \
-d currency="USD" \
-d merGroupNo="900001" \
-d merchantNo="200043" \
-d ipnUrl="https://wx.yuansfer.yunkeguan.com/wx" \
-d reference="seq_1525922323" \
-d description="testDescription"\
-d note="testNote"\
-d openid="***"\
-d vendor="wechatpay" \
-d verifySign="4f0cc35728849e4b4aa4a176f4a5edac"
/<?php
function microprepay()
{
    $url = 'https://mapi.yuansfer.com/micropay/v2/prepay';
    $token = '5cbfb079f15b150122261c8537086d77a';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'amount' => '0.01',
        'currency' => 'USD',
        'vendor' => 'wechatpay',
        'ipnUrl' => 'https://nengjtian.s1.natapp.cc/login/test',        
        'reference' => 'test2018070101',
        'description' => 'test_description',
        'note' => 'test_note',
        'openid' => '***'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

microprepay();
?>
/**
 * prepay test
 * @author zhoukai
 *
 */
public class MicropayTest {

    public static final String TEST_URL = "https://mapi.yuansfer.yunkeguan.com";            //testing domain
    public static final String PROD_URL = "https://mapi.yuansfer.com";                      //production domain
    public static final String YUANSFER_TOKEN = "5c5fe30183be69fceff8174358d4b8ae";


    public static void main(String[] args) {
        YuansferVerifySignHelper helper = new YuansferVerifySignHelper();

        AppMircopayDto dto = paramSetting();
        Map<String, Object> params = ReflectionUtils.convertBean2MapIgnoreNullVal(dto, new String[]{"serialVersionUID"});
        String verifySign = helper.getYuansferVerifySign(params, YUANSFER_TOKEN); 
        params.put("verifySign", verifySign);

        String url = TEST_URL + "/micropay/v2/prepay";
        String ret = HttpClientUtils.post(url, null, params);
        System.out.println(ret);
    }

    public static AppMircopayDto paramSetting() {
        AppMircopayDto dto = new AppMircopayDto();
        /**
         * merGroupNo, merchantNo,storeNo is necessory, and they are provided by Yuansfer
         */
        dto.setMerGroupNo("900001");                                                //The ISV NO.
        dto.setMerchantNo("200043");                                                //The Merchant NO.
        dto.setStoreNo("300014");                                                   //The Store NO.

        /**
         * transaction infomation is necessory
         */
        dto.setAmount("0.01");                                                      //The amount, unit "division"
        dto.setCurrency("USD");                                                     //currency, "USD"
        dto.setIpnUrl("https://nengjtian.s1.natapp.cc/login/test");                 //Asynchronous callback address
        dto.setReference("9091023122");                                             //order NO. of client's system
        dto.setOpenid("***");                                                       //wechat openid
        dto.setVendor("wechatpay");                                                 //"wechatpay" 

        /**
         * note,desription are optional 
         */
        dto.setDescription("test-description");                                     //description
        dto.setNote("test-note");                                                   //note

        return dto;
    }
}
func mciropay(t *table) {
    req := yuan.Securepay{
        MerchantNo:  "200043", //customer The merchant NO.
        StoreNo:     "300014",
        Currency:    "USD",
        Amount:      "0.01",
        Vendor:      "wechatpay",
        Reference:   fmt.Sprintf("demo_%d", time.Now().Unix()), //sequence number of customer system
        IpnUrl:      "https://customer-ipn",        //internet accessible 
        Description: "description",
        Note:        "note",
        Openid:      "***",
    }
    resp, err := req.PostToYuansfer(yuansferToken)
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println(resp)
}

Example Response:


{
    "ret_msg": "prepay success",
    "ret_code": "000100",
    "result": {
        "timeStamp": "1510341967363",
        "nonceStr": "a611bda03d544b9f941393c48c2e517f",
        "package": "prepay_id=wx201711110326070ccf2a7f060678638664",
        "signType": "MD5",
        "paySign": "09E5BE5B9D93080E3B7DD05C8F41049E"
    }
}

{
    "ret_msg": "prepay success",
    "ret_code": "000100",
    "result": {
        "timeStamp": "1510341967363",
        "nonceStr": "a611bda03d544b9f941393c48c2e517f",
        "package": "prepay_id=wx201711110326070ccf2a7f060678638664",
        "signType": "MD5",
        "paySign": "09E5BE5B9D93080E3B7DD05C8F41049E"
    }
}
{
    "ret_msg": "prepay success",
    "ret_code": "000100",
    "result": {
        "timeStamp": "1510341967363",
        "nonceStr": "a611bda03d544b9f941393c48c2e517f",
        "package": "prepay_id=wx201711110326070ccf2a7f060678638664",
        "signType": "MD5",
        "paySign": "09E5BE5B9D93080E3B7DD05C8F41049E"
    }
}
{
    "ret_msg": "prepay success",
    "ret_code": "000100",
    "result": {
        "timeStamp": "1510341967363",
        "nonceStr": "a611bda03d544b9f941393c48c2e517f",
        "package": "prepay_id=wx201711110326070ccf2a7f060678638664",
        "signType": "MD5",
        "paySign": "09E5BE5B9D93080E3B7DD05C8F41049E"
    }
}

HTTP 请求

POST https://mapi.yuansfer.com/micropay/v2/prepay

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

String 店铺号
amount

optional

decimal 美金金额
amountrmbAmount 有且只能存在一个
rmbAmount

optional

decimal 人民币金额
amountrmbAmount 有且只能存在一个
currency

required

enum 币种
包括: "USD".
vendor

required

enum "wechatpay", "alipay"
ipnUrl

required

String 异步通知url地址
更多详情参看 here.
异步通知参数参看 here.
openid

optional

string 微信小程序需要用到
reference

required

string 商户系统支付流水号
terminal

required

enum "MINIPROGRAM","APP"
description

optional

string 订单描述信息
note

optional

string 订单备注信息
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
result object 小程序预支付信息 对象.
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

result object

参数 类型 描述
timeStamp string 时间戳
nonceStr string 随机字符串
package string prepay_id 信息
signType string 签名类型
paySign string 签名

数据查询

退款接口

Endpoint

POST https://mapi.yuansfer.com/app-data-search/v2/refund
POST https://mapi.yuansfer.com/app-data-search/v2/refund
POST https://mapi.yuansfer.com/online/v2/securepay-refund
POST https://mapi.yuansfer.com/online/v2/securepay-refund

Example Request

curl "https://mapi.yuansfer.com/app-data-search/v2/refund" \
-d "amount=0.01" \
-d "storeNo=300014" \
-d "currency=USD" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "reference=origin_reference" \
-d "verifySign=verifySign"
<?php
function securepayRefund()
{
    $url = 'https://mapi.yuansfer.com/app-data-search/v2/refund';
    $token = '5cbfb079f15b150122261c8537086d77a';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'amount' => '0.01',
        'reference' => 'test2018070101',
        'managerAccountNo' => '3000140001',
        'password' => '1e2958a66c609467a4794c6c8adf3b84'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

securepayRefund();
?>
public class SecurepayRefundTest {
    public static final String TEST_URL = "https://mapi.yuansfer.yunkeguan.com";            //Testing domain
    public static final String PROD_URL = "https://mapi.yuansfer.com";                      //Production domain
    public static final String YUANSFER_TOKEN = "5c5fe30183be69fceff8174358d4b8ae";

    public static void main(String[] args) {
        YuansferSecurepayRefundDto refundDto = new YuansferSecurepayRefundDto();
        YuansferVerifySignHelper verifyHelper = new YuansferVerifySignHelper();
        refundDto.setAmount("0.01");
        refundDto.setCurrency("USD");
        refundDto.setMerGroupNo("900001");
        refundDto.setMerchantNo("200043");
        refundDto.setStoreNo("300014");
        refundDto.setReference("9091023122");

        /**
         * When managerAccountNo and password are refund, 
         * shop manager's permission check can be configured in the yuansfer background, 
         * and the check is unnecessary. If you don't check, you don't need to enter store account and password.
         */
        // YuansferPwdHelper pwdHelper = new YuansferPwdHelper();
        // refundDto.setManagerAccountNo("3000140001");    
        // String managerPwd = pwdHelper.genPwd("111111"); 
        // ßrefundDto.setPassword(managerPwd);

        Map<String, Object> params = ReflectionUtils.convertBean2MapIgnoreNullVal(refundDto, new String[]{"serialVersionUID"});
        String verifySign = verifyHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
        refundDto.setVerifySign(verifySign);
        params.put("verifySign", verifySign);

        String url = TEST_URL + "/appTransaction/v2/securepayRefund";
        String ret = HttpClientUtils.post(url, null, params);
        JSON json = JSON.parseObject(ret);
        System.out.println(json);
    }
}
func refund(t *table) {
    req := yuan.Refund{
        MerGroupNo:       "900001", //customer The ISV NO.
        MerchantNo:       "200043", //customer The merchant NO.
        StoreNo:          "300014",
        Currency:         "USD",
        Reference:        "original sequence No.", //sequence number of customer system
        Amount:           "0.01",
    }

    resp, err := req.PostToYuansfer(yuansferToken)
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println(resp)
}

Example Response

{
    "result":{
        "amount": "0.01",
        "status": "success",
        "currency": "USD",
        "settleCurrency": "USD",
        "exchangeRate": "6.718800",
        "reference": "44444",
        "refundAmount": "0.01",
        "refundTransactionId": "297245675773380538",
        "refundReference": "123123",
        "oldTransactionId": "297245675773319174"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "result":{
        "amount": "0.01",
        "status": "success",
        "currency": "USD",
        "settleCurrency": "USD",
        "exchangeRate": "6.718800",
        "reference": "44444",
        "refundAmount": "0.01",
        "refundTransactionId": "297245675773380538",
        "refundReference": "123123",
        "oldTransactionId": "297245675773319174"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "result":{
        "amount": "0.01",
        "status": "success",
        "currency": "USD",
        "settleCurrency": "USD",
        "exchangeRate": "6.718800",
        "reference": "44444",
        "refundAmount": "0.01",
        "refundTransactionId": "297245675773380538",
        "refundReference": "123123",
        "oldTransactionId": "297245675773319174"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "result":{
        "amount": "0.01",
        "status": "success",
        "currency": "USD",
        "settleCurrency": "USD",
        "exchangeRate": "6.718800",
        "reference": "44444",
        "refundAmount": "0.01",
        "refundTransactionId": "297245675773380538",
        "refundReference": "123123",
        "oldTransactionId": "297245675773319174"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}

使用securepay-refund() API进行在线支付退款

HTTP 请求

POST https://mapi.yuansfer.com/app-data-search/v2/refund

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
amount

optional

decimal 退款美金金额
amount or rmbAmount 有且只能存在一个,必须和原支付订单一致
rmbAmount

optional

decimal 退款人民币金额
amount or rmbAmount 有且只能存在一个,必须和原支付订单一致
transactionNo

optional

string Yuansfer系统订单ID
transactionNoreference 有且只能存在一个
reference

optional

string 商户系统支付流水号
Either transactionNo or reference 有且只能存在一个
refundReference

optional

string 商户系统退款流水号
managerAccountNo

optional

string 店长账号
商户可以配置调用退款的时候是否需要店长权限校验,默认不需要,如果配置了需要校验此字段则必填
password

optional

string 密码生成公式: MD5(“@yuanex” + Store admin password)
商户可以配置调用退款的时候是否需要店长权限校验,默认不需要,如果配置了需要校验此字段则必填
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
result object 退款详情
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

result object

参数 类型 描述
amount string 原订单支付金额
rmbAmount string 原订单支付人民币金额,支付订单使用rmbAmount时才会返回此字段
refundAmount string 退款金额
refundRmbAmount string 退款人民币金额,支付订单使用rmbAmount时才会返回此字段
currency string 交易币种
settleCurrency string 结算币种
exchangeRate string 汇率
status enum 状态
reference string 商户系统支付流水号
refundReference string 商户系统退款流水号
refundTransactionId string Yuansfer系统退款订单ID
oldTransactionId string Yuansfer系统原支付订单ID

订单查询接口

Endpoint

POST https://mapi.yuansfer.com/app-data-search/v2/tran-query
POST https://mapi.yuansfer.com/app-data-search/v2/tran-query
POST https://mapi.yuansfer.com/app-data-search/v2/tran-query
POST https://mapi.yuansfer.com/app-data-search/v2/tran-query

Example Request

curl "https://mapi.yuansfer.com/app-data-search/v2/tran-query" \
-d "storeNo=300014" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "reference=origin_reference" \
-d "verifySign=verifySign"
<?php
function securepayReferenceQuery()
{
    $url = 'https://mapi.yuansfer.com/app-data-search/v2/tran-query';
    $token = '5cbfb079f15b150122261c8537086d77a';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'reference' => 'test2018070101'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

securepayReferenceQuery();
?>
public class SecurepayReferenceQueryTest {
    public static final String TEST_URL = "https://mapi.yuansfer.yunkeguan.com";            //Testing domain
    public static final String PROD_URL = "https://mapi.yuansfer.com";                      //Production domain
    public static final String YUANSFER_TOKEN = "5cbfb079f15b150122261c8537086d77a";

    public static void main(String[] args) {
        YuansferVerifySignHelper helper = new YuansferVerifySignHelper();

        YuansferSecurepayQueryDto dto = paramSetting();
        Map<String, Object> params = ReflectionUtils.convertBean2MapIgnoreNullVal(dto, new String[]{"serialVersionUID"});
        String verifySign = helper.getYuansferVerifySign(params, YUANSFER_TOKEN);  //verifySign
        params.put("verifySign", verifySign);

        String url = TEST_URL + "/app-data-search/v2/tran-query";
        String ret = HttpClientUtils.post(url, null, params);
        System.out.println(ret);
    }

    public static YuansferSecurepayQueryDto paramSetting() {
        YuansferSecurepayQueryDto dto = new YuansferSecurepayQueryDto();
        dto.setMerGroupNo("900001");                                                //The ISV NO.
        dto.setMerchantNo("200043");                                                //The merchant NO.
        dto.setStoreNo("300014");                                                   //The store NO.
        dto.setReference("20180126162433");
        return dto;
    }
}


func query(t *table) {
    req := yuan.Query{
        MerGroupNo: "900001", //customer The ISV NO.
        MerchantNo: "200043", //customer The merchant NO.
        StoreNo:    "300014",
        Currency:   "USD",
        Reference:  "original sequence No.", //sequence number of customer system
        Terminal:   "ONLINE",
    }

    //TO CALL VERIFYSIGN
    resp, err := req.PostToYuansfer(yuansferToken)
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println(resp)
}

Example Response

  {
    "result":{
    "reference": "test20180801006",
    "transactionId": "297553569604475564",
    "amount": "2.00",
    "refundInfo":[
        {
            "refundTransactionId": "297553569604658581",
            "refundAmount": "1.50"
            "currency": "USD"
            "settleCurrency": "USD"
            "refundReference": "123123"
        },
        {
            "refundTransactionId": "297553569604680588",
            "refundAmount": "0.50"
            "currency": "USD"
            "settleCurrency": "USD"
            "refundReference": "123123"
        }
    ],
    "currency": "USD",
    "settleCurrency": "USD",
    "transactionType": "payment",
    "exchangeRate": "6.6653",
    "amount": "2.00",
    "status": "success"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}

{
    "result":{
    "reference": "test20180801006",
    "transactionId": "297553569604475564",
    "amount": "2.00",
    "refundInfo":[
        {
            "refundTransactionId": "297553569604658581",
            "refundAmount": "1.50"
            "currency": "USD"
            "settleCurrency": "USD"
            "refundReference": "123123"
        },
        {
            "refundTransactionId": "297553569604680588",
            "refundAmount": "0.50"
            "currency": "USD"
            "settleCurrency": "USD"
            "refundReference": "123123"
        }
    ],
    "currency": "USD",
    "settleCurrency": "USD",
    "transactionType": "payment",
    "exchangeRate": "6.6653",
    "status": "success"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "result":{
    "reference": "test20180801006",
    "transactionId": "297553569604475564",
    "amount": "2.00",
    "refundInfo":[
        {
            "refundTransactionId": "297553569604658581",
            "refundAmount": "1.50"
            "currency": "USD"
            "settleCurrency": "USD"
            "refundReference": "123123"
        },
        {
            "refundTransactionId": "297553569604680588",
            "refundAmount": "0.50"
            "currency": "USD"
            "settleCurrency": "USD"
            "refundReference": "123123"
        }
    ],
    "currency": "USD",
    "settleCurrency": "USD",
    "transactionType": "payment",
    "exchangeRate": "6.6653",
    "status": "success"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "result":{
    "reference": "test20180801006",
    "transactionId": "297553569604475564",
    "amount": "2.00",
    "refundInfo":[
        {
            "refundTransactionId": "297553569604658581",
            "refundAmount": "1.50"
            "currency": "USD"
            "settleCurrency": "USD"
            "refundReference": "123123"
        },
        {
            "refundTransactionId": "297553569604680588",
            "refundAmount": "0.50"
            "currency": "USD"
            "settleCurrency": "USD"
            "refundReference": "123123"
        }
    ],
    "currency": "USD",
    "settleCurrency": "USD",
    "transactionType": "payment",
    "exchangeRate": "6.6653",
    "status": "success"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}

使用securepay-reference-query() API 可以根据商户系统支付流水号查询Yuansfer系统中关联订单的信息

HTTP 请求

POST https://mapi.yuansfer.com/app-data-search/v2/tran-query

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
transactionNo

optional

string Yuansfer系统订单ID
transactionNoreference 有且只能存在一个
reference

optional

string 商户系统支付流水号
Either transactionNo or reference 有且只能存在一个
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
result object 订单详情
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

result object

参数 类型 描述
transactionId string Yuansfer系统订单ID
reference string 商户系统支付流水号
amount decimal 订单金额
rmbAmount decimal 订单人民币金额,支付订单使用rmbAmount时才会返回此字段
status string 状态
currency string 交易币种
settleCurrency string 结算币种
transactionType enums 订单类型 payment 或者 refund
exchangeRate string 汇率
refundInfo array 关联的退款信息 refundInfo

refundInfo object

参数 类型 描述
refundTransactionId string Yuansfer系统退款订单ID
refundReference string 商户系统退款流水号
refundAmount string 退款金额
refundRmbAmount string 退款人民币金额,支付订单使用rmbAmount时才会返回此字段
currency string 交易币种
settleCurrency string 结算币种

交易列表

Endpoint

POST https://mapi.yuansfer.com/app-data-search/v2/trans-list
POST https://mapi.yuansfer.com/app-data-search/v2/trans-list
POST https://mapi.yuansfer.com/app-data-search/v2/trans-list
POST https://mapi.yuansfer.com/app-data-search/v2/trans-list

Example Request

curl "https://mapi.yuansfer.com/app-data-search/v2/trans-list" \
-d "storeNo=300014" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "startDate=startDate" \
-d "endDate=endDate" \
-d "verifySign=verifySign"
<?php
function transList()
{
    $url = 'https://mapi.yuansfer.yunkeguan.com/app-data-search/v2/trans-list';
    $token = '59600f2a9ad644c6a9570233560cc94e';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'startDate' => '20180619',
        'endDate' => '20180619'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

transList();
?>
//transaction list
public static void transactionList(String startDate, String endDate) {
    String url = DOMAIN_URL + TRANSACTION_LIST;
    Map<String, Object> params = new TreeMap<String, Object>();
    params.put("merGroupNo", MER_GROUP_NO);
    params.put("merchantNo", MERCHANT_NO);
    params.put("storeNo", STORE_NO);
    if (StringUtils.isNotEmpty(STORE_ADMIN_NO)) {
        params.put("storeAdminNo", STORE_ADMIN_NO);
    }

    params.put("startDate", startDate);
    params.put("endDate", endDate);
    String verifySign = verifySignHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
    params.put("verifySign", verifySign);
    String ret = HttpClientUtils.post(url, null, params);
    System.out.println("---transaction list----");
    System.out.println(ret);
}

Example Response

{
    "size": 2,
    "transactions":[
        {
            "amount": -0.01,
            "createTime": "2018-03-02 14:49:38",
            "currency": "USD",
            "exchangeRate": "6.361300",
            "merchantNo": "200043",
            "originalTransactionNo": "297553555705268810",
            "paymentTime": "2018-03-02 14:49:38",
            "refundAmount": 0,
            "storeAdminNo": null,
            "storeNo": "300014",
            "transactionNo": "297553555705374195",
            "transactionStatus": "success",
            "transactionType": "refund",
            "vendor": "wechatpay"
        },
        {
            "amount": 0.01,
            "createTime": "2018-03-02 14:47:52",
            "currency": "USD",
            "exchangeRate": "6.361300",
            "merchantNo": "200043",
            "originalTransactionNo": null,
            "paymentTime": "2018-03-02 14:48:07",
            "refundAmount": 0.01,
            "storeAdminNo": null,
            "storeNo": "300014",
            "transactionNo": "297553555705268810",
            "transactionStatus": "success",
            "transactionType": "payment",
            "vendor": "wechatpay"
        }
    ],
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "size": 2,
    "transactions":[
        {
            "amount": -0.01,
            "createTime": "2018-03-02 14:49:38",
            "currency": "USD",
            "exchangeRate": "6.361300",
            "merchantNo": "200043",
            "originalTransactionNo": "297553555705268810",
            "paymentTime": "2018-03-02 14:49:38",
            "refundAmount": 0,
            "storeAdminNo": null,
            "storeNo": "300014",
            "transactionNo": "297553555705374195",
            "transactionStatus": "success",
            "transactionType": "refund",
            "vendor": "wechatpay"
        },
        {
            "amount": 0.01,
            "createTime": "2018-03-02 14:47:52",
            "currency": "USD",
            "exchangeRate": "6.361300",
            "merchantNo": "200043",
            "originalTransactionNo": null,
            "paymentTime": "2018-03-02 14:48:07",
            "refundAmount": 0.01,
            "storeAdminNo": null,
            "storeNo": "300014",
            "transactionNo": "297553555705268810",
            "transactionStatus": "success",
            "transactionType": "payment",
            "vendor": "wechatpay"
        }
    ],
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "size": 2,
    "transactions":[
        {
            "amount": -0.01,
            "createTime": "2018-03-02 14:49:38",
            "currency": "USD",
            "exchangeRate": "6.361300",
            "merchantNo": "200043",
            "originalTransactionNo": "297553555705268810",
            "paymentTime": "2018-03-02 14:49:38",
            "refundAmount": 0,
            "storeAdminNo": null,
            "storeNo": "300014",
            "transactionNo": "297553555705374195",
            "transactionStatus": "success",
            "transactionType": "refund",
            "vendor": "wechatpay"
        },
        {
            "amount": 0.01,
            "createTime": "2018-03-02 14:47:52",
            "currency": "USD",
            "exchangeRate": "6.361300",
            "merchantNo": "200043",
            "originalTransactionNo": null,
            "paymentTime": "2018-03-02 14:48:07",
            "refundAmount": 0.01,
            "storeAdminNo": null,
            "storeNo": "300014",
            "transactionNo": "297553555705268810",
            "transactionStatus": "success",
            "transactionType": "payment",
            "vendor": "wechatpay"
        }
    ],
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "size": 2,
    "transactions":[
        {
            "amount": -0.01,
            "createTime": "2018-03-02 14:49:38",
            "currency": "USD",
            "exchangeRate": "6.361300",
            "merchantNo": "200043",
            "originalTransactionNo": "297553555705268810",
            "paymentTime": "2018-03-02 14:49:38",
            "refundAmount": 0,
            "storeAdminNo": null,
            "storeNo": "300014",
            "transactionNo": "297553555705374195",
            "transactionStatus": "success",
            "transactionType": "refund",
            "vendor": "wechatpay"
        },
        {
            "amount": 0.01,
            "createTime": "2018-03-02 14:47:52",
            "currency": "USD",
            "exchangeRate": "6.361300",
            "merchantNo": "200043",
            "originalTransactionNo": null,
            "paymentTime": "2018-03-02 14:48:07",
            "refundAmount": 0.01,
            "storeAdminNo": null,
            "storeNo": "300014",
            "transactionNo": "297553555705268810",
            "transactionStatus": "success",
            "transactionType": "payment",
            "vendor": "wechatpay"
        }
    ],
    "ret_msg": "query success ",
    "ret_code": "000100"
}

使用 trans-list() API 可以获得一段时间内的全部订单信息

HTTP 请求

POST https://mapi.yuansfer.com/app-data-search/v2/trans-list

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
startDate

required

string 开始时间
格式 : "YYYYMMDD".
endDate

required

string 结束时间,
endDate 不能超过 开始时间15天.
格式 : "YYYYMMDD".
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
transactions array 订单信息 对象数组.
size integer transactions总个数.
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

结算列表

Endpoint

POST https://mapi.yuansfer.com/app-data-search/v2/settle-list
POST https://mapi.yuansfer.com/app-data-search/v2/settle-list
POST https://mapi.yuansfer.com/app-data-search/v2/settle-list
POST https://mapi.yuansfer.com/app-data-search/v2/settle-list

Example Request

curl "https://mapi.yuansfer.com/app-data-search/v2/settle-list" \
-d "storeNo=300014" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "startDate=startDate" \
-d "endDate=endDate" \
-d "verifySign=verifySign"
<?php
function settleList()
{
    $url = 'https://mapi.yuansfer.yunkeguan.com/app-data-search/v2/settle-list';
    $token = '59600f2a9ad644c6a9570233560cc94e';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'startDate' => '20171201',
        'endDate' => '20171210'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

settleList();
?>
//settlement list
public static void settleList(String startDate, String endDate) {
    String url = DOMAIN_URL + SETTLE_LIST;
    Map<String, Object> params = new TreeMap<String, Object>();
    params.put("merGroupNo", MER_GROUP_NO);
    params.put("merchantNo", MERCHANT_NO);
    params.put("storeNo", STORE_NO);
    if (StringUtils.isNotEmpty(STORE_ADMIN_NO)) {
        params.put("storeAdminNo", STORE_ADMIN_NO);
    }

    params.put("startDate", startDate);
    params.put("endDate", endDate);
    String verifySign = verifySignHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
    params.put("verifySign", verifySign);
    String ret = HttpClientUtils.post(url, null, params);
    System.out.println("---settle list----");
    System.out.println(ret);
}

Example Response

{
    "settlements": [{
        "amount": 0.01,
        "currency": "USD",
        "exchangeRate": "6.354920",
        "fee": 0.00,
        "merchantNo": "200277",
        "netSettleAmount": 0.01,
        "paymentTime": "2018-03-07 23:43:06",
        "settleAmount": 0.01,
        "settleCurrency": "USD",
        "storeAdminNo": "3004890001",
        "storeNo": "300489",
        "transactionNo": "298068127611181075",
        "transactionType": "payment",
        "vendor","alipay"
    }, {
        "amount": 0.01,
        "currency": "USD",
        "exchangeRate": "6.345900",
        "fee": 0.00,
        "merchantNo": "200277",
        "netSettleAmount": 0.01,
        "paymentTime": "2018-03-07 15:32:55",
        "settleAmount": 0.01,
        "settleCurrency": "USD",
        "storeAdminNo": "3004890001",
        "storeNo": "300489",
        "transactionNo": "298068127581770149",
        "transactionType": "payment",
        "vendor","wechatpay"
    }],
    "size": 2,
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "settlements": [{
        "amount": 0.01,
        "currency": "USD",
        "exchangeRate": "6.354920",
        "fee": 0.00,
        "merchantNo": "200277",
        "netSettleAmount": 0.01,
        "paymentTime": "2018-03-07 23:43:06",
        "settleAmount": 0.01,
        "settleCurrency": "USD",
        "storeAdminNo": "3004890001",
        "storeNo": "300489",
        "transactionNo": "298068127611181075",
        "transactionType": "payment",
        "vendor","alipay"
    }, {
        "amount": 0.01,
        "currency": "USD",
        "exchangeRate": "6.345900",
        "fee": 0.00,
        "merchantNo": "200277",
        "netSettleAmount": 0.01,
        "paymentTime": "2018-03-07 15:32:55",
        "settleAmount": 0.01,
        "settleCurrency": "USD",
        "storeAdminNo": "3004890001",
        "storeNo": "300489",
        "transactionNo": "298068127581770149",
        "transactionType": "payment",
        "vendor","wechatpay"
    }],
    "size": 2,
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "settlements": [{
        "amount": 0.01,
        "currency": "USD",
        "exchangeRate": "6.354920",
        "fee": 0.00,
        "merchantNo": "200277",
        "netSettleAmount": 0.01,
        "paymentTime": "2018-03-07 23:43:06",
        "settleAmount": 0.01,
        "settleCurrency": "USD",
        "storeAdminNo": "3004890001",
        "storeNo": "300489",
        "transactionNo": "298068127611181075",
        "transactionType": "payment",
        "vendor","alipay"
    }, {
        "amount": 0.01,
        "currency": "USD",
        "exchangeRate": "6.345900",
        "fee": 0.00,
        "merchantNo": "200277",
        "netSettleAmount": 0.01,
        "paymentTime": "2018-03-07 15:32:55",
        "settleAmount": 0.01,
        "settleCurrency": "USD",
        "storeAdminNo": "3004890001",
        "storeNo": "300489",
        "transactionNo": "298068127581770149",
        "transactionType": "payment",
        "vendor","wechatpay"
    }],
    "size": 2,
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "settlements": [{
        "amount": 0.01,
        "currency": "USD",
        "exchangeRate": "6.354920",
        "fee": 0.00,
        "merchantNo": "200277",
        "netSettleAmount": 0.01,
        "paymentTime": "2018-03-07 23:43:06",
        "settleAmount": 0.01,
        "settleCurrency": "USD",
        "storeAdminNo": "3004890001",
        "storeNo": "300489",
        "transactionNo": "298068127611181075",
        "transactionType": "payment",
        "vendor","alipay"
    }, {
        "amount": 0.01,
        "currency": "USD",
        "exchangeRate": "6.345900",
        "fee": 0.00,
        "merchantNo": "200277",
        "netSettleAmount": 0.01,
        "paymentTime": "2018-03-07 15:32:55",
        "settleAmount": 0.01,
        "settleCurrency": "USD",
        "storeAdminNo": "3004890001",
        "storeNo": "300489",
        "transactionNo": "298068127581770149",
        "transactionType": "payment",
        "vendor","wechatpay"
    }],
    "size": 2,
    "ret_msg": "query success ",
    "ret_code": "000100"
}

使用 settle-list() API 可以获得一段时间内的结算信息

HTTP 请求

POST https://mapi.yuansfer.com/app-data-search/v2/settle-list

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
startDate

required

string 开始时间
格式 : "YYYYMMDD".
endDate

required

string 结束时间,
endDate 不能超过 开始时间15天.
格式 : "YYYYMMDD".
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
settlements array 结算信息 对象数组.
size integer settlements总个数.
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

settlement object

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo string 商户号
storeNo string 店铺号
storeAdminNo string 店员号
transactionNo string Yuansfer系统订单ID
transactionType string 交易类型
包括 : "payment", "refund".
amount decimal 金额
currency string 币种
目前仅支持: "USD".
settleAmount decimal 结算金额
settleCurrency string 结算币种
目前仅支持: "USD".
fee decimal 手续费
netSettleAmount string 结算净额 (settleAmount - fee)
paymentTime string 支付时间
格式 : "yyyy-MM-dd HH:mm:ss".
exchangeRate decimal 汇率, CNYUSD .
vendor string 支付渠道

提现列表

Endpoint

POST https://mapi.yuansfer.com/app-data-search/v2/withdrawal-list
POST https://mapi.yuansfer.com/app-data-search/v2/withdrawal-list
POST https://mapi.yuansfer.com/app-data-search/v2/withdrawal-list
POST https://mapi.yuansfer.com/app-data-search/v2/withdrawal-list

Example Request

curl "https://mapi.yuansfer.com/app-data-search/v2/withdrawal-list" \
-d "storeNo=300014" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "startDate=startDate" \
-d "endDate=endDate" \
-d "verifySign=verifySign"
<?php
function withdrawalList()
{
    $url = 'https://mapi.yuansfer.yunkeguan.com/app-data-search/v2/withdrawal-list';
    $token = '59600f2a9ad644c6a9570233560cc94e';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'startDate' => '20171201',
        'endDate' => '20171210'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

withdrawalList();
?>
//withdrawal list
public static void withdrawalList(String startDate, String endDate) {
    String url = DOMAIN_URL + WITHDRAWAL_LIST;
    Map<String, Object> params = new TreeMap<String, Object>();
    params.put("merGroupNo", MER_GROUP_NO);
    params.put("merchantNo", MERCHANT_NO);
    params.put("storeNo", STORE_NO);
    if (StringUtils.isNotEmpty(STORE_ADMIN_NO)) {
        params.put("storeAdminNo", STORE_ADMIN_NO);
    }

    params.put("startDate", startDate);
    params.put("endDate", endDate);
    String verifySign = verifySignHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
    params.put("verifySign", verifySign);
    String ret = HttpClientUtils.post(url, null, params);
    System.out.println("---withdrawal list----");
    System.out.println(ret);
}

Example Response

{
    "size": 1,
    "ret_msg": "query success ",
    "ret_code": "000100",
    "withdrawals": [{
        "actualAppropriation": 53.72,
        "bankSettlementFee": 0.3,
        "currency": "USD",
        "date": "20180307",
        "details": [{
            "paymentTime": "20180305230715",
            "transactionAmount": 0.01,
            "transactionCurrency": "USD",
            "transactionFee": 0.00,
            "transactionNo": "298068127436229571",
            "transactionType": "payment",
            "transactionWithdrawalAmount": 0.01,
            "vendor": "alipay"
        }, {
            "paymentTime": "20180306204828",
            "transactionAmount": 20.00,
            "transactionCurrency": "USD",
            "transactionFee": 0.36,
            "transactionNo": "298068127514235706",
            "transactionType": "payment",
            "transactionWithdrawalAmount": 19.64,
            "vendor": "alipay"
        }],
        "merchantNo": "200277",
        "salesAmount": 55.01,
        "status": "completed",
        "withdrawalAmount": 54.02,
        "yuansferProcessingFee": 0.99
    } 
    ]
}
{
    "size": 1,
    "ret_msg": "query success ",
    "ret_code": "000100",
    "withdrawals": [{
        "actualAppropriation": 53.72,
        "bankSettlementFee": 0.3,
        "currency": "USD",
        "date": "20180307",
        "details": [{
            "paymentTime": "20180305230715",
            "transactionAmount": 0.01,
            "transactionCurrency": "USD",
            "transactionFee": 0.00,
            "transactionNo": "298068127436229571",
            "transactionType": "payment",
            "transactionWithdrawalAmount": 0.01,
            "vendor": "alipay"
        }, {
            "paymentTime": "20180306204828",
            "transactionAmount": 20.00,
            "transactionCurrency": "USD",
            "transactionFee": 0.36,
            "transactionNo": "298068127514235706",
            "transactionType": "payment",
            "transactionWithdrawalAmount": 19.64,
            "vendor": "alipay"
        }],
        "merchantNo": "200277",
        "salesAmount": 55.01,
        "status": "completed",
        "withdrawalAmount": 54.02,
        "yuansferProcessingFee": 0.99
    } 
    ]
}
{
    "size": 1,
    "ret_msg": "query success ",
    "ret_code": "000100",
    "withdrawals": [{
        "actualAppropriation": 53.72,
        "bankSettlementFee": 0.3,
        "currency": "USD",
        "date": "20180307",
        "details": [{
            "paymentTime": "20180305230715",
            "transactionAmount": 0.01,
            "transactionCurrency": "USD",
            "transactionFee": 0.00,
            "transactionNo": "298068127436229571",
            "transactionType": "payment",
            "transactionWithdrawalAmount": 0.01,
            "vendor": "alipay"
        }, {
            "paymentTime": "20180306204828",
            "transactionAmount": 20.00,
            "transactionCurrency": "USD",
            "transactionFee": 0.36,
            "transactionNo": "298068127514235706",
            "transactionType": "payment",
            "transactionWithdrawalAmount": 19.64,
            "vendor": "alipay"
        }],
        "merchantNo": "200277",
        "salesAmount": 55.01,
        "status": "completed",
        "withdrawalAmount": 54.02,
        "yuansferProcessingFee": 0.99
    } 
    ]
}
{
    "size": 1,
    "ret_msg": "query success ",
    "ret_code": "000100",
    "withdrawals": [{
        "actualAppropriation": 53.72,
        "bankSettlementFee": 0.3,
        "currency": "USD",
        "date": "20180307",
        "details": [{
            "paymentTime": "20180305230715",
            "transactionAmount": 0.01,
            "transactionCurrency": "USD",
            "transactionFee": 0.00,
            "transactionNo": "298068127436229571",
            "transactionType": "payment",
            "transactionWithdrawalAmount": 0.01,
            "vendor": "alipay"
        }, {
            "paymentTime": "20180306204828",
            "transactionAmount": 20.00,
            "transactionCurrency": "USD",
            "transactionFee": 0.36,
            "transactionNo": "298068127514235706",
            "transactionType": "payment",
            "transactionWithdrawalAmount": 19.64,
            "vendor": "alipay"
        }],
        "merchantNo": "200277",
        "salesAmount": 55.01,
        "status": "completed",
        "withdrawalAmount": 54.02,
        "yuansferProcessingFee": 0.99
    } 
    ]
}

使用 withdrawal-list() API 可以获得一段时间内的提现数据

HTTP 请求

POST https://mapi.yuansfer.com/app-data-search/v2/withdrawal-list

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
startDate

required

string 开始时间
格式 : "YYYYMMDD".
endDate

required

string 结束时间,
endDate 不能超过 开始时间15天.
格式 : "YYYYMMDD".
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
withdrawals array 提现信息 对象数组
size integer withdrawals总个数.
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

withdrawal object

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo string 商户号
salesAmount string 交易金额
yuansferProcessingFee string Yuansfer系统手续费
withdrawalAmount string 提现金额
bankSettlementFee string 银行转账手续费
actualAppropriation string 实际打款金额
status string 状态
currency string 币种
包括: "USD".
date string 提现日期
details array 提现记录详情 对象数组

detail object

参数 类型 描述
transactionNo Yuansfer系统订单ID
transactionType 交易类型
包括 : "payment", "refund", "void".
transactionAmount 金额
transactionFee 手续费
transactionWithdrawalAmount 提现金额
transactionCurrency 币种
包括: "USD".
paymentTime 支付时间
Format : "YYYYMMDDHHMMSS".
vendor 支付渠道
包括: "alipay", "wechatpay".

数据状态

Endpoint

curl "https://mapi.yuansfer.com/app-data-search/v2/data-status" \
-d "storeNo=300014" \
-d "merGroupNo=900001" \
-d "merchantNo=200043" \
-d "paymentDate=20180520" \
-d "verifySign=verifySign"
<?php
function dataStatus()
{
    $url = 'https://mapi.yuansfer.yunkeguan.com/app-data-search/v2/data-status';
    $token = '59600f2a9ad644c6a9570233560cc94e';

    $params = [
        'merGroupNo' => '900001',
        'merchantNo' => '200043',
        'storeNo' => '300014',
        'paymentDate' => '20180619'
    ];

    ksort($params, SORT_STRING);
    $str = '';
    foreach ($params as $k => $v) {
        $str .= $k . '=' . $v . '&';
    }
    $params['verifySign'] = md5($str . md5($token));

    echo 'verifySign:', $params['verifySign'];
    echo "\n";

    $ch = curl_init($url);
    curl_setopt_array($ch, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HEADER => false,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => http_build_query($params),
    ));

    $result = curl_exec($ch);
    curl_exec($ch);

    echo $result;
    echo "\n";
    return json_decode($result, true);
}

dataStatus();
?>
//data status
public static void dataStatus(String paymentDate) {
    String url = DOMAIN_URL + DATA_STATUS;
    Map<String, Object> params = new TreeMap<String, Object>();
    params.put("merGroupNo", MER_GROUP_NO);
    params.put("merchantNo", MERCHANT_NO);
    params.put("storeNo", STORE_NO);
    if (StringUtils.isNotEmpty(STORE_ADMIN_NO)) {
        params.put("storeAdminNo", STORE_ADMIN_NO);
    }

    params.put("paymentDate", paymentDate);
    String verifySign = verifySignHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
    params.put("verifySign", verifySign);
    String ret = HttpClientUtils.post(url, null, params);
    System.out.println("---data status----");
    System.out.println(ret);
}

Example Response

{
    "result": {
        "merchantNo": "200043",
        "message": "NO_TRANSACTION",
        "paymentDate": "20180520",
        "status": "00",
        "storeNo": "300014"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "result": {
        "merchantNo": "200043",
        "message": "NO_TRANSACTION",
        "paymentDate": "20180520",
        "status": "00",
        "storeNo": "300014"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "result": {
        "merchantNo": "200043",
        "message": "NO_TRANSACTION",
        "paymentDate": "20180520",
        "status": "00",
        "storeNo": "300014"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}
{
    "result": {
        "merchantNo": "200043",
        "message": "NO_TRANSACTION",
        "paymentDate": "20180520",
        "status": "00",
        "storeNo": "300014"
    },
    "ret_msg": "query success ",
    "ret_code": "000100"
}

使用data-status() API 查询某一天订单的结算状态

HTTP 请求

POST https://mapi.yuansfer.com/app-data-search/v2/data-status

Request 参数

参数 类型 描述
merGroupNo

required

string 服务商号
merchantNo

required

string 商户号
storeNo

required

string 店铺号
storeAdminNo

optional

string 店员号
paymentDate

required

string 支付日期
Format : "YYYYMMDD".
verifySign

required

string 数字签名

HTTP 响应

参数 类型 描述
result object 结算状态信息 对象.
ret_msg string 响应信息
ret_code string 响应码,更多内容参看 here.

result object

参数 类型 描述
merchantNo string 商户号
storeNo string 店铺号
paymentDate string 支付日期
status string 状态码
message string 状态描述

Mappings of status and message

status message
"00" "NO_TRANSACTION"
"10" "NO_SETTLED"
"11" "PARTLY_SETTLED"
"12" "FULLY_SETTLED"

公共对象定义

transaction object

参数 类型 描述
transactionNo string Yuansfer系统订单ID
originalTransactionNo string 关联原订单ID,refund和void订单才会有
merchantNo string 商户号
storeNo string 店铺号
storeAdminNo string 店员号
amount decimal 金额
refundAmount decimal 退款金额
voidAmount decimal 回滚金额
transactionType string 交易类型
包括 : "payment", "refund", "void".
transactionStatus string 订单状态
currency string 币种
目前仅支持: "USD".
createTime string 创建时间
格式 : "yyyy-MM-dd HH:mm:ss".
paymentTime string 支付时间
格式 : "yyyy-MM-dd HH:mm:ss".
exchangeRate decimal 汇率 CNYUSD.
vendor string 支付渠道
包括: "alipay", "wechatpay", "unionpay".

注意事项

响应码

Yuansfer系统返回如下响应码,即 ret_code 参数:

响应码 含义
000000 System Error
000010 API Version Error
000020 Parameter Null Error
000021 Parameter No Related Infomation
000022 Parameters Not Match
000023 Parameter Value Error
000030 No Rights
000040 Transaction Status Error
000080 Supplier System's Error
000100 Success

订单状态

状态码 含义
init 新建订单,还没有发送给上游支付渠道
dealing 处理中
success 支付成功
failed 支付失败
pending 等待支付结果
closed 订单关闭

异步回调通知

商家在其网站上创建一个异步通知监听URL,然后在请求主体中指定异步通知监听URL。然后,Yuansfer将所有订单的通知发送到该URL。当客户购买商品或服务时,Yuansfer会向URL发送一个包含支付信息(IPN消息)的POST请求。商家后端进程检测和处理IPN消息。商户验证IPN消息成功后,处理自己的订单信息,返回success给Yuansfer系统。互联网连接并不总是100%可靠,IPN消息可能丢失或延迟。Yuansfer系统未收到success信息返回,将在2小时内重发最多8次IPN消息。

回调通知参数

商户系统收到Yuansfer发出的通知信息,建议使用数字签名的方式进行校验,避免数据被篡改

Yuansfer系统回调参数

参数 类型 描述
yuansferId object Yuansfer系统订单ID
status enum 订单状态
amount string 美金金额
time string 支付时间
格式 : "YYMMDDHHMMSS".
reference string 商户系统支付流水号
note string 订单备注信息
verifySign string 数字签名

时区

Yuansfer系统统一采用UTC +8时间.

Yuansfer系统Online API示例:

Yuansfer系统In-Store API示例:

沙想环境

沙箱环境测试账号信息

Online Payments API

Parameter Value
merGroupNo 900001
merchantNo 200043
storeNo 300014
yuansferToken 6666efdd855bc1f40c3d121b9718b901
Parameter Value
Card Number 6226388000000095
CVV 248
EXP 12/2019
Phone 18100000000
Verification Code 111111
Parameter Value
Account douyufua@alitest.com
Captcha Code 8888
Login Password 111111
Payment Password on Cashier Page 111111

支付宝沙箱Apk下载链接

Download APK from here