---
title: SNAP API Testing
slug: en/nicepay-api-snap-testing
description: Information about SNAP API Testing provided by NICEPAY
image: https://archbee-image-uploads.s3.amazonaws.com/ZHvSjR5ZrsoxwKbJa3xmo/mKrVuAlNZur4oOuiLsWHI_rdrx9d8diazpgm07xfz2test-1.png
icon: {"faIcon":"fa-solid fa-file-code"}
docTags: 
createdAt: 2023-08-09T10:48:47.025Z
---

# 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 | 1. [Create Virtual Account](docId:0_WvNy4epNJhRpjeRAkPU)
2. [Status Virtual Account](docId\:HcXAgUsfEe9W0jXOuzbPx)
3. [Cancel Virtual Account](docId\:lf7wy92j_2o1zw9aE2-MJ)                                                                                                                                        | [API Virtual Account SNAP](docId:_ejY3d54njez-a1p1EwOT)          |
| QRIS API                 | 1) [Create QRIS](docId\:xpoa8mTUgpO_2jALgZ3WX)
2) [Status QRIS](docId\:EvcOZwCaqViFBy1LpWU6U)
3) [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               | 1. [Registration Payout](docId:7WupBfr0NaTsBRMkG51Hb)
2. [Approve Payout](docId:4ZNy5Enixk3DPJAfCYFIE)
3. [Reject Payout](docId\:Q-VyQOnnWTisteRvnVcls)
4. [Inquiry Payout](docId:2YDhnR5ClEtjjOfuN3SrQ)
5. [Cancel Payout](docId\:WOZEQ8GXYBj8kwZIFlvvg)
6. [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.

1. Generate Access Token that will be used on Authorization part.
2. Fill in the available Header Parameter and Body Parameter form.
3. Press the Try It button to send the request parameter and get response parameter.
4. 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`

1. Construct `EncodeRequestBody` using payload, `HexEncode` dan `SHA256 Lowercase(HexEncode(SHA256(minify(RequestBody))))`
2. Construct payload signature concat at field using ":" separator
   `HTTPMethod:EndpointUrl:accessToken:EncodeRequestBody:TimeStamp`&#x20;

:::CodeblockTabs
1\. Sample URL

```none
POST:/api/v1.0/transfer-va/create-va:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJJT05QQVlURVNUIiwiaXNzIjoiTklDRVBBWSIsIm5hbWUiOiJQREpCIiwiZXhwIjoiMjAyNS0wNy0xMVQwMzoyODoxNVoifQ==.04XPQtQmHCnUyft4pgRCH_WTaRp8pt6aX8IugxX_7Hk=:0140cbc57524ee33d23ec6b520a6e3ffa966320fcbac5608716548648e65c4c5:2025-07-11T10:13:15+07:00;
```

2\. Sample Generate

```none
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("SHA256").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

```none
Sample Create Hash

SecretKeySpec secretKey = new SecretKeySpec(clientSecret.getBytes(),"HmacSHA512");
Mac hmac = Mac.getInstance("HmacSHA512")
hmac.init(secretKey)
```

4\. Sample signature base64

```none
Base64 encoder = Base64.getEncoder()
String hmacAsBase64 = 
encoder.encodeToString(hmac.doFinal(stringToSign.getBytes("UTF-8")))
```

5\. Sample Result

```none
The result are X-SIGNATURE : 3NP5zxeymUhesQwVoU7domG6bWRQKnp0ePsJ2Uc9bq1J7Yr5t+mKIYhCYGeoUGoS3CqIoFOvfXdutboAS7uGng==
```
:::

