---
title: Access Token B2B & B2B2C - Account Binding API E-Wallet (Direct Debit) SNAP
slug: nicepay-api-snap-access-token-b2b-b2b2c-account-binding-e-wallet-direct-debit
description: Informasi tentang Access Token B2B & B2B2C - Account Binding API E-Wallet (Direct Debit) SNAP yang terdapat pada sistem NICEPAY
image: https://archbee-image-uploads.s3.amazonaws.com/ZHvSjR5ZrsoxwKbJa3xmo/P7nzWYU9lU_OVt5tsPGwe_microsoftteams-image.png
icon: {"faIcon":"fa-solid fa-book"}
docTags: 
createdAt: 2025-05-22T04:13:29.502Z
---

# Tentang Access Token B2B & B2B2C - Account Binding API E-Wallet (Direct Debit) SNAP

***

Bagian ini berisi tentang rincian informasi terkait kebutuhan akses token API dengan standar SNAP digunakan agar dapat melakukan proses terkait B2B dan B2B2C.


Access Token B2B - Account Binding API E-Wallet (Direct Debit) SNAP
===================================================================

***

:::hint{type="info"}
Kunjungi halaman [Account Binding - API E-Wallet (Direct Debit) SNAP](docId\:jsV9P_nt63W2A27oRCy5U) untuk mengetahui alur mendapatkan akses token pada proses *account binding*.
:::

Access Token B2B digunakan oleh Merchant untuk menginisiasi proses transaksi dengan sistem NICEPAY.

| **Service Code** | `73`                                    |
| ---------------- | --------------------------------------- |
| **API Endpoint** | `/nicepay/v1.0/access-token/b2b`        |
| **Method**       | `POST`                                  |
| **Description**  | Get Access Token B2B Specification&#xD; |



## Request Header Parameter for Access Token B2B - Account Binding API E-Wallet (Direct Debit) SNAP

***

| **Parameter**  | **Tipe** | **Ukuran** | **Kebutuhan** | **Deskripsi**                                                                                                                                                                             |
| -------------- | -------- | ---------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Content-Type` | String   | Variable   | Mandatory     | `Application/Json`                                                                                                                                                                        |
| `X-TIMESTAMP`  | String   | Variable   | Mandatory     | `yyyy-MM-ddTHH:mm:ss.SSSTZD`&#xD;<br />(2022-03-21T10🕚40+07:00)                                                                                                                          |
| `X-CLIENT-KEY` | String   | Variable   | Mandatory     | NICEPAY Credential Client ID                                                                                                                                                              |
| `X-SIGNATURE`  | String   | Variable   | Mandatory     | `X-SIGNATURE`: created using asymmetric&#xD;<br />signature SHA256withRSA algorithm&#xD;<br />(`Private_Key`, `stringToSign`)&#xD;<br />`stringToSign `= client ID + “\|” + `X-TIMESTAMP` |



## Request Body Parameter for Access Token B2B - Account Binding API E-Wallet (Direct Debit) SNAP

***

| **Parameter**    | **Tipe**    | **Ukuran** | **Kebutuhan** | **Deskripsi**                            |
| ---------------- | ----------- | ---------- | ------------- | ---------------------------------------- |
| `grantType`      | String      | Variable   | Mandatory     | Grant Type Value: “`client_credentials`” |
| `additionalInfo` | JSON Object | Variable   | Mandatory     | Additional Information                   |



## Response Header Parameter for Access Token B2B - Account Binding API E-Wallet (Direct Debit) SNAP

***

| **Parameter**  | **Tipe** | **Ukuran** | **Kebutuhan** | **Deskripsi**                                                                                     |
| -------------- | -------- | ---------- | ------------- | ------------------------------------------------------------------------------------------------- |
| `Content-Type` | String   | Variable   | Mandatory     | Content type, value always `application/json`                                                     |
| `X-TIMESTAMP`  | String   | Variable   | Mandatory     | Transaction date time, in format `YYYY-MMDDTHH:mm:ss+07:00`. Time must be in GMT+7 (Jakarta time) |



## Response Body Parameter for Access Token B2B - Account Binding API E-Wallet (Direct Debit) SNAP

***

| **Parameter**     | **Tipe** | **Ukuran** | **Kebutuhan** | **Deskripsi**                                                     |
| ----------------- | -------- | ---------- | ------------- | ----------------------------------------------------------------- |
| `responseCode`    | String   | Variable   | Mandatory     | Refer to response code list                                       |
| `responseMessage` | String   | Variable   | Mandatory     | Debug message to provide information                              |
| `accessToken`     | String   | 2048       | Mandatory     | Token Authorization that NICEPAY used for Shopee Pay API Services |
| `tokenType`       | String   | Variable   | Mandatory     | Token Type Value: “Bearer”                                        |
| `expiresIn`       | String   | 3          | Mandatory     | Token Validate Time                                               |



## Sample Parameter for Access Token B2B - Account Binding API E-Wallet (Direct Debit) SNAP

***

### Request Parameter

:::CodeblockTabs
cURL

```curl
curl -X POST \
  'https://dev.nicepay.co.id/nicepay/v1.0/access-token/b2b' \
  -H 'Content-Type: application/json' \
  -H 'X-SIGNATURE: aFHq5SNdWO5Pq2vwZk4ztd9Cu3OvblG6NezGwLX3GC2mRJorDHPeZpR3V+RXrPC8ojcyCwQy01FSipmA8YdQvz1hOth7aekXzhigYCRNS34EHYEoFGD1YMHVFRvxn2Fu8HAd6wTvPNy2X2rbUS3hWrJsfa5cHu8wKVb7zPCuxNc=' \
  -H 'X-CLIENT-KEY: IONPAYTEST' \
  -H 'X-TIMESTAMP: 2024-01-31T10:11:40+07:00' \
  -d '{"grantType": "client_credentials", "additionalInfo": {}}'
