SNAP API Testing
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 | ||
SNAP Virtual Account API | ||
QRIS API | ||
E-Wallet API | Coming Soon | |
Payout API |
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
Base64 encoder = Base64.getEncoder()
String hmacAsBase64 =
encoder.encodeToString(hmac.doFinal(stringToSign.getBytes("UTF-8")))