Add
post
https://mapi.yuansfer.com/app-instore/v3
/add
Add
Response
Parameter | Type | Description |
result | object | The result object. |
ret_msg | string | The response return message. |
ret_code | string |
Parameter | Type | Description |
amount | number | The transaction amount. |
createTime | string | The date and time when the transaction was created. Format : "yyyy-MM-dd HH:mm:ss". |
currency | string | The supported transaction currency is "USD". |
merchantNo | string | Merchant ID |
originalTransactionNo | string | The ID of the original transaction in the Yuansfer system. |
paymentTime | string | The date and time when the payment was processed. Format : "yyyy-MM-dd HH:mm:ss". |
reference | string | The Invoice Number of the transaction in the merchant’s system. |
refundAmount | number | The refund amount. |
settleCurrency | string | The supported settlement currency "USD". |
storeAdminNo | string | Store Admin ID |
storeNo | string | Store ID |
transactionNo | string | The Transaction ID in the Yuansfer system. |
transactionStatus | string | The status of the transaction. |
transactionType | string | The possible transaction type values are "payment", "refund", "void". |
voidAmount | number | The void or cancel amount. |
cURL
PHP
Java
Go
curl -XPOST -d '{
"merchantNo": "200043",
"storeNo": "300014",
"verifySign": "c29c8240bf99510d4d53a0ca36f9c135",
"amount": "13",
"currency": "USD",
"settleCurrency": "USD",
"reference": "test202001011206"
}' 'https://mapi.yuansfer.com/app-instore/v3/add'
<?php
function transAdd()
{
$url = 'https://mapi.yuansfer.yunkeguan.com/app-data-search/v3/add';
$token = '59600f2a9ad644c6a9570233560cc94e';
$params = [
'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();
?>
public static String transactionAdd() {
String url = DOMAIN_URL + TRANSACTION_ADD;
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("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;
}
Last modified 6mo ago