```

Node.js

```nodejs
const config = {
  isProduction: false,
  privateKey: cons.privateKey,
  clientSecret: cons.clientSecret,
  clientId: "IONPAYTEST",
  isCloudServer: false,
  externalId: "eXid202402111402271707638098",
  timestamp: "2024-01-31T10:11:40+07:00",
};

const tokenBody = {
  "grantType ": "client_credentials",
  "additionalInfo": {}
};

let snap = new Snap(config);
let response = snap.requestSnapAccessToken(tokenBody);
```

```java
config = NICEPay.builder()
    .isProduction(false)
    .clientSecret("YOUR_CLIENT_SECRET")
    .partnerId("IONPAYTEST")
    .externalID("eXid202402111402271707638098")
    .timestamp("2024-01-31T10:11:40+07:00")
    .privateKey("YOUR_PRIVATE_KEY")
    .build();

AccessToken accessToken = AccessToken.builder()
    .grantType("client_credentials")
    .additionalInfo(new HashMap<>())
    .build();

NICEPayResponse result = SnapTokenService.callGetAccessToken(accessToken, config);
```

```python
bodyCreateToken = (
    builderAccessToken.BuildAccessToken()
    .setGrantType("client_credentials")
    .setAdditionalInfo({}) 
    .build()
)

environment = (builderEnvironment.BuildEnvironment()
                .isCloud(False)
                .isProduction(False)
                .build())

result = SnapService.serviceOAUTH(bodyCreateToken.jsonAccessToken(), environment)
```

C#

```csharp
const string CLIENT_ID = "IONPAYTEST";
const string X_TIMESTAMP = "2024-01-31T10:11:40+07:00";
const bool IS_PRODUCTION = false;
const bool IS_CLOUD_SERVER = false; 

// Generate signature using values directly
string signature = SignatureGeneratorUtils.GenerateSignature(config.PrivateKey, CLIENT_ID, X_TIMESTAMP);

