NICEPAY API
...
API Virtual Account SNAP
Check Status Transaction - API Virtual Account SNAP
10 min
about check status transaction api virtual account snap this api with the snap standards uses by the merchant to request status inquiry checking to nicepay check status transaction api please request the access token firsthand before doing the authentication through the docid 92feymrqs iebhxrfgxuq section service code 26 api endpoint /api/v1 0/transfer va/status method http post description to request status inquiry checking to nicepay content type application/json request check status header parameter parameter type length required description example content type string mandatory application / json authorization string mandatory bearer “ access token ” x timestamp string mandatory using iso 8601 as timestamp format transaction date time, in format yyyymmddthh\ mm\ ss+07 00 time must be in gmt+7 (jakarta time) 2022 03 21t10 11 40+07 00 x signature string mandatory signature will be generated by merchant docid\ uzex33relyenkogbjjnyp x partner id string 20 mandatory x partner id = client id x external id string 40 mandatory unique reference number ( 41807553358950093184 ) channel id string mandatory unique channel merchant credential id number client id + "01" = channel id "ionpaytest" + "01" = "ionpaytest01" ionpaytest01 request check status body parameter for partnerserviceid and virtualaccountno parameters can send with an empty value parameter type length required description partnerserviceid string 20 mandatory partner service id / prefix customerno string 40 mandatory customer number virtualaccountno string 25 mandatory virtual account number inquiryrequestid string 128 the same value as x external id additionalinfo object mandatory "additionalinfo" { "totalamount" { }, } totalamount object mandatory "totalamount" { } value string 12 mandatory transaction amount currency string 3 mandatory currency trxid string 40 mandatory reference number from merchant txidva string 30 mandatory transaction id (generated by nicepay) response check status parameter parameter type length required description responsecode string mandatory docid\ bjr4kjamzcknln 5zrnvw responsemessage string mandatory response message virtualaccountdata object mandatory partnerserviceid string 20 mandatory partner service id / prefix customerno string 40 mandatory customer number virtualaccountno string 25 mandatory virtual account number inquiryrequestid string 128 mandatory the same value as x external id totalamount object mandatory value string 12 mandatory transaction amount currency string 3 mandatory currency additionalinfo object mandatory bankcd string 4 mandatory docid 9woqy5 1hlf ucwshsdho txidva string 30 mandatory transaction id (generated by nicepay) goodsnm string 200 mandatory goods name vacctvaliddt string 8 mandatory virtual account valid date vacctvalidtm string 6 mandatory virtual account valid time virtualaccountname string 100 mandatory virtual account name trxid string 40 mandatory reference number from merchant transactionstatusdesc string mandatory docid\ nvclmbygxr5uc 5qmyu7 description success pending refunded canceled failed latesttransactionstatus string mandatory docid\ nvclmbygxr5uc 5qmyu7 00 success 03 pending 04 refunded 05 canceled 06 failed hashedsourceaccountno string 32 optional source account number in hash or unhash depend on bank sourcebankcode string 11 optional source account bank code sample parameter for check status transaction api virtual account snap request parameter curl curl location 'https //dev nicepay co id/nicepay/api/v1 0/transfer va/status' \\ \ header 'content type application/json' \\ \ header 'authorization bearer eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=' \\ \ header 'x timestamp 2024 12 31t10 11 40+07 00' \\ \ header 'x signature ufbw7r8rhw79ioiv/hlv607m60qzaybv8uzmbsryb6/thlo/fhqvp4xryeluehoss9o+qs6vwtkb/ygtucc+tq==' \\ \ header 'x partner id normaltest' \\ \ header 'x external id txid202402111402271707638094' \\ \ header 'channel id normaltest' \\ \ data '{ "partnerserviceid" "99123040", "customerno" "00007307", "virtualaccountno" "9912304000007307", "inquiryrequestid" "txid202402111402271707638094", "additionalinfo" { "totalamount" { "value" "10000 00", "currency" "idr" }, "trxid" "2024123000000000000001", "txidva" "normaltest02202401181001033629" } }' node js let config = { isproduction false, privatekey cons privatekey, clientsecret cons clientsecret, clientid cons clientid, iscloudserver false, }; let paramcheckstatus = { body { partnerserviceid "99123040", customerno "00007307", virtualaccountno "9912304000007307", inquiryrequestid "txid202402111402271707638094", additionalinfo { totalamount { value "10000 00", currency "idr", }, trxid "2024123000000000000001", txidva "normaltest02202401181001033629", }, }, headers { x external id "txid202402111402271707638094", channel id cons clientid, }, }; let snap = new snap(config); let endpoint = `/api/v1 0/transfer va/status`; let response = snap requestsnaptransaction(paramcheckstatus, endpoint, accesstoken, "post"); config = nicepay builder() isproduction(false) iscloudserver(false) clientsecret(client secret) partnerid(partner id) externalid("txid202402111402271707638094") timestamp("2024 12 31t10 11 40+07 00") privatekey(private key cloud) build(); var accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8="; inquirystatus requestdata = inquirystatus builder() partnerserviceid("99123040") customerno("00007307") virtualaccountno("9912304000007307") inquiryrequestid("txid202402111402271707638094") totalamount("10000 00", "idr") trxid("2024123000000000000001") txidva("normaltest02202401181001033629") build(); nicepayresponse result = snapinquirystatusservice callservicevacheckstatus(requestdata, accesstoken, config); bodycreatetoken = ( builderaccesstoken buildaccesstoken() setgranttype("client credentials") setadditionalinfo("") build() ) totalamount = { "value" "10000 00", "currency" "idr" } additionalinfo = { "txidva" "normaltest02202401181001033629", "totalamount" totalamount, "trxid" "2024123000000000000001", } bodyinquiryva = ( buildervirtualaccount buildinquiryva() setpartnerserviceid("99123040") setcustomerno("00007307") setvirtualaccountno("9912304000007307") setinquiryrequestid("txid202402111402271707638094") setadditionalinfo(additionalinfo) build() ) environment = (builderenvironment buildenvironment() iscloud(false) isproduction(false) build()) result = snapservice servicetransaction( bodycreatetoken jsonaccesstoken(), bodyinquiryva jsonvainquiry(), constantsendpoints inquiryva(), environment ) c# string clientid = "normaltest"; string privatekey = " private key"; // replace with actual private key string timestamp = "2024 12 31t10 11 40+07 00"; string clientsecret = " client secret"; // replace with actual client secret string channelid = "normaltest"; bool isproduction = false; bool iscloudserver = true; string signature = signaturegeneratorutils generatesignature(privatekey, clientid, timestamp); var tokenrequester = new accesstokenrequester(); string accesstokenresponse = await tokenrequester getaccesstokenasync(clientid, signature, timestamp, isproduction, iscloudserver); dynamic accesstokenobject = jobject parse(accesstokenresponse); string accesstoken = accesstokenobject accesstoken; apiendpoints apiendpoints = new apiendpoints(); apiservice vaservice = new apiservice(apiendpoints, clientsecret, clientid, channelid, isproduction, iscloudserver); snapvaservices requestbodygenerator = new snapvaservices(clientid); // values from your provided data string va no = "9912304000007307"; string trxid = "2024123000000000000001"; string amount = "10000 00"; string txidva = "normaltest02202401181001033629"; string inquiryrequestbody = requestbodygenerator generateinquiryrequest( customerno "00007307", virtualaccountno va no, inquiryrequestid "txid202402111402271707638094", value amount, currency "idr", trxid trxid, txidva txidva ); string externalid = "txid202402111402271707638094"; string inquiryresponse = await vaservice sendpostrequest(apiendpoints inquiryva, accesstoken, timestamp, inquiryrequestbody, externalid); laravel protected $useprod = false; protected $usecloud = false; protected $inquiry va endpoint = "/api/v1 0/transfer va/status"; // credential protected $client id = "client key merchant"; protected $key = " private key merchant"; protected $client secret = " client secret merchant"; protected $access token = " access token merchant"; $url = httputil getnicepaydomain($this >useprod, $this >usecloud) "/nicepay" $this >inquiry va endpoint; $helper = new helpers(); $http method = "post"; // use the timestamp from previous data $x time stamp = "2024 12 31t10 11 40+07 00"; $time stamp = "20241231101140"; $partner id = $this >client id; $client secret = $this >client secret; $access token = $helper >generateaccesstoken($this >client id, $this >key); $external id = "txid202402111402271707638094"; $totalamount = \[ "value" => "10000 00", "currency" => "idr" ]; $additionalinfo = \[ "totalamount" => $totalamount, "trxid" => "2024123000000000000001", "txidva" => "normaltest02202401181001033629" ]; $body = \[ "partnerserviceid" => "99123040", "customerno" => "00007307", "virtualaccountno" => "9912304000007307", "virtualaccountname" => "test va status", "inquiryrequestid" => "txid202402111402271707638094", "trxid" => "2024123000000000000001", "totalamount" => $totalamount, "additionalinfo" => $additionalinfo ]; $string to sign = $helper >generatestringtosign( $http method, $this >inquiry 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 "01" ); try { $response = httputil postjsonrequestwithheader($url, $body, $header); } catch (\exception $e) { echo "error " $e >getmessage(); } php native $config = nicepay builder() >setisproduction(false) >setprivatekey($this >oldkeyformat) >setclientsecret($this >clientsecret) >setpartnerid($this >imidtest) >setexternalid("txid202402111402271707638094") >settimestamp("2024 12 31t10 11 40+07 00") >build(); $parameter = inquirystatus builder() >setpartnerserviceid("99123040") >setcustomerno("00007307") >setvirtualaccountno("9912304000007307") >setinquiryrequestid("txid202402111402271707638094") >settrxid("2024123000000000000001") >settxidva("normaltest02202401181001033629") >settotalamount("10000 00", "idr") >build(); $accesstoken = self getaccesstoken($config); $snapvaservice = new snapvaservice($config); try { $response = $snapvaservice >inquirystatus($parameter, $accesstoken); } catch (\exception $e) { echo "error " $e >getmessage(); } val config nicepay = nicepay builder() isproduction(false) clientsecret(testingconstants normaltest client secret) partnerid(i mid normaltest) externalid("txid202402111402271707638094") timestamp("2024 12 31t10 11 40+07 00") privatekey(testingconstants private key) build() val accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=" val reqinquiryva snapcheckstatus = snapcheckstatus builder() partnerserviceid("99123040") customerno("00007307") virtualaccountno("9912304000007307") inquiryrequestid("txid202402111402271707638094") totalamount("10000 00", "idr") trxid("2024123000000000000001") txidva("normaltest02202401181001033629") build() val snapvirtualaccountservice snapvirtualaccountservice = snapvirtualaccountserviceimpl() val response nicepayresponse? = snapvirtualaccountservice checkstatus(reqinquiryva, accesstoken, config) codeigniter $this >clientsecret = $testconst imid test client secret; $this >oldkeyformat = $testconst imid test private key; $this >imidtest = $testconst imid test; $this >merchantkey = $testconst imid common merchant key; $this >v2config = nicepay builder() >setisproduction(false) >build(); $config = nicepay builder() >setiscloudserver(true) >setprivatekey($this >oldkeyformat) >setclientsecret($this >clientsecret) >setpartnerid($this >imidtest) >setexternalid("txid202402111402271707638094") >settimestamp("2024 12 31t10 11 40+07 00") >build(); $inquirystatusbuilder = inquirystatus builder(); $parameter = $inquirystatusbuilder >setpartnerserviceid("99123040") >setcustomerno("00007307") >setvirtualaccountno("9912304000007307") >setinquiryrequestid("txid202402111402271707638094") >settrxid("2024123000000000000001") >settxidva("normaltest02202401181001033629") >settotalamount("10000 00", "idr") >build(); $accesstoken = self getaccesstoken($config); $snapvaservice = new snapvaservice(); try { $response = $snapvaservice >inquirystatus($parameter, $accesstoken, $config); } catch (\exception $e) { echo "error " $e >getmessage(); } response parameter sample response { "responsecode" "2002600", "responsemessage" "successful", "virtualaccountdata" { "partnerserviceid" "86230927", "customerno" "87654321", "virtualaccountno" "8623092787654321", "inquiryrequestid" "11032020240313", "totalamount" { "value" "10000 00", "currency" "idr" } }, "additionalinfo" { "virtualaccountname" "john test", "trxid" "2020102900000000000001", "transactionstatusdesc" "success", "latesttransactionstatus" "00", "bankcd" "cena", "txidva" "openfix0010220221107161035699", "goodsnm" "test", "vacctvaliddt" "20221110", "vacctvalidtm" "161037", "hashedsourceaccountno" "abcdefghijklmnopqrstuvwxyz123456", "sourcebankcode" "008" } }