Yuansfer付款
post
https://mapi.yuansfer.com/online/v3
/secure-pay
secure-pay
参数 | 类型 | 说明 |
result | object | 结果对象。 |
ret_msg | string | 响应返回消息。 |
ret_code | string |
结果对象
Parameter | Type | Description |
amount | string | 交易金额。 当您使用USD作为付款货币时,它将返回。 |
currency | string | 交易货币: USD, CNY, PHP, IDR, KRW, HKD |
transactionNo | string | Yuansfer系统中的交易ID。 |
reference | string | 商家系统中交易的发票编号。 |
cashierUrl | string | 收银员页面的URL。 |
settleCurrency | string | 标识结算货币的三位字符货币代码。 可能的值为:“ USD”。 |
cURL
PHP
JAVA
Go
curl -XPOST -H "Content-type: application/json" -d '{
"merchantNo": "200043",
"storeNo": "300014",
"verifySign": "72a2c6ce8497adc8a03a78135618e666",
"amount": "13",
"currency": "PHP",
"settleCurrency": "USD",
"vendor": "alipay",
"terminal": "ONLINE",
"timeout": "30",
"reference": "test202001011303",
"ipnUrl": "http://zk-tys.yunkeguan.com/ttest/test",
"callbackUrl": "http://zk-tys.yunkeguan.com/ttest/test2?status={status}",
"description": "test+description",
"note": "test note",
"osType": "IOS",
"goodsInfo": [
{
"goods_name": "name1",
"quantity": "quantity1"
}
]
}' 'https://mapi.yuansfer.com/online/v3/secure-pay'
<?php
function securepay()
{
$url = 'https://mapi.yuansfer.com/online/v3/secure-pay';
$token = '5cbfb079f15b150122261c8537086d77a';
$params = [
'merchantNo' => '200043',
'storeNo' => '300014',
'amount' => '0.01',
'currency' => 'USD',
'settleCurrency' => 'USD',
'vendor' => 'alipay',
'ipnUrl' => 'https://nengjtian.s1.natapp.cc/login/test',
'callbackUrl' => 'https://nengjtian.s1.natapp.cc/login/test2?transactionNo={transactionNo}&status={status}&amount={amount}&time={time}&reference={reference}¬e={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();
?>
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 + "/online/v3/secure-pay";
String ret = HttpClientUtils.post(url, null, params);
System.out.println(ret);
}
public static YuansferSecurepayDto paramSetting() {
YuansferSecurepayDto dto = new YuansferSecurepayDto();
/**
* merchantNo,storeNo is necessory, and they are provided by Yuansfer
*/
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.setSettleCurrency("USD"); //SettleCurrency, "USD"
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{
MerchantNo: "200043", //customer The merchant NO.
StoreNo: "300014",
Currency: "USD",
SettleCurrency: "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)
}