Yuansfer DOCS
  • Introduction
  • GUIDE
    • Online Payment
    • Point of Sale
      • Scan QR Code
      • Create QR Code
    • Plugins
    • Payment Methods
    • Financial Report
    • Security
    • Incident Priorities
    • SDK
    • Tutorials & Examples
      • PHP SDK
      • JAVA SDK
      • C# SDK
      • JS SDK
  • API REFERENCE V3
    • Sandbox Environment
      • Apply Sandbox Credentials
    • Signing API Parameters
    • Customers
      • Register Customer
      • Retrieve Customer
      • Update Customer
    • Payments
      • Online Payment
        • Yuansfer Checkout
        • Yuansfer Integrated Payment
          • Braintree Payments
          • Prepay
        • Recurring Payments
          • Authorize
          • Apply Token
          • Pay
          • Revoke
      • Point of Sale Payment
        • Scan QR Code
          • Add
          • Prepay
        • Create QR Code
    • Transaction Revert
      • Refund
      • Cancel
    • Transaction Data Search
      • Transaction Query
    • Payouts
      • Create Payee
      • Retrieve Payee
      • Balance
      • Send Money
      • Search Payments
    • Notes
  • 中文
Powered by GitBook
On this page

Was this helpful?

  1. API REFERENCE V3
  2. Transaction Revert

Cancel

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

Name
Type
Description

merchantNo*

string

Merchant ID

storeNo*

string

Store ID

transactionNo

string

The Transaction ID in the Yuansfer system. Either transactionNo or reference is required.

reference

string

The Invoice Number of the transaction in the merchant's system. Either transactionNo or reference is required.

verifySign*

string

The parameter signature.

{
    "result": {
        "amount": 0.01,
        "currency": "USD",
        "reference": "test20200101307",
        "status": "closed",
        "transactionNo": "297553638302751118"
    },
    "ret_msg": "cancel success ",
    "ret_code": "000100"
}

Response

Parameter

Type

Description

result

object

The result of the refund.

ret_msg

string

The response return message.

ret_code

string

Result Object

Parameter

Type

Description

amount

number

The transaction amount.

currency

string

The supported transaction currency "USD" "CNY".

reference

string

The Invoice Number of the transaction in the merchant's system.

status

string

The status of the refund.

transactionNo

string

The Transaction ID in the Yuansfer system.

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'
<?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();
?>
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);
}
PreviousRefundNextTransaction Data Search

Last updated 2 years ago

Was this helpful?

The response return code. For more details, see .

here