NICEPAY API
...
API Credit Card
Cancel - API Credit Card
9 min
about cancel api credit card this uses by to cancel paid if you cancel before settlement is complete, then is considered void and funds will be returned to your however, cancellations after settlement is complete are included in refund category visit docid 3qalqxg5pvrrg7euemdy to find out more about terms void or refund cancel api credit card the cancel uses to cancel of s via 138,440,117 unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type request parameters for cancel api credit card the following is a list of request s in cancel to cancel s for s this s uses through platform 165,80,66,171,297 true unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type response parameter for cancel api credit card the following is a list of response parameter or result from request parameter for cancel handling 185,57,80,252,168 true unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type sample parameter for cancel api credit card request parameter curl curl location 'https //dev nicepay co id/nicepay/direct/v2/cancel' \\ \ header 'content type application/json' \\ \ data '{ "timestamp" "20251008131011", "paymethod" "01", "txid" "ionpaytest01202509241944339756", "imid" "ionpaytest", "merchanttoken" "45505e04460a30418c425506e6b53295cc548b7ec11dd6685b0bf669e26c8db6", "referenceno" "ordno20250924194433", "amt" "10000", "canceltype" "2", "cancelmsg" "cancellation of transaction", "cancelserverip" "127 0 0 1", "canceluserid" "", "canceluserip" "127 0 0 1", "canceluserinfo" "", "cancelretrycnt" "", "worker" "" }' node js const config = { isproduction false, privatekey cons privatekey, clientsecret cons clientsecret, clientid cons clientid, iscloudserver false, merchantkey cons merchantkey, }; let parametercancel = { timestamp "20251008131011", paymethod "01", txid "ionpaytest01202509241944339756", imid "ionpaytest", merchanttoken "45505e04460a30418c425506e6b53295cc548b7ec11dd6685b0bf669e26c8db6", referenceno "ordno20250924194433", amt "10000", canceltype "2", cancelmsg "cancellation of transaction", cancelserverip "127 0 0 1", canceluserid "", canceluserip "127 0 0 1", canceluserinfo "", cancelretrycnt "", worker "", }; let secondversion = new secondapiversion(config); response = secondversion requestapi(parametercancel, "/direct/v2/cancel"); nicepayconfig configcc = nicepay builder() isproduction(false) iscloudserver(false) partnerid("ionpaytest") build(); string txid = "ionpaytest01202509241944339756"; // from json string amount = "10000"; string reffno = "ordno20250924194433"; cancel requestcancel = cancel builder() timestamp("20251008131011") txid(txid) referenceno(reffno) merchanttoken( "20251008131011", "ionpaytest", txid, amount, "your merchant key" ) imid("ionpaytest") paymethod("01") canceltype("2") amt(amount) cancelmsg("cancellation of transaction") canceluserip("127 0 0 1") cancelserverip("127 0 0 1") canceluserinfo("") cancelretrycnt("") worker("") build(); nicepayresponsev2 result = v2cancelservice callv2canceltransaction(requestcancel, configcc); bodycancel = ( buildercancel buildcancel() setpaymethod("01") settxid("ionpaytest01202509241944339756") setreferenceno("ordno20250924194433") setcanceluserid("") setcanceltype("2") setcancelmsg("cancellation of transaction") setamt("10000") setcancelserverip("127 0 0 1") setcanceluserip("127 0 0 1") setcanceluserinfo("") setcancelretrycnt("") setworker("") build() ) environment = ( builderenvironment buildenvironment() iscloud(true) isproduction(false) build() ) response = servicenicepay servicecancel(datagenerator getcancelbody(bodycancel jsoncancel()), environment) c# string merchantkey = config merkey; string clientid = config clientid; string timestamp = "20251008131011"; string amount = "10000"; string txid = "ionpaytest01202509241944339756"; string referenceno = "ordno20250924194433"; bool isproduction = false; bool iscloudserver = false; // ✅ build merchant token (keep original logic) var builder = new merchanttokenbuilder() settimestamp(timestamp) setimid(clientid) settxid(txid) setamount(amount) setmerchantkey(merchantkey); string merchanttoken = builder buildcancelmerchanttoken(); // ✅ build cancel request body var bodybuilder = new nicepayrequestbuilder() setcancel( imid "ionpaytest", timestamp timestamp, txid txid, amt amount, merchanttoken merchanttoken, paymethod "01", canceltype "2", cancelmsg "cancellation of transaction", canceluserid "", cancelserverip "127 0 0 1", cancelretrycnt "" ); // ✅ prepare api endpoint and send request apiendpoints apiendpoints = new apiendpoints(); dictionary\<string, object> payload = bodybuilder build(); string jsonpayload = newtonsoft json jsonconvert serializeobject(payload, newtonsoft json formatting indented); var registrationservice = new nicepayregistrationservice(apiendpoints, isproduction, iscloudserver); var result = await registrationservice sendpostasync(apiendpoints cancelv2, payload); laravel protected $useprod = false; protected $usecloud = false; protected $cancel endpoint = "/nicepay/direct/v2/cancel"; $url = httputil getnicepaydomain($this >useprod, $this >usecloud) $this >cancel endpoint; // request body parameter $timestamp = "20251008131011"; $txid = "ionpaytest01202509241944339756"; $reference no = "ordno20250924194433"; $amt = "10000"; $merchant token = "45505e04460a30418c425506e6b53295cc548b7ec11dd6685b0bf669e26c8db6"; $body = \[ "timestamp" => $timestamp, "txid" => $txid, "imid" => "ionpaytest", "referenceno" => $reference no, "paymethod" => "01", "merchanttoken" => $merchant token, "amt" => $amt, "cancelmsg" => "cancellation of transaction", "canceltype" => "2", "cancelserverip" => "127 0 0 1", "canceluserid" => "", "canceluserip" => "127 0 0 1", "canceluserinfo" => "", "cancelretrycnt" => "", "worker" => "" ]; $response = httputil postjsonrequest($url, $body); php native $config = $this >configv2; $timestamp = "20251008131011"; $txid = "shopeetest01202410111242218557"; $reffno = "ordcancel20251008131011"; $imid = "shopeetest"; $amount = "1000"; $requestbody = cancel builder() >settimestamp($timestamp) >setpaymethod("01") >settxid($txid) >setimid($imid) >setmerchanttoken($timestamp, $imid, $txid, $amount, $this >merchantkey) >setreferenceno($reffno) >setamt($amount) >setcanceltype("2") >setcancelmsg("cancelation of card trans with php native") >setcanceluserip("127 0 0 1") >setcanceluserid("") >setcanceluserinfo("") >setcancelretrycnt("") >setworker("") >build(); $cardservice = new v2cardservice($config); $response = $cardservice >cancel($requestbody); val request directv2cancel = directv2cancel builder() timestamp("20251008131011") txid("ionpaytest01202509241944339756") imid("ionpaytest") merchantkey("your merchant key") referenceno("ordno20250924194433") amt("10000") paymethod("01") canceltype("2") build() val response nicepayresponsev2 = v2cardservice cancel(request, config)!! codeigniter $config = $this >configv2; $timestamp = "20251008131011"; $txid = "ionpaytest01202509241944339756"; $amount = "10000"; $reffno = "ordno20250924194433"; $requestbody = cancel builder() >settimestamp($timestamp) >setimid($this >imid) >settxid($txid) >setreferenceno($reffno) >setmerchanttoken($timestamp, $this >imid, $txid, $amount, $this >merchantkey) >setpaymethod("01") >setcanceltype("2") >setamt($amount) >build(); $v2vaservice = new v2vaservice($config); $response = $v2vaservice >cancel($requestbody); response parameter sample response { "txid" "ionpaytest01202509241944339756", "referenceno" "ordno20250924194433", "resultcd" "0000", "resultmsg" "success", "transdt" "20250924", "transtm" "194433", "description" "this is testing transaction", "amt" "10000", "cancelreferenceno" "ordno20250924194433", "acquirerdata" { "rrn" null } }