// Get access token
var tokenRequester = new AccessTokenRequester();
string accessTokenResponse = await tokenRequester.GetAccessTokenAsync(CLIENT_ID, signature, X_TIMESTAMP, IS_PRODUCTION, IS_CLOUD_SERVER);
dynamic accessTokenObject = JObject.Parse(accessTokenResponse);
string accessToken = accessTokenObject.accessToken;
```

Laravel

```php
protected $useProd = false;
protected $useCloud = false;
protected $access_token_endpoint = "/nicepay/v1.0/access-token/b2b";
protected $client_id = "IONPAYTEST";
PROTECTED $key = "_PRIVATE_KEY_MERCHANT"; 

$url = HttpUtil::getNicepayDomain($this->useProd, $this->useCloud) . $this->access_token_endpoint;

$helper = new Helpers();
$x_time_stamp = "2024-01-31T10:11:40+07:00"; 
$client_id = $this->client_id;
$bd = [
   "grantType" => "client_credentials", 
    "additionalInfo" => new \stdClass()
];

$string_to_sign = $client_id . "|" . $x_time_stamp;
$signature = $helper->generateSignature($string_to_sign, $this->key, OPENSSL_ALGO_SHA256);

$header = $helper->generateHeaderAccessToken($x_time_stamp, $client_id, $signature);

try {
   $response = Http::withHeaders($header)->post($url, $bd);
} catch (Exception $e) {
    // Handle exception
}
```

PHP Native

```php
const string PARTNER_ID = "IONPAYTEST";
const string X_TIMESTAMP = "2024-01-31T10:11:40+07:00";
const string X_EXTERNAL_ID = "eXid202402111402271707638098"; 

$config = NICEPay::builder()
    ->setIsProduction(false)
    ->setPrivateKey("_YOUR_PRIVATE_KEY_")
    ->setClientSecret("_YOUR_CLIENT_SECRET_")
    ->setPartnerId(PARTNER_ID)
    ->setExternalID(X_EXTERNAL_ID)
    ->setTimestamp(X_TIMESTAMP)
    ->build();

$tokenBody = AccessToken::builder()
    ->setGrantType('client_credentials')
    ->setAdditionalInfo([])
    ->build();

$snap = new Snap($config);

try {
    $response = $snap->requestSnapAccessToken($tokenBody);
} catch (\Exception $e) {
    // Handle exception
}
```

```kotlin
const val PARTNER_ID = "IONPAYTEST"
const val EXTERNAL_ID = "eXid202402111402271707638098" // Used for general context consistency
const val TIMESTAMP = "2024-01-31T10:11:40+07:00"

// Step 1: Initialize the NICEPay Configuration
var config: NICEPay = NICEPay.Builder()
    .isProduction(false)
    .clientSecret("YOUR_CLIENT_SECRET") // Placeholder
    .partnerId(PARTNER_ID)
    .externalID(EXTERNAL_ID)
    .timestamp(TIMESTAMP)
    .privateKey("YOUR_PRIVATE_KEY") // Placeholder
    .build()

val service: SnapAccessTokenService = SnapAccessTokenServiceImpl()

// Step 2: Define the Access Token Request Body
val request = AccessToken.Builder()
    .grantType("client_credentials")
    .additionalInfo(emptyMap())
    .build()

// Step 3: Execute the Access Token Request
val response = service.getAccessToken(request, config)
```

CodeIgniter

```php
$config = NICEPay::builder()
    ->setIsProduction(false)
    ->setIsCloudServer(true)
    ->setPrivateKey($private_key)
    ->setClientSecret($client_secret)
    ->setPartnerId("IONPAYTEST")
    ->setExternalID("eXid202402111402271707638098")
    ->setTimestamp("2024-01-31T10:11:40+07:00")
    ->build();

$data = AccessToken::builder()
    ->setGrantType("client_credentials")
    ->setAdditionalInfo([])
    ->build();

$snap = new Snap($config);

