Yuansfer DOCS
Search…
Yuansfer Checkout
Referred to as secure-pay
post
https://mapi.yuansfer.com/online/v3
/secure-pay
SecurePay
Response
Parameter
Type
Description
result
object
The result object.
ret_msg
string
The response return message.
ret_code
string
The response return code. For more details, see here.
Result Object
Parameter
Type
Description
amount
string
The transaction amount. It returns when you use "USD" as the payment currency.
currency
string
The supported transaction currency is "USD", "CNY", "PHP", "IDR", "KRW", "HKD", "THB", "MYR", "GBP", "BDT", "PKR".
transactionNo
string
The Transaction ID in the Yuansfer system.
reference
string
The Invoice Number of the transaction in the merchant’s system.
cashierUrl
string
The URL to the cashier page.
settleCurrency
string
When the currency is "GBP", the settlement currency is "GBP". All other currencies settle with "USD".
cURL
PHP
Java
Go
1
curl -XPOST -H "Content-type: application/json" -d '{
2
"merchantNo": "200043",
3
"storeNo": "300014",
4
"verifySign": "72a2c6ce8497adc8a03a78135618e666",
5
"amount": "13",
6
"currency": "PHP",
7
"settleCurrency": "USD",
8
"vendor": "alipay",
9
"terminal": "ONLINE",
10
"timeout": "30",
11
"reference": "test202001011303",
12
"ipnUrl": "http://zk-tys.yunkeguan.com/ttest/test",
13
"callbackUrl": "http://zk-tys.yunkeguan.com/ttest/test2?status={status}",
14
"description": "test+description",
15
"note": "test note",
16
"osType": "IOS",
17
"goodsInfo": [
18
{
19
"goods_name": "name1",
20
"quantity": "quantity1"
21
}
22
]
23
}' 'https://mapi.yuansfer.com/online/v3/secure-pay'
Copied!
1
<?php
2
function securepay()
3
{
4
$url = 'https://mapi.yuansfer.com/online/v3/secure-pay';
5
$token = '5cbfb079f15b150122261c8537086d77a';
6
$params = [
7
'merchantNo' => '200043',
8
'storeNo' => '300014',
9
'amount' => '0.01',
10
'currency' => 'USD',
11
'settleCurrency' => 'USD',
12
'vendor' => 'alipay',
13
'ipnUrl' => 'https://nengjtian.s1.natapp.cc/login/test',
14
'callbackUrl' => 'https://nengjtian.s1.natapp.cc/login/test2?transactionNo={transactionNo}&status={status}&amount={amount}&time={time}&reference={reference}&note={note}',
15
'terminal' => 'ONLINE',
16
'reference' => 'test2018070101',
17
'description' => 'test_description',
18
'note' => 'test_note',
19
'timeout' => '120'
20
];
21
ksort($params, SORT_STRING);
22
$str = '';
23
foreach ($params as $k => $v) {
24
$str .= $k . '=' . $v . '&';
25
}
26
$params['verifySign'] = md5($str . md5($token));
27
echo 'verifySign:', $params['verifySign'];
28
echo "\n";
29
$ch = curl_init($url);
30
curl_setopt_array($ch, array(
31
CURLOPT_RETURNTRANSFER => true,
32
CURLOPT_HEADER => false,
33
CURLOPT_POST => true,
34
CURLOPT_POSTFIELDS => http_build_query($params),
35
));
36
$result = curl_exec($ch);
37
curl_exec($ch);
38
echo $result;
39
echo "\n";
40
return json_decode($result, true);
41
}
42
securepay();
43
?>
Copied!
1
public class SecurepayTest {
2
public static final String TEST_URL = "https://mapi.yuansfer.yunkeguan.com"; //Testing domain
3
public static final String PROD_URL = "https://mapi.yuansfer.com"; //Production domain
4
public static final String YUANSFER_TOKEN = "5c5fe30183be69fceff8174358d4b8ae";
5
6
public static void main(String[] args) {
7
YuansferVerifySignHelper helper = new YuansferVerifySignHelper();
8
9
YuansferSecurepayDto dto = paramSetting();
10
Map<String, Object> params = ReflectionUtils.convertBean2MapIgnoreNullVal(dto, new String[]{"serialVersionUID"});
11
String verifySign = helper.getYuansferVerifySign(params, YUANSFER_TOKEN);
12
params.put("verifySign", verifySign);
13
14
String url = TEST_URL + "/online/v3/secure-pay";
15
String ret = HttpClientUtils.post(url, null, params);
16
System.out.println(ret);
17
}
18
19
public static YuansferSecurepayDto paramSetting() {
20
YuansferSecurepayDto dto = new YuansferSecurepayDto();
21
/**
22
* merchantNo,storeNo is necessory, and they are provided by Yuansfer
23
*/
24
dto.setMerchantNo("200043"); //The Merchant NO.
25
dto.setStoreNo("300014"); //The Store NO.
26
27
/**
28
* transaction infomation is necessory
29
*/
30
dto.setAmount("0.01"); //The amount, unit "division"
31
dto.setCurrency("USD"); //currency, "USD"
32
dto.setSettleCurrency("USD"); //SettleCurrency, "USD"
33
dto.setIpnUrl("https://nengjtian.s1.natapp.cc/login/test"); //Asynchronous callback address
34
dto.setCallbackUrl("https://nengjtian.s1.natapp.cc/login/test2"); //Synchronous callback address
35
dto.setReference("9091023122"); //order NO. of client's system
36
dto.setTerminal("ONLINE"); //"ONLINE" or "WAP"
37
dto.setTimeout("120"); //unit "minute"
38
dto.setVendor("alipay"); //“alipay","wechatpay" or "unionpay"
39
40
/**
41
* note,desription are optional
42
*/
43
dto.setDescription("test-description"); //description
44
dto.setNote("test-note"); //note
45
46
return dto;
47
}
48
}
Copied!
1
import (
2
"fmt"
3
"time"
4
yuan "github.com/yuansfer/golang_sdk"
5
)
6
7
func securepay() {
8
req := &yuan.Securepay{
9
MerchantNo: "200043", //customer The merchant NO.
10
StoreNo: "300014",
11
Currency: "USD",
12
SettleCurrency: "USD",
13
Amount: "0.01",
14
Vendor: "wechatpay",
15
Reference: fmt.Sprintf("demo_%d", time.Now().Unix()), //sequence number of customer system
16
IpnUrl: "https://customer-ipn", //internet accessible
17
CallbackUrl: "https://customer-callback", //internet accessible
18
Description: "description",
19
Note: "note",
20
Terminal: "ONLINE",
21
Timeout: "120",
22
}
23
24
goods := "Yuansfer"
25
quantity := "1"
26
if quantity != "" && goods != "" {
27
goodsInfos := []yuan.GoodsInfomation{
28
yuan.GoodsInfomation{
29
GoodsName: goods,
30
Quantity: quantity,
31
},
32
}
33
_ = req.Format(goodsInfos)
34
}
35
36
resp, err := req.PostToYuansfer(yuansferToken)
37
if err != nil {
38
fmt.Println(err)
39
return
40
}
41
fmt.Println(resp)
42
}
Copied!
Last modified 21d ago
Copy link