Cancel
POST
https://mapi.yuansfer.com/app-data-search/v3/cancel
This API cancels the payment of a transaction.
Note:
If the payment result of the pay API is a failure, the Yuansfer system cancels the transaction.
If the payment result of the pay API is successful, the Yuansfer system refunds the amount of the transaction.
Request Body
The Transaction ID in the Yuansfer system. Either transactionNo or reference is required.
The Invoice Number of the transaction in the merchant's system. Either transactionNo or reference is required.
200
Copy {
"result": {
"amount": 0.01,
"currency": "USD",
"reference": "test20200101307",
"status": "closed",
"transactionNo": "297553638302751118"
},
"ret_msg": "cancel success ",
"ret_code": "000100"
}
Response
The result of the refund.
The response return message.
Result Object
The supported transaction currency "USD" "CNY" .
The Invoice Number of the transaction in the merchant's system.
The status of the refund.
The Transaction ID in the Yuansfer system.
cURL PHP Java Go
Copy curl -XPOST -H "Content-type: application/json" -d '{
"merchantNo": "200043",
"storeNo": "300014",
"verifySign": "dd81f7781603bec48ae2c6a9ac758bf2",
"transactionNo": "297553638301777927",
}' 'https://mapi.yuansfer.com/app-data-search/v3/cancel'
Copy <? php
function transCancel ()
{
$url = 'https://mapi.yuansfer.yunkeguan.com/app-data-search/v3/cancel' ;
$token = '59600f2a9ad644c6a9570233560cc94e' ;
$params = [
'merchantNo' => '200043' ,
'storeNo' => '300014' ,
'transactionNo' => '297553565108438359'
];
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 ) ;
}
transCancel () ;
?>
Copy public static void transactionCancel( String transactionNo) {
String url = DOMAIN_URL + TRANSACTION_CANCEL;
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 ( "transactionNo" , transactionNo);
String verifySign = verifySignHelper . getYuansferVerifySign (params , YUANSFER_TOKEN);
params . put ( "verifySign" , verifySign);
String ret = HttpClientUtils . post (url , null , params);
System . out . println ( "---transaction reverse----" );
System . out . println (ret);
}