Yuansfer API 文档
搜索文档…
退款
post
https://mapi.yuansfer.com/app-data-search/v3
/refund
refund
响应
参数
类型
说明
result
object
结果对象
ret_msg
string
响应返回消息。
ret_code
string
响应返回码。 了解有关的更多详细信息,请参见此处
结果对象
参数
类型
说明
amount
number
交易金额
refundAmount
number
交易退款金额。 仅当付款订单包含“Amount”时才返回此参数。
currency
string
标识货币的三位字符货币代码。
可能的值为:“ USD” “ CNY”。
settleCurrency
string
标识结算货币的三位字符货币代码。
可能的值为:“ USD”。
status
string
退款状态。
reference
string
商家系统中交易的发票编号。
refundReference
string
商家系统中退款交易的ID。
refundTransactionNo
string
Yuansfer系统中退款交易的ID。
transactionNo
string
基于Yuansfer系统中交易的退款交易ID。
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)
}
复制链接