Yuansfer DOCS
Search
⌃K

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
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}&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();
?>
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.setCurrency("USD"); //currency, "USD"
dto.setSettleCurrency("USD"); //SettleCurrency, "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)
}