NICEPAY API
API Playground
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 true 196,243 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 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==