Yuansfer DOCS
Search
⌃K

Refund

post
https://mapi.yuansfer.com/app-data-search/v3
/refund
Refund
Response
Parameter
Type
Description
result
object
The result of the refund.
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
number
The transaction amount.
refundAmount
number
The transaction refund amount. This parameter will be returned only when the payment order contains a 'Amount'.
currency
string
The supported transaction currencies are "USD" "CNY".
settleCurrency
string
The supported settlement currencies are "USD".
status
string
The status of the refund.
reference
string
The Invoice Number of the transaction in the merchant’s system.
refundReference
string
The ID of the refund transaction in the merchant’s system.
refundTransactionNo
string
The ID of the refund transaction in the Yuansfer system.
transactionNo
string
The Transaction ID in the Yuansfer system.
cURL
PHP
Java
Go
curl -XPOST -H "Content-type: application/json" -d '{
"merchantNo": "200043",
"storeNo": "300014",
"verifySign": "dd81f7781603bec48ae2c6a9ac758bf2",
"refundAmount": "0.01",
"currency": "USD",
"settleCurrency": "USD",
"transactionNo": "297553638301777927",
"refundReference": "refund2020101305"
}' 'https://mapi.yuansfer.com/app-data-search/v3/refund'
<?php
function securepayRefund()
{
$url = 'https://mapi.yuansfer.com/app-data-search/v3/refund';
$token = '5cbfb079f15b150122261c8537086d77a';
$params = [
'merchantNo' => '200043',
'storeNo' => '300014',
'amount' => '0.01',
'reference' => 'test2018070101'];
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);
}
securepayRefund();
?>
public class SecurepayRefundTest {
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) {
YuansferSecurepayRefundDto refundDto = new YuansferSecurepayRefundDto();
YuansferVerifySignHelper verifyHelper = new YuansferVerifySignHelper();
refundDto.setAmount("0.01");
refundDto.setCurrency("USD");
refundDto.setSettleCurrency("USD");
refundDto.setMerchantNo("200043");
refundDto.setStoreNo("300014");
refundDto.setReference("9091023122");
Map<String, Object> params = ReflectionUtils.convertBean2MapIgnoreNullVal(refundDto, new String[]{"serialVersionUID"});
String verifySign = verifyHelper.getYuansferVerifySign(params, YUANSFER_TOKEN);
refundDto.setVerifySign(verifySign);
params.put("verifySign", verifySign);
String url = TEST_URL + "/app-data-search/v3/refund";
String ret = HttpClientUtils.post(url, null, params);
JSON json = JSON.parseObject(ret);
System.out.println(json);
}
}
func refund(t *table) {
req := yuan.Refund{
MerchantNo: "200043", //customer The merchant NO.
StoreNo: "300014",
Currency: "USD",
SettleCurrency: "USD",
Reference: "original sequence No.", //sequence number of customer system
Amount: "0.01",
}
resp, err := req.PostToYuansfer(yuansferToken)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(resp)
}