Yuansfer DOCS
Search
K
Comment on page

Create QR Code

Referred to as create-trans-qrcode
This API is used in Merchant-Presented use cases. To learn more please see the guide.
post
https://mapi.yuansfer.com/app-instore/v3
/create-trans-qrcode
CreateTransQrcode
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
reference
string
The Transaction ID in the Yuansfer system.
amount
number
The transaction amount in USD.
deepLink
string
The deep link URL. (the non-homepage URL).
transactionNo
string
The Invoice Number of the transaction in the Merchant's system.
settleCurrency
string
The supported settlement currency are "USD".
currency
string
The supported transaction currency are "USD".
timeout
integer
The timeout in minutes, default value is 120.
qrcodeUrl
string
The URL of the transaction QR code.
cURL
PHP
Java
Go
curl -XPOST -H "Content-type: application/json" -d '{
"merchantNo": "200043",
"storeNo": "300014",
"verifySign": "45bfac0286debaf0c316c011d6842d2c",
"amount": "0.11",
"currency": "USD",
"settleCurrency": "USD",
"needQrcode" "true",
"reference": "test2020102023",
"ipnUrl": "http://zk-tys.yunkeguan.com/login/test",
"needQrcode": "true",
"vendor": "alipay",
"timeout": "120"
}' 'https://mapi.yuansfer.com/app-instore/v3/create-trans-qrcode'
<?php
function transQrcode()
{
$url = 'https://mapi.yuansfer.yunkeguan.com/app-data-search/v3/create-trans-qrcode';
$token = '59600f2a9ad644c6a9570233560cc94e';
$params = [
'merchantNo' => '200043',
'storeNo' => '300014',
'vendor' => 'alipay',
'amount' => '0.01',
'needQrcode' => 'true',
'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("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("needQrcode", "true");
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);
}