SNAP API Testing
7 min
swagger for snap api testing api testing proceeds to testing several payment method using api snap before setup on the system several api snap available for swagger testing format such as api name swagger file api information access token request access token docid 6b92tnxas6zvrgu614ppc request access token api snap docid 92feymrqs iebhxrfgxuq snap virtual account api create virtual account docid 0 wvny4epnjhrpjerakpu status virtual account docid\ hcxagusfee9w0jxouzbpx cancel virtual account docid\ lf7wy92j 2o1zw9ae2 mj api virtual account snap docid ejy3d54njez a1p1ewot qris api create qris docid\ xpoa8mtugpo 2jalgz3wx status qris docid\ evcozwcaqvifby1lpwu6u refund qris docid\ buzckoxtoacvlih2fwf1v api qris snap docid\ mkm7khspmpxibzrzm5drf e wallet api coming soon api e wallet (direct debit) snap docid\ vh0r0gp sjhtt idysn3m payout api registration payout docid 7wupbfr0natsbrmkg51hb approve payout docid 4zny5enixk3dpjafcyfie reject payout docid\ q vyqonnwtistervnvcls inquiry payout docid 2ydhnr5cletjjofun3srq cancel payout docid\ wozeq8gxybj8kwziflvvg balance inquiry payout docid\ ucrayal6ngxbue4c26xod payout api (disbursement) snap docid\ ovqlv2rxww8misf11oob7 snap api testing guidance the following is the steps to proceed with the snap api testing generate access token that will be used on authorization part fill in the available header parameter and body parameter form press the try it button to send the request parameter and get response parameter response parameter could be seen on the bottom right side of the display x signature guidance asymmetric x signature asymmetric uses to request access token header the following is a sample step to generate an x signature access token sha256withrsa (private key, stringtosign) stringtosign = client id + “|” + x timestamp symmetric x signature symmetric uses as header to request parameter on every api sent to the nicepay system the following are the sample steps to generate x signature hmac sha512 (clientsecret, stringtosign) stringtosign = httpmethod +” “+ endpointurl +" "+ accesstoken +" “+ lowercase(hexencode(sha256(minify(requestbody))))+ " “ + x timestamp construct encoderequestbody using payload, hexencode dan sha256 lowercase(hexencode(sha256(minify(requestbody)))) construct payload signature concat at field using " " separator httpmethod\ endpointurl\ accesstoken\ encoderequestbody\ timestamp 1\ sample url post /api/v1 0/transfer va/create va\ eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijqrepciiwizxhwijoimjayns0wny0xmvqwmzoyodoxnvoifq== 04xpqtqmhcnuyft4pgrch wtarp8pt6ax8iugxx 7hk= 0140cbc57524ee33d23ec6b520a6e3ffa966320fcbac5608716548648e65c4c5 2025 07 11t10 13 15+07 00; 2 sample generate sample generate hmac sha512 for payload string payload="{\r\n \\"partnerserviceid\\" \\"\\",\r\n \\"customerno\\" \\"\\",\r\n \\"virtualaccountno\\" \\"\\",\r\n \\"virtualaccountname\\" \\"nodejs test\\",\r\n \\"trxid\\" \\"order1752203594788\\",\r\n \\"totalamount\\" {\r\n \\"value\\" \\"10000 00\\",\r\n \\"currency\\" \\"idr\\"\r\n },\r\n \\"additionalinfo\\" {\r\n \\"bankcd\\" \\"bmri\\",\r\n \\"goodsnm\\" \\"test\\",\r\n \\"dbprocessurl\\" \\"https \\/\\/nicepay co id\\/\\",\r\n \\"vacctvaliddt\\" \\"\\",\r\n \\"vacctvalidtm\\" \\"\\"\r\n }\r\n}"; string requestbody = ""; string hexencode = ""; requestbody = payload replaceall("\[\n\r\t]", "") hexencode=java security messagedigest getinstance("sha256") digest(requestbody getbytes("utf 8")) encodehex() hexencode = '0140cbc57524ee33d23ec6b520a6e3ffa966320fcbac5608716548648e65c4c5' string stringtosign = "post" + " " + "/api/v1 0/transfer va/create va" + " " + "0140cbc57524ee33d23ec6b520a6e3ffa966320fcbac5608716548648e65c4c5" + " " + "2025 07 11t10 13 15+07 00" 3 sample create hash sample create hash secretkeyspec secretkey = new secretkeyspec(clientsecret getbytes(),"hmacsha512"); mac hmac = mac getinstance("hmacsha512") hmac init(secretkey) 4 sample signature base64 base64 encoder = base64 getencoder() string hmacasbase64 = encoder encodetostring(hmac dofinal(stringtosign getbytes("utf 8"))) 5 sample result the result are x signature 3np5zxeymuhesqwvou7domg6bwrqknp0epsj2uc9bq1j7yr5t+mkiyhcygeougos3cqiofovfxdutboas7ugng==