NICEPAY API
...
Checkout API
Cancel - API Checkout
9 min
about cancel api checkout this uses to cancel that will ongoing specific to va, can only cancel before makes after is cancelled, must register again from beginning through docid 066dopsepwv3fgkypjzaf api cancel api checkout api url /nicepay/direct/v2/cancel request method post header content type application/json merchant token sha256 ( timestamp + imid + txid + amt + merchantkey ) request parameter for cancel api checkout parameter type size description remark timestamp required required n 14 request timestamp 20221219111294 txid required required an 30 transaction id normaltest00202212191104443483 imid required required an 10 id normaltest paymethod required required n 2 docid\ iifmsruuw7j9vmwefjz97 02 canceltype required required n 2 docid\ ly9czdrbjtw3rjv3l7r6v 1 merchanttoken required required an 255 token 63d44f80942cc915f6d736995797470ac2918a9f88b6fb762608541145e65bd8 amt required required n 12 amount 10000 cancelmsg required required an 255 cancel message request cancel preauthtoken an 100 pre auth token d4ef98b26f917a697691807cf… referenceno optional for cc optional for cc ans 40 cancel number cancelno20160525000 52104 cancelserverip an 15 server ip 127 0 0 1 canceluserid an 30 user id admin canceluserip an 15 user ip 127 0 0 1 canceluserinfo an 100 user information test cancel cancelretrycnt n 2 retry count 5 worker an 10 worker worker response parameter for cancel api checkout parameter type size description remark resultcd n 4 docid 7o8nl7guqp asiwfdqi3v 0000 resultmsg an 255 result message docid\ wpcemazro xvnxz 1zaib success txid an 30 transaction id normaltest00202212191104443483 when success referenceno ans 40 order number order20221012080918 when success transdt n 8 transaction date 20221219 when success transtm n 6 transaction time 110444 when success amt n 12 amount 10000 when success description an 255 description canceltxid an 30 cancel transaction id canceltrxsn an 32 cancel transaction number cancelreferenceno optional for cc optional for cc an 40 cancel number sample parameter for cancel api checkout request parameter curl curl location 'https //dev nicepay co id/nicepay/direct/v2/cancel' \\ \ header 'content type application/json' \\ \ data '{ "timestamp" "20251111011147", "imid" "ionpaytest", "txid" "ionpaytest02202511110137007677", "paymethod" "02", "merchanttoken" "0eeb02a32bffdc6309a672b3ef7ea35f8fb2b20c1fda11e4cbdb76313d9f2085", "amt" "10000", "canceltype" "1", "cancelmsg" "cancel testing transaction", "canceluserid" "", "canceluserip" "127 0 0 1", "cancelserverip" "127 0 0 1", "canceluserinfo" "", "cancelretrycnt" "", "worker" "" }' node js const secondapiversion = require(" /lib/secondapiversion js"); const cons = require(" /sharedconfig js"); const config = { isproduction false, iscloudserver false, merchantkey cons merchantkey, }; let parametercancel = { "timestamp" "20251111011147", "imid" "ionpaytest", "txid" "ionpaytest02202511110137007677", "paymethod" "02", "amt" "10000", "canceltype" "1", "cancelmsg" "cancel testing transaction", "canceluserid" "", "canceluserip" "127 0 0 1", "cancelserverip" "127 0 0 1", "canceluserinfo" "", "cancelretrycnt" "", "worker" "" }; let secondversion = new secondapiversion(config); response = secondversion requestapi(parametercancel, "/direct/v2/cancel");config = nicepay builder() isproduction(false) build(); string timestamp = "20251111011147"; string txid = "ionpaytest02202511110137007677"; string imid = "ionpaytest"; string amount = "10000"; cancel requestcancel = cancel builder() timestamp(timestamp) txid(txid) imid(imid) merchanttoken(timestamp, imid, txid, amount, your merchant key) paymethod("02") canceltype("1") amt(amount) cancelmsg("cancel testing transaction") canceluserid("") canceluserip("127 0 0 1") cancelserverip("127 0 0 1") canceluserinfo("") cancelretrycnt("") worker("") build(); nicepayresponsev2 response = v2cancelservice callv2canceltransaction(requestcancel, config);bodycancel = ( buildercancel buildcancel() setpaymethod("02") settxid("ionpaytest02202511110137007677") setcanceluserid("") setcanceltype("1") setcancelmsg("cancel testing transaction") setamt("10000") setcanceluserip("127 0 0 1") setcancelserverip("127 0 0 1") setcanceluserinfo("") setcancelretrycnt("") setworker("") build() ) environment = (builderenvironment buildenvironment() iscloud(false) isproduction(false) build()) response = servicenicepay servicecancel(datagenerator getcancelbody(bodycancel jsoncancel()), environment) c# testingconstantservice config = new testingconstantservice(); // sample constants string merchantkey = config merkey; string clientid = "ionpaytest"; string timestamp = "20251111011147"; string amount = "10000"; string txid = "ionpaytest02202511110137007677"; bool isproduction = false; bool iscloudserver = false; var builder = new merchanttokenbuilder() settimestamp(timestamp) setimid(clientid) settxid(txid) setamount(amount) setmerchantkey(merchantkey); // act menghasilkan merchanttoken string merchanttoken = builder buildcancelmerchanttoken(); var bodybuilder = new nicepayrequestbuilder() setcancel( imid clientid, timestamp timestamp, txid txid, amt amount, merchanttoken merchanttoken, paymethod "02", canceltype "1", cancelmsg "cancel testing transaction", canceluserid "", cancelretrycnt "", ); apiendpoints apiendpoints = new apiendpoints(); dictionary\<string, object> payload = bodybuilder build(); string jsonpayload = newtonsoft json jsonconvert serializeobject(payload); var registrationservice = new nicepayregistrationservice(apiendpoints,isproduction, iscloudserver); var result = await registrationservice sendpostasync(apiendpoints cancelv2,payload); laravel $url = httputil getnicepaydomain($this >useprod, $this >usecloud) $this >cancel endpoint; //request body parameter $timestamp = "20251111011147"; $txid = "ionpaytest02202511110137007677"; $amt = $this >amt; $merchant token = $this >generatemerchanttoken($timestamp, $this >imid, $txid, $this >amt, $this >merchant key); $body = \[ "timestamp" => $timestamp, "txid" => $txid, "imid" => $this >imid, "paymethod" => $this >pay method, "merchanttoken" => $merchant token, "amt" => $amt, "cancelmsg" => "cancel testing transaction", "canceltype" => "1", "cancelserverip" => "127 0 0 1", "canceluserid" => "", "canceluserip" => "127 0 0 1", "canceluserinfo" => "", "cancelretrycnt" => "", "worker" => "" ]; try { $response = httputil postjsonrequest($url, $body); } catch (throwable $th) { return httputil generateerrorresponse($th); } php native $timestampv2 = "20251111011147"; $amount = "10000"; $imid = "ionpaytest"; $merchantkey = testconst $merchant key; $configv2 = nicepay builder() >setisproduction(false) >build(); $config = $configv2; $timestamp = $timestampv2; $txid = "ionpaytest02202511110137007677"; $requestbody = cancel builder() >settimestamp($timestamp) >setimid($this >imid) >settxid($txid) >setmerchanttoken($timestamp, $this >imid, $txid, $this >amount, $this >merchantkey) >setpaymethod("02") >setcanceltype("1") >setamt($this >amount) >setcancelmsg("cancel testing transaction") >setcanceluserid("") >setcanceluserip("127 0 0 1") >setcancelserverip("127 0 0 1") >setcanceluserinfo("") >setcancelretrycnt("") >setworker("") >build(); try { $v2vaservice = new v2vaservice($config); $response = $v2vaservice >cancel($requestbody); }private val v2virtualaccountservice directv2service\<directv2virtualaccount> = directv2virtualaccountserviceimpl() private val timestamp string = "20251111011147" private val txid string = "ionpaytest02202511110137007677" private val imid string = "ionpaytest" private val amount string = "10000" private var config nicepay? = nicepay builder() isproduction(false) build() val request directv2cancel = directv2cancel builder() timestamp(timestamp) txid(txid) imid(imid) merchantkey(testingconstants default merchant key) amt(amount) paymethod("02") canceltype("1") cancelmsg("cancel testing transaction") canceluserid("") canceluserip("127 0 0 1") cancelserverip("127 0 0 1") canceluserinfo("") cancelretrycnt("") worker("") build() val response nicepayresponsev2 = v2virtualaccountservice cancel(request, config)!! codeigniter $config = nicepay builder() >setisproduction(false) >setiscloudserver(false) >build(); $timestamp = "20251111011147"; $txid = "ionpaytest02202511110137007677"; $amount = "10000"; $requestbody = cancel builder() >settimestamp($timestamp) >setimid($this >imid) >settxid($txid) >setmerchanttoken($timestamp, $this >imid, $txid, $amount, $this >merchantkey) >setpaymethod("02") >setcanceltype("1") >setamt($this >amount) >setcancelmsg("cancel testing transaction") >setcanceluserid("") >setcanceluserip("127 0 0 1") >setcancelserverip("127 0 0 1") >setcanceluserinfo("") >setcancelretrycnt("") >setworker("") >build(); try { $v2vaservice = new v2vaservice($config); $response = $v2vaservice >cancel($requestbody); } response parameter sample response { "txid" "ionpaytest02202511110137007677", "referenceno" "ordno20251111011183", "resultcd" "0000", "resultmsg" "success", "transdt" "20251111", "transtm" "013700", "description" "testing transaction", "amt" "10000" }