$response = $snap->requestSnapAccessToken($data);
```
:::

### Response Parameter

:::CodeblockTabs
Sample Response

```json
{
  "responseCode": "2007300",
  "responseMessage": "Successful",
  "accessToken": "Xy8duZzAvv9bwDXxRxcb89tsuvk4MF4kx4lGfE4aCRVxR7XdERhbe1",
  "tokenType": "Bearer",
  "expiresIn": "900"
}
```
:::



# Access Token B2B2C  - Account Binding API E-Wallet (Direct Debit) SNAP

***

Access Token B2B2C digunakan oleh Merchant untuk menginisiasi proses transaksi Pelanggan menggunakan akun yang sudah terhubung pada sistem NICEPAY.

| **Service Code** | `74`                                      |
| ---------------- | ----------------------------------------- |
| **API Endpoint** | `/nicepay/api/v1.0/access-token/b2b2c`    |
| **Method**       | `POST`                                    |
| **Description**  | Get Access Token B2B2C Specification&#xD; |



## Request Header Parameter for  Access Token B2B2C - Account Binding API E-Wallet (Direct Debit) SNAP

| **Parameter**  | **Tipe** | **Ukuran** | **Kebutuhan** | **Deskripsi**                                                                                                                                                                               |
| -------------- | -------- | ---------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Content-Type` | String   | Variable   | Mandatory     | `Application/Json`                                                                                                                                                                          |
| `X-TIMESTAMP`  | String   | Variable   | Mandatory     | `yyyy-MM-ddTHH:mm:ss.SSSTZD`&#xD;<br />(2022-03-21T10🕚40+07:00)                                                                                                                            |
| `X-CLIENT-KEY` | String   | Variable   | Mandatory     | NICEPAY Credential Client ID                                                                                                                                                                |
| `X-SIGNATURE`  | String   | Variable   | Mandatory     | `X-SIGNATURE`: created using asymmetric&#xD;<br />signature `SHA256withRSA `algorithm&#xD;<br />(`Private_Key`, `stringToSign`)&#xD;<br />`stringToSign` = Client ID + “\|” + `X-TIMESTAMP` |



## Request Body Parameter for  Access Token B2B2C - Account Binding API E-Wallet (Direct Debit) SNAP

| **Parameter**        | **Tipe**    | **Ukuran** | **Kebutuhan** | **Deskripsi**                                                                                                                                                                                                                                                                        |
| -------------------- | ----------- | ---------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `grantType`          | String      | 32         | Mandatory     | Apply token request key type, can be `AUTHORIZATION_CODE` or `REFRESH_TOKEN`                                                                                                                                                                                                         |
| `authCode`           | String      | 256        | Conditional   | The authorization code received after the User provides the consent. Mandatory if `grantType` = `AUTHORIZATION_CODE`                                                                                                                                                                 |
| `refreshToken`       | String      | 512        | Conditional   | Refresh token to get a new `accessToken` where the User doesn't need to provide the consent again. Mandatory if `grantType` = `REFRESH_TOKEN`. Refresh Token should be less than access token validity and will be manage by the PJP’s application to generate a new `access_token`. |
| `additionalInfo`     | JSON Object | Variable   | Mandatory     | Additional information                                                                                                                                                                                                                                                               |
| `partnerReferenceNo` | String      | 40         | Mandatory     | Merchant transaction identifier from NICEPAY                                                                                                                                                                                                                                         |
| `mitraCd`            | String      | 4          | Mandatory     | NICEPAY Mitra Code&#xD;<br />`AstraPay` : `ASTR`&#xD;<br />`AlloBank` : `ALLO`                                                                                                                                                                                                       |



## Response Header Parameter for  Access Token B2B2C - Account Binding API E-Wallet (Direct Debit) SNAP

