NICEPAY API
...
API Virtual Account SNAP
Cancel - API Virtual Account SNAP
9 min
tentang cancel api virtual account snap api dengan standar snap ini digunakan untuk melakukan pengajuan pembatalan proses transaksi pada metode pembayaran virtual account merchant cancel api virtual account snap silakan mengajukan akses token terlebih dahulu untuk melakukan autentikasi melalui bagian docid\ gcgqbiyxg1etcd0ji9chx 331,331 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 request header parameter for cancel api virtual account snap 144,77,85,105,253,100 true unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type request body parameter for cancel api virtual account snap 251,75,76,105,181 true unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type response parameter for cancel api virtual account snap 251,75,76,105,181 true unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center 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 center unhandled content type center unhandled content type center 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 virtual account snap request parameter curl curl x delete "https //www nicepay co id/nicepay/api/v1 0/transfer va/delete va" \\ h "content type application/json" \\ h "authorization bearer eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=" \\ h "x timestamp 2024 12 31t10 11 40+07 00" \\ h "x signature ufbw7r8rhw79ioiv/hlv607m60qzaybv8uzmbsryb6/thlo/fhqvp4xryeluehoss9o+qs6vwtkb/ygtucc+tq==" \\ h "x partner id normaltest" \\ h "x external id txid202402111402271707638095" \\ h "channel id normaltest" \\ d '{ "partnerserviceid" "99123040", "customerno" "00007307", "virtualaccountno" "9912304000007307", "trxid" "2024123000000000000001", "additionalinfo" { "totalamount" { "value" "10000 00", "currency" "idr" }, "txidva" "normaltest02202401181001033629", "cancelmessage" "cancel virtual account" } }' node js const config = { isproduction false, privatekey cons privatekey, clientsecret cons clientsecret, clientid cons clientid, iscloudserver false, }; let parameterdelete = { body { partnerserviceid "99123040", customerno "00007307", virtualaccountno "9912304000007307", trxid "2024123000000000000001", additionalinfo { totalamount { value "10000 00", currency "idr", }, txidva "normaltest02202401181001033629", cancelmessage "cancel virtual account", }, }, headers { x external id "txid202402111402271707638095", channel id cons clientid, }, }; let endpoint = `/api/v1 0/transfer va/delete va`; let snap = new snap(config); let response = snap requestsnaptransaction(parameterdelete, endpoint, accesstoken, "delete"); config = nicepay builder() isproduction(false) clientsecret(client secret) partnerid(i mid) externalid("txid202402111402271707638095") timestamp("2024 12 31t10 11 40+07 00") privatekey(private key) build(); var accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8="; cancel requestdata = cancel builder() partnerserviceid("99123040") customerno("00007307") virtualaccountno("9912304000007307") totalamount("10000 00", "idr") trxid("2024123000000000000001") txidva("normaltest02202401181001033629") cancelmessage("cancel virtual account") build(); nicepayresponse result = snapcancelservice callservicevacancel(requestdata, accesstoken, config); bodycreatetoken = ( builderaccesstoken buildaccesstoken() setgranttype("client credentials") setadditionalinfo("") build() ) totalamount = { "value" "10000 00", "currency" "idr" } additionalinfo = { "txidva" "normaltest02202401181001033629", "totalamount" totalamount, "cancelmessage" "cancel virtual account" } bodycancelva = ( buildervirtualaccount buildcancelva() setpartnerserviceid("99123040") setcustomerno("00007307") setvirtualaccountno("9912304000007307") settrxid("2024123000000000000001") setadditionalinfo(additionalinfo) build() ) environment = ( builderenvironment buildenvironment() iscloud(false) isproduction(false) build() ) result = snapservice servicetransaction( bodycreatetoken jsonaccesstoken(), bodycancelva jsonvacancel(), constantsendpoints cancelva(), environment, "delete" ) c# testingconstant config = new testingconstant(); string clientid = config clientid; string privatekey = config privatekey; string timestamp = "2024 12 31t10 11 40+07 00"; string clientsecret = config clientsecret; string channelid = "normaltest"; bool isproduction = false; bool iscloudserver = false; string signature = signaturegeneratorutils generatesignature(privatekey, clientid, timestamp); // get access token var tokenrequester = new accesstokenrequester(); string accesstokenresponse = await tokenrequester getaccesstokenasync(clientid, signature, timestamp, isproduction, iscloudserver); dynamic accesstokenobject = jobject parse(accesstokenresponse); string accesstoken = accesstokenobject accesstoken; // setup nicepay api service apiendpoints apiendpoints = new apiendpoints(); apiservice vaservice = new apiservice(apiendpoints, clientsecret, clientid, channelid, isproduction, iscloudserver); string va no = "9912304000007307"; string trxid = "2024123000000000000001"; string amount = "10000 00"; string currency = "idr"; string txidva = "normaltest02202401181001033629"; string cancelmessage = "cancel virtual account"; var bodybuilder = new cancelbuilder() setcancelvasnap( partnerserviceid "99123040", virtualaccountno va no, trxid trxid, amountvalue amount, currency currency, txidva txidva, customerno "00007307", cancelmessage cancelmessage ) build(); string jsonpayload = newtonsoft json jsonconvert serializeobject(bodybuilder); console writeline("delete va request " + jsonpayload); // process delete va (post request) string externalid = "txid202402111402271707638095"; string deleteresponse = await vaservice senddeleterequest(apiendpoints deleteva, accesstoken, timestamp, bodybuilder, externalid); laravel $url = httputil getnicepaydomain($this >useprod, $this >usecloud) "nicepay/" $this >delete va endpoint; $helper = new helpers(); $http method = "delete"; $date = carbon now(); $x time stamp = $date >toiso8601string(); $time stamp = $date >format("ymdhis"); $partner id = $this >client id; $client secret = $this >client secret; $access token = $this >access token; $external id = "txid202402111402271707638095"; $totalamount = \[ "value" => "10000 00", "currency" => "idr" ]; $additionalinfo = \[ "totalamount" => $totalamount, "txidva" => "normaltest02202401181001033629", "cancelmessage" => "cancel virtual account" ]; $body = \[ "partnerserviceid" => "99123040", "customerno" => "00007307", "virtualaccountno" => "9912304000007307", "trxid" => "2024123000000000000001", "additionalinfo" => $additionalinfo, ]; $string to sign = $helper >generatestringtosign( $http method, $this >delete va endpoint, $access token, $body, $x time stamp ); $signature = $helper >hmacsha512encoded( $string to sign, $client secret, openssl algo sha512 ); $header = $helper >generateheader( $access token, $x time stamp, $signature, $partner id, $external id, $partner id "02" ); try { $response = httputil deletejsonrequestwithheader($url, $body, $header); } catch (\exception $e) { echo "error deleting va " $e >getmessage(); } php native $config = nicepay builder() >setisproduction(false) >setclientsecret(testconst $client secret nt) >setpartnerid($this >imid) >setexternalid("extidcancel" $this >timestamp) >settimestamp($this >timestamp) >setprivatekey(testconst $key old format) >build(); $accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8="; $vacctno = "9912304000007307"; $reffno = "2024123000000000000001"; $txid = "normaltest02202401181001033629"; $amount = "10000 00"; $requestdata = cancel builder() >setpartnerserviceid("99123040") >setcustomerno("00007307") >setvirtualaccountno($vacctno) >settotalamount($amount, "idr") >settrxid($reffno) >settxidva($txid) >setcancelmessage("cancel virtual account") >build(); try { $snapvaservice = new snapvaservice($config); $response = $snapvaservice >cancel($requestdata, $accesstoken); } catch (exception $e) { echo "error cancelling va " $e >getmessage(); } val config nicepay = nicepay builder() isproduction(false) clientsecret(testingconstants normaltest client secret) partnerid(i mid normaltest) externalid("txid202402111402271707638095") timestamp("2024 12 31t10 11 40+07 00") privatekey(testingconstants private key) build() val accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=" val reqdeleteva snapcancel = snapcancel builder() partnerserviceid("99123040") customerno("00007307") virtualaccountno("9912304000007307") cancelmessage("cancel virtual account") totalamount("10000 00", "idr") trxid("2024123000000000000001") txidva("normaltest02202401181001033629") build() val snapvirtualaccountservice snapvirtualaccountservice = snapvirtualaccountserviceimpl() val response nicepayresponse? = snapvirtualaccountservice deleteva(reqdeleteva, accesstoken, config) codeigniter $timestamp = helper getformatteddate(); $config = nicepay builder() >setisproduction(false) >setiscloudserver(true) >setprivatekey($this >oldkeyformat) >setclientsecret($this >clientsecret) >setpartnerid($this >imidtest) >setexternalid("txid202402111402271707638095") >settimestamp("2024 12 31t10 11 40+07 00") >build(); $deletevirtualaccountbuilder = deletevirtualaccount builder(); $parameter = $deletevirtualaccountbuilder >setpartnerserviceid("99123040") >setcustomerno("00007307") >setvirtualaccountno("9912304000007307") >settrxid("2024123000000000000001") >settotalamount("10000 00", "idr") >settxidva("normaltest02202401181001033629") >setcancelmessage("cancel virtual account") >build(); $accesstoken = self getaccesstoken($config); $snapvaservice = new snapvaservice(); try { $response = $snapvaservice >deleteva($parameter, $accesstoken, $config); } catch (\exception $e) { echo "error deleting va " $e >getmessage(); } response parameter sample response { "responsecode" "2003100", "responsemessage" "success", "virtualaccountdata" { "partnerserviceid" "99123040", "customerno" "00007307", "virtualaccountno" "9912304000007307", "trxid" "2024123000000000000001", "additionalinfo" { "txidva" "normaltest02202401181001033629", "cancelmessage" "cancel virtual account", "cancelvatime" "2024 12 31t10 11 40+07 00", "totalamount" { "value" "10000 00", "currency" "idr" } } } }