| **Parameter**  | **Tipe** | **Ukuran** | **Kebutuhan** | **Deskripsi**                                                                                          |
| -------------- | -------- | ---------- | ------------- | ------------------------------------------------------------------------------------------------------ |
| `Content-Type` | String   | Variable   | Mandatory     | Content type, value always `application/json`                                                          |
| `X-TIMESTAMP`  | String   | Variable   | Mandatory     | Transaction date time, in format `YYYY-MMDDTHH:mm:ss+07:00`. Time must be in GMT+7 (Jakarta time)&#xD; |



## Response Body Parameter for  Access Token B2B2C - Account Binding API E-Wallet (Direct Debit) SNAP

| **Parameter**            | **Tipe**    | **Ukuran** | **Kebutuhan** | **Deskripsi**                                                                                  |
| ------------------------ | ----------- | ---------- | ------------- | ---------------------------------------------------------------------------------------------- |
| `responseCode`           | String      | 7          | Mandatory     | Refer to response code list                                                                    |
| `responseMessage`        | String      | 40         | Mandatory     | Debug message to provide more information                                                      |
| `accessToken`            | String      | 50         | Mandatory     | Authorization in the form of a string given to the user and used to access protected resources |
| `tokenType`              | String      | 50         | Mandatory     | Bearer Token                                                                                   |
| `accessTokenExpiryTime`  | String      | 50         | Mandatory     | Access token valid time will be 15 days format ISO8601                                         |
| `refreshToken`           | String      | 50         | Mandatory     | Random string used by the user to get a new `accessToken` to access user data by format UUID   |
| `refreshTokenExpiryTime` | String      | 50         | Mandatory     | Time for the `refreshToken` to expire                                                          |
| `additionalInfo`         | JSON Object | Variable   | Mandatory     | Additional information                                                                         |
| `partnerReferenceNo`     | String      | 40         | Mandatory     | Merchant transaction identifier from NICEPAY                                                   |
| `referenceNo`            | String      | 40         | Mandatory     | NICEPAY Transaction ID                                                                         |
| `mitraCd`                | String      | 4          | Mandatory     | NICEPAY Mitra Code&#xD;<br />AstraPay : `ASTR`&#xD;<br />Allo Bank : `ALLO`                    |



## Sample Parameter for Access Token B2B2C - Account Binding API E-Wallet (Direct Debit) SNAP

***

### Request Parameter

:::CodeblockTabs
cURL

```curl
curl -X POST \
  'https://dev.nicepay.co.id/nicepay/v1.0/access-token/b2bc' \
  -H 'Content-Type: application/json' \
  -H 'X-SIGNATURE: aFHq5SNdWO5Pq2vwZk4ztd9Cu3OvblG6NezGwLX3GC2mRJorDHPeZpR3V+RXrPC8ojcyCwQy01FSipmA8YdQvz1hOth7aekXzhigYCRNS34EHYEoFGD1YMHVFRvxn2Fu8HAd6wTvPNy2X2rbUS3hWrJsfa5cHu8wKVb7zPCuxNc=' \
  -H 'X-CLIENT-KEY: IONPAYTEST' \
  -H 'X-TIMESTAMP: 2024-01-31T10:11:40+07:00' \
  -d '{"grantType":"AUTHORIZATION_CODE","authCode":"3p8Uuq0dkDBPagBvbFIo1QodNzZaJJXXITpL9mFRsWAS","refreshToken":"3911773a-d3ac-4b4f-8a6c-406c21d6883d","additionalInfo":{"partnerReferenceNo":"202208121451526358","mitraCd":"ASTR"}}'
```
:::

### Response Parameter

:::CodeblockTabs
Sample Response

```json
{
  "grantType": "AUTHORIZATION_CODE",
  "authCode": "3p8Uuq0dkDBPagBvbFIo1QodNzZaJJXXITpL9mFRsWAS",
  "refreshToken": "3911773a-d3ac-4b4f-8a6c-406c21d6883d",
  "additionalInfo": {
    "partnerReferenceNo": "202208121451526358",
    "mitraCd": "ASTR"
  }
}
```
:::

