# Embedded Wallet

## Integration Steps

Overview of integration process with DOKU Wallet SNAP.

1. [Requirement](#id-1.-requirement)
2. [Signature](#id-2.-signature)
3. [Token](#id-1.-token)&#x20;
   1. [B2B](#a.-token-b2b)
   2. [B2B2C](#b.-token-b2b2c)
4. [Account](#id-2.-account)
   1. [Account Creation ](#id-2.-account-creation)
   2. [Verify OTP ](#id-3.-verify-otp)
   3. [Request OTP](#b.-request-otp)
   4. [Account Binding](#id-4.-account-binding)&#x20;
   5. [Query Account Binding](#e.-query-account-binding)
   6. [Account Unbinding](#id-6.-account-unbinding)&#x20;
   7. [Balance Inquiry](#id-7.-balance-inquiry)&#x20;
5. [Authorize Payment And Capture](#id-3.-authorize-payment-and-capture)
   1. [Auth Payment](#a.-auth-payment)
   2. [Capture Payment](#b.-capture-payment)
   3. [Void Auth Payment](#c.-void-auth-payment)
6. [Purchase](#id-4.-purchase)
   1. [Purchase Web](#id-12.-purchase-web)&#x20;
   2. [Query Purchase](#id-13.-query-purchase)&#x20;
   3. [Cancel Purchase](#id-14.-cancel-purchase)&#x20;
   4. [Refund Purchase](#id-15.-refund-purchase)&#x20;
7. [Transaction History](#id-5.-transaction-history)
   1. [Transaction History List](#id-16.-transaction-history-list)&#x20;
   2. [Transaction History Detail](#id-17.-transaction-history-detail)
8. [Transfer](#id-6.-transfer)
   1. [Transfer Bank Account Inquiry](#id-8.-transfer-bank-account-inquiry)&#x20;
   2. [Transfer Bank Account Payment](#id-9.-transfer-bank-account-payment)
9. [Top Up](#id-7.-top-up)
   1. [Account Inquiry Top Up](#a.-account-inquiry-top-up)
   2. [Account Top Up](#id-10.-account-top-up)&#x20;
   3. [Query Top Up](#id-11.-query-top-up)&#x20;

***

## 1. Requirement

* DOKU Partner credential. This data is generated by DOKU Integration Team and is provided to you upon account activation.
* A website or application and test environment.
* A prior knowledge of web site or application programming is required.
* DOKU API has minimum requirements to run properly:
  * Dynamic language: Must use a language that supports a dynamic environment. Cannot be plain HTML.
  * Language: Can use any kind of web-enabled language such as Apache PHP, Microsoft ASP, Adobe ColdFusion, Sun Java, Ruby on Rails.
  * Frameworks: Virtually can use many of the different frameworks available such as CodeIgniter, Spring, etc.
  * Capable of using both the HTTP Method GET and POST.
  * Database: Any kind of database available in the market that supports basic SQL Statements.

## 2. Signature

X-Signature are one of header components that partners need to send

### X-Signature ONLY for Get Token B2B and B2B2C

| X-SIGNATURE = SHA256withRSA(PrivateKey, StringToSign) |
| ----------------------------------------------------- |

* SHA256withRSA is used to generate the signature with your Private Key.&#x20;
* Generate StringToSign: `StringToSign = client_ID+"|"+X-TIMESTAMP`

### X-Signature for Others API B2B / B2B2C

| X-SIGNATURE = HMAC-SHA512(ClientSecret, StringToSign) |
| ----------------------------------------------------- |

* SHA-512 HMAC is used to generate the signature with your Client Secret.
* Generate stringToSign: `HTTPMethod + ”:“+ EndpointUrl +":"+ B2BAccessToken + ":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + ":“ + X-TimeStamp`

***

## 3. Token

Before partners can access SNAP API DOKU, a partner must request a B2B / B2B2C token. Token B2B / B2B2C session expired 900s (access token will continue to be used as long as there is activity request API from a partners to DOKU), but when partners request access token B2B / B2B2C more than one element before time limit expired, the latest access token B2B / B2B2C will be processed.

### a. Token B2B

Token B2B used all SNAP API DOKU.

{% hint style="warning" %}
Note: when you try to access another API with an access token that has already expired, you must re-sign on to get a new access token.
{% endhint %}

## POST /authorization/v1/access-token/b2b

> POST authorization/v1/access-token/b2b

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/authorization/v1/access-token/b2b":{"post":{"tags":["Token"],"summary":"POST authorization/v1/access-token/b2b","operationId":"b2b","parameters":[{"name":"X-CLIENT-KEY","in":"header","required":true,"schema":{"type":"string"},"description":"Credential partner from DOKU"},{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"Algorithm symmetric signature SHA256withRSA(PrivateKey, StringToSign) SHA256withRSA is used to generate the signature with your Private Key. Generate StringToSign : StringToSign = client_ID+\"|\"+X-TIMESTAMP"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/B2bRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/B2bResponse"}}}}}}}},"components":{"schemas":{"B2bRequest":{"type":"object","required":["grantType"],"properties":{"grantType":{"type":"string","description":"Grant type for get access token B2B\""}}},"B2bResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"accessToken":{"type":"string"},"tokenType":{"type":"string"},"expiresIn":{"type":"string"},"additionalInfo":{"type":"string"}}}}}}
```

### b. Token B2B2C

Token B2B2C is used for all SNAP API DOKU that involve customers for transaction activity.

## POST /authorization/v1/access-token/b2b2c

> POST authorization/v1/access-token/b2b2c

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/authorization/v1/access-token/b2b2c":{"post":{"tags":["Token"],"summary":"POST authorization/v1/access-token/b2b2c","operationId":"b2b2c","parameters":[{"name":"X-CLIENT-KEY","in":"header","required":true,"schema":{"type":"string"},"description":"Credential partner from DOKU"},{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"Algorithm symmetric signature SHA256withRSA(PrivateKey, StringToSign) SHA256withRSA is used to generate the signature with your Private Key. Generate StringToSign : StringToSign = client_ID+\"|\"+X-TIMESTAMP"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/B2b2cRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/B2b2cResponse"}}}}}}}},"components":{"schemas":{"B2b2cRequest":{"type":"object","required":["grantType","authCode"],"properties":{"grantType":{"type":"string","description":"Grant type for get access token B2B2C"},"authCode":{"type":"string","description":"Authorization code that you get from redirect url after user login and consent"}}},"B2b2cResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"accessToken":{"type":"string"},"tokenType":{"type":"string"},"accessTokenExpiryTime":{"type":"string"},"refreshToken":{"type":"string"},"refreshTokenExpiryTime":{"type":"string"},"additionalInfo":{"type":"string"}}}}}}
```

## 4. Account

### a. Account Creation

At this stage is the process for registering a new account, where after a successful registration process the customer will get a DOKU ID that is unique among customers to one another.

For account creation complete partners need to request to 3 API:

1. [Account Creation](#post-snap-adapter-b2b-v1.0-registration-account-creation): Pre registration account data
2. [Verify OTP](#post-snap-adapter-b2b-v1.0-otp-verification): Validate account data with OTP ( User Interface provided by partners )
3. [Binding Account](#post-snap-adapter-b2b-v1.0-registration-account-binding): Binding account with partners and get B2BB2C / Authorization-Customer for payment

{% hint style="info" %}
**Notes**

DOKU will send OTP directly to mobile phone customers from request Account Creation.&#x20;
{% endhint %}

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FOuR44yReaYo6L4E2IDKN%2FAPI%20-%20Account%20Creation.png?alt=media&#x26;token=65022e8c-0da2-4bc2-a57a-39167568c6ee" alt=""><figcaption><p>Account Creation Flow Diagram</p></figcaption></figure></div>

## POST /snap-adapter/b2b/v1.0/registration-account-creation

> POST snap-adapter/b2b/v1.0/registration-account-creation

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b/v1.0/registration-account-creation":{"post":{"tags":["Account Creation"],"summary":"POST snap-adapter/b2b/v1.0/registration-account-creation","operationId":"registration-account-creation","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountCreationRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/accountCreation"}}}}}}}},"components":{"schemas":{"AccountCreationRequest":{"type":"object","required":["partnerReferenceNo","name","phoneNo","email","redirectUrl"],"properties":{"partnerReferenceNo":{"type":"string"},"name":{"type":"string"},"phoneNo":{"type":"string"},"email":{"type":"string"},"redirectUrl":{"type":"string"}}},"accountCreation":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"}}}}}}
```

### b.  Request OTP

With this API partners can request new OTP when customer OTP has expired. OTP expired time 5 Minutes

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2Fw9R9xgcwdu4P6grIXAev%2FAPI%20-%20Request%20OTP.png?alt=media&#x26;token=c93484f1-d7ca-4623-afbe-7ad8d16a0fe0" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b/v1.0/otp

> POST snap-adapter/b2b/v1.0/otp

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b/v1.0/otp":{"post":{"tags":["Request OTP"],"summary":"POST snap-adapter/b2b/v1.0/otp","operationId":"sent-otp","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/sentOtpRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/sentOtpResponse"}}}}}}}},"components":{"schemas":{"sentOtpRequest":{"type":"object","required":["partnerReferenceNo","bankCardToken","journeyID"],"properties":{"partnerReferenceNo":{"type":"string","maxLength":64,"description":"Activity ID partners from request Account Creation / Account Unbinding"},"bankCardToken":{"type":"string","maxLength":128,"description":"DOKU"},"journeyID":{"type":"string","maxLength":32,"description":"An identifier to uniquly identify a journey. On the first request of the journey, this must be equal to the X-EXTERNAL-ID."},"additionalInfo":{"type":"object","description":"Additional Information","required":["deviceId","channel"],"properties":{"deviceId":{"type":"string","description":"ID Device user"},"channel":{"type":"string","description":"Platform user using ( mobile, desktop, etc )"}}}}},"sentOtpResponse":{"type":"object","properties":{"responseCode":{"type":"string","description":"Respond Code for Result API"},"responseMessage":{"type":"string","description":"Detailed Response Message"},"partnerReferenceNo":{"type":"string","description":"Activity ID from partners"},"referenceNo":{"type":"string","description":"Activity ID from DOKU"},"chargeToken":{"type":"string","description":"String code for verification OTP"},"additionalInfo":{"type":"object","description":"Additional Information","required":["deviceId","channel"],"properties":{"deviceId":{"type":"string","description":"ID Device user"},"channel":{"type":"string","description":"Platform user using ( mobile, desktop, etc )"}}}}}}}}
```

### c.  Verify OTP

Partners use API Verify OTP when user input OTP on partner side, this activity is required when we need to validate the account, example on flow journey [Account Creation](#a.-account-creation) and [Account Unbinding](#f.-account-unbinding).

{% hint style="info" %}
**Notes**

1. For Account Creation, partners need to redirect user to Create PIN page, URL (`qparamsURL?action=action`) from Response Verify OTP&#x20;
2. Account ID will be info to redirectUrl from request Account Creation, example below:

   `htttp://partnerweb.com/registerdoku/?accountId=1140340010&partnerReferenceNo=f1a69bce-41bc-4abd-8c5c -01910574e404&status=SUCCESS`
   {% endhint %}

## POST /snap-adapter/b2b/v1.0/otp-verification

> POST snap-adapter/b2b/v1.0/otp-verification

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b/v1.0/otp-verification":{"post":{"tags":["Verify OTP"],"summary":"POST snap-adapter/b2b/v1.0/otp-verification","operationId":"otp-verification","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpResponse"}}}}}}}},"components":{"schemas":{"OtpRequest":{"type":"object","required":["originalPartnerReferenceNo","originalReferenceNo","otp","additionalInfo"],"properties":{"originalPartnerReferenceNo":{"type":"string","description":"Activity ID partners from request AccountCreation"},"originalReferenceNo":{"type":"string","description":"Activity ID DOKU from respond AccountCreation"},"otp":{"type":"string","description":"One Time Password entered by the user"},"additionalInfo":{"type":"object","required":["deviceId"],"properties":{"deviceId":{"type":"string","description":"ID Device user"}}}}},"OtpResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"originalPartnerReferenceNo":{"type":"string"},"originalReferenceNo":{"type":"string"},"email":{"type":"string"},"phoneNo":{"type":"string"},"sendOtpFlag":{"type":"string"},"additionalInfo":{"type":"object","required":["deviceId"],"properties":{"deviceId":{"type":"string"}}},"qparamsURL":{"type":"string"},"qparams":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}}}}
```

### d. Account Binding

Account Binding is flow to bind DOKU Wallet accounts to partner for get authCode (B2BB2C / Authorization-Customer for payment purposes)

{% hint style="info" %}
**Notes**

Auth Code will be info to redirectUrl from request example below:&#x20;

`htttp://partnerweb.com/registerdoku/?authCode=9301a29e-60d6-4f68-ab92-7d3d61617233&partnerReferenceNo=478c40b2-e8af-49ed-bd6c-c36aa3a27ef7&status=SUCCESS`
{% endhint %}

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FZO8glpAm9FH73RgHeq81%2FAPI%20-%20Account%20Binding.png?alt=media&#x26;token=dfe00f72-b469-486d-b666-56d96e302255" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b/v1.0/registration-account-binding

> POST snap-adapter/b2b/v1.0/registration-account-binding

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b/v1.0/registration-account-binding":{"post":{"tags":["Account Binding"],"summary":"POST snap-adapter/b2b/v1.0/registration-account-binding","operationId":"registration-account-binding","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountBindingRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountBindingResponse"}}}}}}}},"components":{"schemas":{"AccountBindingRequest":{"type":"object","required":["partnerReferenceNo","redirectUrl","successParams","accountId"],"properties":{"partnerReferenceNo":{"type":"string","description":"Activity ID partners from request AccountCreation"},"redirectUrl":{"type":"string","description":"Partner URL when user finish binding"},"successParams":{"type":"object","required":["accountId"],"properties":{"accountId":{"type":"string","description":"Account ID of customer from DOKU"}}}}},"AccountBindingResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"linkId":{"type":"string"},"nextAction":{"type":"string"},"redirectUrl":{"type":"string"},"userInfo":{"type":"object","required":["publicUserId"],"properties":{"publicUserId":{"type":"string"}}}}}}}}
```

### e. Query Account Binding

This API to check the binding status of an account.

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2Fqy7PY6ietoFL12YDxgbW%2FAPI%20-%20Query%20Account%20Binding.png?alt=media&#x26;token=4a06a612-cc06-4ec7-bd99-513605822850" alt=""><figcaption></figcaption></figure></div>

#### Additional Info

The authcode can be found in the account binding inquiry API response. The value will be in the form of cipher text which is the result of encryption using AES-1. To get the raw text, partners need to encrypt the authCode obtained from the API. From the partner side, there are 2 values ​​that will be used:

1. cipherText: authCode obtained from the account inquiry response
2. secretKey: key provided by DOKU

To decrypt it, we need to create a Cipher instance to decrypt with AES and decode the cipherText using BASE64Decoder. Here's the sample code :

* **Convert secretKey from String to bytes**

<details>

<summary>See code</summary>

`public static String decryptInputKey(String cipherText, String secretKey) throws Exception {byte[] keyBytes = secretKey.getBytes();}`

</details>

* **Create a cryptographic key from the secret key**

<details>

<summary>See code</summary>

`Key key = new SecretKeySpec(keyBytes, “AES”);`

</details>

* **Create a Cipher instance for AES**

<details>

<summary>See code</summary>

`Cipher c = Cipher.getInstance(“AES”);`

</details>

**Set Cipher to decrypt with secretKey**

<details>

<summary>See code</summary>

`c.init(2, key);`

</details>

**Decode cipherText to bytes**

<details>

<summary>See code</summary>

`byte[] decodedCipherText = (new BASE64Decoder()).decodeBuffer(cipherText);`

</details>

**Decrypt cipher text**

<details>

<summary>See code</summary>

`byte[] decValue = c.doFinal(decodedCipherText);`

</details>

**Convert rawText from bytes to String**

<details>

<summary>See code</summary>

`return new String(decValue);`

</details>

## POST /snap-adapter/b2b/v1.0/registration-account-inquiry

> POST snap-adapter/b2b/v1.0/registration-account-inquiry

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b/v1.0/registration-account-inquiry":{"post":{"tags":["Account Inquiry"],"summary":"POST snap-adapter/b2b/v1.0/registration-account-inquiry","operationId":"registration-account-inquiry","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInquiryRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountInquiryResponse"}}}}}}}},"components":{"schemas":{"AccountInquiryRequest":{"type":"object","required":["partnerReferenceNo","additionalInfo"],"properties":{"partnerReferenceNo":{"type":"string","description":"Identifier activity ID from partners"},"additionalInfo":{"type":"object","required":["accountId"],"properties":{"accountId":{"type":"string","description":"Account ID of customer from DOKU ( DOKUID / Phone no / email )"}}}}},"AccountInquiryResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"accountNo":{"type":"string"},"additionalInfo":{"type":"object","required":["linkId","remarks","authCode","merchantId"],"properties":{"linkId":{"type":"string"},"remarks":{"type":"string"},"authCode":{"type":"string"},"merchantId":{"type":"string"}}}}}}}}
```

### f. Account Unbinding

This is the process when customers want to unbinding their DOKU account from merchants. To complete the unbinding account process OTP must send to API [Verify OTP](#c.-verify-otp).

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FZ0rktJCttPxMNXDBaMMK%2FAPI%20-%20Account%20Unbinding.png?alt=media&#x26;token=4f64b597-b96a-4748-aa1b-57cff662acdb" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b/v1.0/registration-account-unbinding

> POST snap-adapter/b2b/v1.0/registration-account-unbinding

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b/v1.0/registration-account-unbinding":{"post":{"tags":["Account Unbinding"],"summary":"POST snap-adapter/b2b/v1.0/registration-account-unbinding","operationId":"registration-account-unbinding","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountUnbindingRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountUnbindingResponse"}}}}}}}},"components":{"schemas":{"AccountUnbindingRequest":{"type":"object","required":["partnerReferenceNo","linkId","merchantId","additionalInfo"],"properties":{"partnerReferenceNo":{"type":"string","description":"Identifier activity ID from partners"},"linkId":{"type":"string","description":"Identifier provided from Account Binding"},"merchantId":{"type":"string","description":"Credential client ID from DOKU"},"additionalInfo":{"type":"object","required":["deviceId","channel","phoneNo"],"properties":{"deviceId":{"type":"string","description":"ID Device user"},"channel":{"type":"string","description":"Platform user using ( mobile, desktop, etc )"},"phoneNo":{"type":"string","description":"Phone number of customer"}}}}},"AccountUnbindingResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"merchantId":{"type":"string"},"linkId":{"type":"string"},"unlinkResult":{"type":"string"},"additionalInfo":{"type":"object","required":["channel","deviceId","phoneNo"],"properties":{"channel":{"type":"string"},"deviceId":{"type":"string"},"phoneNo":{"type":"string"}}}}}}}}
```

### g. Balance Inquiry

With this API, partners can check for customer balance that has been verified by DOKU, so that partners can equate customer data, between partners and DOKU.

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2Feh4sR8MtDtFKc3kHoNZX%2FAPI%20-%20Balance%20Inquiry.png?alt=media&#x26;token=a363a4c1-882d-4ffe-b315-ce785f916003" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/balance-inquiry

> POST snap-adapter/b2b2c/v1.0/balance-inquiry

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/balance-inquiry":{"post":{"tags":["Balance Inquiry"],"summary":"POST snap-adapter/b2b2c/v1.0/balance-inquiry","operationId":"balance-inquiry","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceInquiryRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceInquiryResponse"}}}}}}}},"components":{"schemas":{"BalanceInquiryRequest":{"type":"object","required":["partnerReferenceNo"],"properties":{"partnerReferenceNo":{"type":"string"}}},"BalanceInquiryResponse":{"type":"object","properties":{"responseCode":{"type":"string","description":"Respond Code for Result API"},"responseMessage":{"type":"string","description":"Detailed Response Message"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"accountNo":{"type":"string"},"name":{"type":"string"},"accountInfo":{"type":"object","required":["balanceType","amount"],"properties":{"balanceType":{"type":"string"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}}}}}}}}}
```

## 5. Authorize Payment and Capture

### a. Auth Payment

Enables partners to authorize payments without immediate capture. This API is ideal for scenarios where payment verification is required before final processing.

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2F18Vh0YUnw1USTmbsG0VR%2FAPI%20-%20Authorize%20Payment.png?alt=media&#x26;token=30c05ad3-7610-4764-a415-ad63e25a1851" alt=""><figcaption></figcaption></figure></div>

## Authorize a payment

> Endpoint to authorize a payment transaction.

```json
{"openapi":"3.0.3","info":{"title":"dw-core-system api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/dw/b2b2c/v1.0/auth/payment":{"post":{"tags":["SNAP"],"summary":"Authorize a payment","description":"Endpoint to authorize a payment transaction.","operationId":"authorizePayment","parameters":[{"$ref":"#/components/parameters/snapXPartnerId"},{"$ref":"#/components/parameters/snapXTimeStamp"},{"$ref":"#/components/parameters/snapXSignature"},{"$ref":"#/components/parameters/snapXExternalId"},{"$ref":"#/components/parameters/snapAuthorization"},{"$ref":"#/components/parameters/snapAuthorizationCustomer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerReferenceNo":{"$ref":"#/components/schemas/partnerReferenceNo"},"merchantId":{"$ref":"#/components/schemas/merchantId"},"amount":{"type":"string"},"mcc":{"$ref":"#/components/schemas/mcc"},"items":{"$ref":"#/components/schemas/items"}}}}}},"responses":{"200":{"description":"Payment authorized successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"responseCode":{"$ref":"#/components/schemas/responseCode"},"responseMessage":{"$ref":"#/components/schemas/responseMessage"},"referenceNo":{"$ref":"#/components/schemas/referenceNo"},"partnerReferenceNo":{"$ref":"#/components/schemas/partnerReferenceNo"},"amount":{"type":"string"},"paidTime":{"$ref":"#/components/schemas/paidTime"},"additionalInfo":{"$ref":"#/components/schemas/additionalInfo"}}}}}},"400":{"description":"Bad request."},"500":{"description":"Internal server error."}}}}},"components":{"parameters":{"snapXPartnerId":{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"client_ID or Partner_ID from DOKU"},"snapXTimeStamp":{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string","format":"date-time"},"description":"Client's current local time in yyyy-MM- ddTHH:mm:ssTZD format"},"snapXSignature":{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"Algorithm symmetric signature HMAC_SHA512 (clientSecret, stringToSign)"},"snapXExternalId":{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day (request-id)"},"snapAuthorization":{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B "},"snapAuthorizationCustomer":{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}},"schemas":{"partnerReferenceNo":{"type":"string","maxLength":64,"required":true,"description":"Partner's reference number for the transaction."},"merchantId":{"type":"string","maxLength":22,"required":true,"description":"Unique ID for a partner (DOKU'S Client ID)"},"mcc":{"type":"string","required":false,"description":"Merchant category code."},"items":{"type":"array","required":false,"items":{"type":"object","properties":{"goodsId":{"type":"string","description":"Goods ID.","required":true},"price":{"type":"object","properties":{"value":{"type":"string","required":true,"description":"Price of the item."},"currency":{"type":"string","minLength":3,"maxLength":3,"required":true,"description":"Currency of the price."}}},"category":{"type":"string","required":true,"description":"Category of the item."},"unit":{"type":"string","description":"Unit of measurement.","required":true},"quantity":{"type":"number","required":true,"description":"Quantity of the item."}}}},"responseCode":{"type":"string","description":"Response code indicating status of transaction.","maxLength":7,"minLength":7},"responseMessage":{"type":"string","description":"Response description.","maxLength":150},"referenceNo":{"type":"string","maxLength":64,"required":true,"description":"DOKU reference number that only filled upon successful transaction."},"paidTime":{"type":"string","format":"date-time","maxLength":25,"description":"Transaction paid time. Format paid time : (ISO 8601) YYYY-MM-DDThh:mm:ss"},"additionalInfo":{"type":"object","required":false,"properties":{"deviceId":{"type":"string","description":"Device ID."},"channel":{"type":"string","description":"Transaction channel."}}}}}}
```

### b. Capture Payment

Enables partners to Capture payments after Authorize Payment. When Split Settlement Rules are defined, then the capture amount can be transferred to DOKU ID

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2F50Re4YQ8tOWu2udcH4nk%2FAPI%20-%20Capture%20Payment.png?alt=media&#x26;token=97fdb385-d02e-4a4e-b662-1534bd43a9ac" alt=""><figcaption></figcaption></figure></div>

## Capture a payment

> Endpoint to capture a payment transaction.

```json
{"openapi":"3.0.3","info":{"title":"dw-core-system api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/dw/b2b2c/v1.0/auth/capture":{"post":{"tags":["SNAP"],"summary":"Capture a payment","description":"Endpoint to capture a payment transaction.","operationId":"capturePayment","parameters":[{"$ref":"#/components/parameters/snapXPartnerId"},{"$ref":"#/components/parameters/snapXTimeStamp"},{"$ref":"#/components/parameters/snapXSignature"},{"$ref":"#/components/parameters/snapXExternalId"},{"$ref":"#/components/parameters/snapAuthorization"},{"$ref":"#/components/parameters/snapAuthorizationCustomer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["originalReferenceNo","originalPartnerReferenceNo","merchantId","partnerCaptureNo","captureAmount","title"],"properties":{"originalReferenceNo":{"$ref":"#/components/schemas/referenceNo"},"originalPartnerReferenceNo":{"$ref":"#/components/schemas/partnerReferenceNo"},"merchantId":{"$ref":"#/components/schemas/merchantId"},"partnerCaptureNo":{"$ref":"#/components/schemas/partnerCaptureNo"},"captureAmount":{"$ref":"#/components/schemas/captureAmount"},"title":{"$ref":"#/components/schemas/title","description":"Capture title"},"lastCapture":{"type":"boolean","description":"Goods ID."},"additionalInfo":{"allOf":[{"type":"object","properties":{"splitSettlementRules":{"$ref":"#/components/schemas/splitSettlementRules"}}}]}}}}}},"responses":{"200":{"description":"Payment capture successfully.","content":{"application/json":{"schema":{"type":"object","required":["responseCode","responseMessage","captureAmount"],"properties":{"responseCode":{"type":"string"},"responseMessage":{"$ref":"#/components/schemas/responseMessage"},"originalReferenceNo":{"$ref":"#/components/schemas/referenceNo"},"originalPartnerReferenceNo":{"$ref":"#/components/schemas/partnerReferenceNo"},"captureAmount":{"type":"string"},"captureTime":{"$ref":"#/components/schemas/paidTime"},"additionalInfo":{"$ref":"#/components/schemas/additionalInfo"}}}}}},"400":{"description":"Bad request."},"500":{"description":"Internal server error."}}}}},"components":{"parameters":{"snapXPartnerId":{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"client_ID or Partner_ID from DOKU"},"snapXTimeStamp":{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string","format":"date-time"},"description":"Client's current local time in yyyy-MM- ddTHH:mm:ssTZD format"},"snapXSignature":{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"Algorithm symmetric signature HMAC_SHA512 (clientSecret, stringToSign)"},"snapXExternalId":{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day (request-id)"},"snapAuthorization":{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B "},"snapAuthorizationCustomer":{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}},"schemas":{"referenceNo":{"type":"string","maxLength":64,"required":true,"description":"DOKU reference number that only filled upon successful transaction."},"partnerReferenceNo":{"type":"string","maxLength":64,"required":true,"description":"Partner's reference number for the transaction."},"merchantId":{"type":"string","maxLength":22,"required":true,"description":"Unique ID for a partner (DOKU'S Client ID)"},"partnerCaptureNo":{"type":"string","maxLength":64,"required":true,"description":"Capture identifier generated by the partner / merchant."},"captureAmount":{"type":"object","properties":{"value":{"type":"string","required":true,"description":"Capture amount may differ with previous authorized amount."},"currency":{"type":"string","minLength":3,"maxLength":3,"required":true,"description":"Transaction currency code (ISO-4217)."}}},"title":{"type":"string","required":false,"description":"Title or description of the product."},"splitSettlementRules":{"type":"object","properties":{"routes":{"type":"array","items":{"type":"object","properties":{"destinationType":{"type":"string","enum":["DOKU_WALLET","DOKU_WAAS","SETTLEMENT_BANK_ACCOUNT"],"description":"target split settlement type should be one of the enum values"},"destinationAccount":{"type":"string","maxLength":32,"description":"the account number or id on behalf of your business"},"partnerReferenceNo":{"type":"string","maxLength":64,"description":"Partner's reference number for the transaction"},"remark":{"type":"string","maxLength":128,"description":"will be use as bill statement on mutation balance"},"amount":{"allOf":[{"type":"object","properties":{"type":{"type":"string","enum":["FIX","PERCENTAGE"],"description":"type of transfer amount, the default value is FIX"}}},{"$ref":"#/components/schemas/amount"}]}}}}}},"amount":{"type":"object","properties":{"value":{"type":"string","required":true,"description":"Transaction amount."},"currency":{"type":"string","minLength":3,"maxLength":3,"required":true,"description":"Transaction currency code (ISO-4217)."}}},"responseMessage":{"type":"string","description":"Response description.","maxLength":150},"paidTime":{"type":"string","format":"date-time","maxLength":25,"description":"Transaction paid time. Format paid time : (ISO 8601) YYYY-MM-DDThh:mm:ss"},"additionalInfo":{"type":"object","required":false,"properties":{"deviceId":{"type":"string","description":"Device ID."},"channel":{"type":"string","description":"Transaction channel."}}}}}}
```

### c. Void Auth Payment

Enable Customer to Cancel order by using Void Auth Payment API, Authorized Amount will be released to Active Balance to be used in the next transaction.

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FI6adnw6r3WxO4BDk7Ysh%2FAPI%20-%20Void%20Auth%20Payment.png?alt=media&#x26;token=bd7e128e-59e6-48ba-ae34-e1042bc7fa50" alt=""><figcaption></figcaption></figure></div>

## Void Authorization payment

> Endpoint to Cancel Void payment transaction.

```json
{"openapi":"3.0.3","info":{"title":"dw-core-system api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/dw/b2b2c/v1.0/auth/void":{"post":{"tags":["SNAP"],"summary":"Void Authorization payment","description":"Endpoint to Cancel Void payment transaction.","operationId":"voidAuthorization","parameters":[{"$ref":"#/components/parameters/snapXPartnerId"},{"$ref":"#/components/parameters/snapXTimeStamp"},{"$ref":"#/components/parameters/snapXSignature"},{"$ref":"#/components/parameters/snapXExternalId"},{"$ref":"#/components/parameters/snapAuthorization"},{"$ref":"#/components/parameters/snapAuthorizationCustomer"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["originalReferenceNo","originalPartnerReferenceNo","merchantId","partnerVoidNo","voidAmount"],"properties":{"originalReferenceNo":{"$ref":"#/components/schemas/referenceNo"},"originalPartnerReferenceNo":{"$ref":"#/components/schemas/partnerReferenceNo"},"merchantId":{"$ref":"#/components/schemas/merchantId"},"partnerVoidNo":{"$ref":"#/components/schemas/partnerVoidNo"},"reason":{"$ref":"#/components/schemas/reason"}}}}}},"responses":{"200":{"description":"void successfully.","content":{"application/json":{"schema":{"type":"object","required":["responseCode","responseMessage","originalReferenceNo","originalPartnerReferenceNo","voidNo","partnerVoidNo","voidAmount","voidTime"],"properties":{"responseCode":{"type":"string"},"responseMessage":{"$ref":"#/components/schemas/responseMessage"},"originalReferenceNo":{"$ref":"#/components/schemas/referenceNo"},"originalPartnerReferenceNo":{"$ref":"#/components/schemas/partnerReferenceNo"},"voidNo":{"$ref":"#/components/schemas/voidNo"},"partnerVoidNo":{"$ref":"#/components/schemas/partnerVoidNo"},"voidAmount":{"$ref":"#/components/schemas/voidAmount"},"voidTime":{"$ref":"#/components/schemas/voidTime"}}}}}},"400":{"description":"Bad request."},"500":{"description":"Internal server error."}}}}},"components":{"parameters":{"snapXPartnerId":{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"client_ID or Partner_ID from DOKU"},"snapXTimeStamp":{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string","format":"date-time"},"description":"Client's current local time in yyyy-MM- ddTHH:mm:ssTZD format"},"snapXSignature":{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"Algorithm symmetric signature HMAC_SHA512 (clientSecret, stringToSign)"},"snapXExternalId":{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day (request-id)"},"snapAuthorization":{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B "},"snapAuthorizationCustomer":{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}},"schemas":{"referenceNo":{"type":"string","maxLength":64,"required":true,"description":"DOKU reference number that only filled upon successful transaction."},"partnerReferenceNo":{"type":"string","maxLength":64,"required":true,"description":"Partner's reference number for the transaction."},"merchantId":{"type":"string","maxLength":22,"required":true,"description":"Unique ID for a partner (DOKU'S Client ID)"},"partnerVoidNo":{"type":"string","maxLength":64,"required":true,"description":"Void identifier generated by the partner / merchant."},"reason":{"type":"string","description":"reason cancel of transaction.","maxLength":150},"responseMessage":{"type":"string","description":"Response description.","maxLength":150},"voidNo":{"type":"string","maxLength":64,"required":true,"description":"Void Number identifier generated by DOKU."},"voidAmount":{"type":"object","properties":{"value":{"type":"string","required":true,"description":"Void amount may differ with previous authorized amount."},"currency":{"type":"string","minLength":3,"maxLength":3,"required":true,"description":"Transaction currency code (ISO-4217)."}}},"voidTime":{"type":"string","format":"date-time","maxLength":25,"description":"Transaction paid time. Format paid time : (ISO 8601) YYYY-MM-DDThh:mm:ss"}}}}
```

## 6. Purchase

Partners can provide an online payment facility using PIN authentication that can facilitate customers in making the transaction at any merchant that has been integrated. DOKU will provide a webview payment page to input the PIN and proceed with the payment.

### a. Purchase Web

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FH7F6KuwixpWulKUE1kUd%2FAPI%20-%20Purchase%20Web.png?alt=media&#x26;token=f84cbfa6-8113-4639-8a0c-4a964eae02d2" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/debit/payment-host-to-host

> POST snap-adapter/b2b2c/v1.0/debit/payment-host-to-host

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/debit/payment-host-to-host":{"post":{"tags":["Purchase Web"],"summary":"POST snap-adapter/b2b2c/v1.0/debit/payment-host-to-host","operationId":"payment-host-to-host","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseWebRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseWebResponse"}}}}}}}},"components":{"schemas":{"PurchaseWebRequest":{"type":"object","required":["partnerReferenceNo","chargeToken","amount","urlParam","merchantId","additionalInfo"],"properties":{"partnerReferenceNo":{"type":"string","description":"Transaction ID from partners"},"chargeToken":{"type":"string","description":"Charge token for the transaction"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string","description":"Net amount of the transaction. If it's IDR then value includes 2 decimal digits.e.g. IDR 10.000,- will be placed with 10000.00 with 2 decimal"},"currency":{"type":"string","description":"Default “IDR”"}}},"urlParam":{"type":"array","description":"Partner URL when user finish payment","items":{"type":"object","required":["url","type","isDeepLink"],"properties":{"url":{"type":"string"},"type":{"type":"string"},"isDeepLink":{"type":"string"}}}},"merchantId":{"type":"string"},"additionalInfo":{"type":"object","required":["basket"],"properties":{"basket":{"type":"array","items":{"type":"object","required":["name","price","qty","total"],"properties":{"name":{"type":"string"},"price":{"type":"number"},"qty":{"type":"number"},"total":{"type":"number"}}}},"promoCode":{"type":"string"}}}}},"PurchaseWebResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"webRedirectUrl":{"type":"string"},"additionalInfo":{"type":"object","required":["dokuId"],"properties":{"dokuId":{"type":"string"}}}}}}}}
```

### b. Query Purchase

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FHKMGirUBk1e3ZxzGQqMY%2FAPI%20-%20Query%20Purchase.png?alt=media&#x26;token=679da1a3-2008-4339-879b-f5c12af80fca" alt=""><figcaption></figcaption></figure></div>

## checks status payment

> Endpoint to checks tatus transaction.

```json
{"openapi":"3.0.3","info":{"title":"dw-core-system api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/dw/b2b/v1.0/debit/status":{"post":{"tags":["SNAP"],"summary":"checks status payment","description":"Endpoint to checks tatus transaction.","operationId":"checksStatus","parameters":[{"$ref":"#/components/parameters/snapXPartnerId"},{"$ref":"#/components/parameters/snapXTimeStamp"},{"$ref":"#/components/parameters/snapXSignature"},{"$ref":"#/components/parameters/snapXExternalId"},{"$ref":"#/components/parameters/snapAuthorization"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["originalPartnerReferenceNo","serviceCode","merchantId"],"properties":{"originalReferenceNo":{"$ref":"#/components/schemas/referenceNo"},"originalPartnerReferenceNo":{"$ref":"#/components/schemas/partnerReferenceNo"},"merchantId":{"$ref":"#/components/schemas/merchantId"},"serviceCode":{"type":"string","description":"Unique service API"}}}}}},"responses":{"200":{"description":"Payment authorized successfully.","content":{"application/json":{"schema":{"type":"object","required":["responseCode","responseMessage","originalReferenceNo","originalPartnerReferenceNo","serviceCode","latestTransactionStatus","transactionStatusDesc","paidTime","transAmount"],"properties":{"responseCode":{"$ref":"#/components/schemas/responseCode"},"responseMessage":{"$ref":"#/components/schemas/responseMessage"},"originalReferenceNo":{"$ref":"#/components/schemas/referenceNo"},"originalPartnerReferenceNo":{"$ref":"#/components/schemas/partnerReferenceNo"},"serviceCode":{"type":"string","description":"Unique service API"},"latestTransactionStatus":{"type":"string","description":"Unique service API"},"transAmount":{"type":"string"},"transactionStatusDesc":{"type":"string"},"paidTime":{"$ref":"#/components/schemas/paidTime"}}}}}},"400":{"description":"Bad request."},"500":{"description":"Internal server error."}}}}},"components":{"parameters":{"snapXPartnerId":{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"client_ID or Partner_ID from DOKU"},"snapXTimeStamp":{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string","format":"date-time"},"description":"Client's current local time in yyyy-MM- ddTHH:mm:ssTZD format"},"snapXSignature":{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"Algorithm symmetric signature HMAC_SHA512 (clientSecret, stringToSign)"},"snapXExternalId":{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day (request-id)"},"snapAuthorization":{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B "}},"schemas":{"referenceNo":{"type":"string","maxLength":64,"required":true,"description":"DOKU reference number that only filled upon successful transaction."},"partnerReferenceNo":{"type":"string","maxLength":64,"required":true,"description":"Partner's reference number for the transaction."},"merchantId":{"type":"string","maxLength":22,"required":true,"description":"Unique ID for a partner (DOKU'S Client ID)"},"responseCode":{"type":"string","description":"Response code indicating status of transaction.","maxLength":7,"minLength":7},"responseMessage":{"type":"string","description":"Response description.","maxLength":150},"paidTime":{"type":"string","format":"date-time","maxLength":25,"description":"Transaction paid time. Format paid time : (ISO 8601) YYYY-MM-DDThh:mm:ss"}}}}
```

### c. Cancel Purchase

Partners can cancel the transaction or reverse immediately after successful transaction processing in the DOKU system, it can be used in case of time-out or other problems that occur on the merchant side.

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FzC6UFZXN0UYrUnfXICI7%2FAPI%20-%20Cancel%20Purchase.png?alt=media&#x26;token=33e3e429-ef35-42ff-95da-c14009f013cb" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/debit/cancel

> POST snap-adapter/b2b2c/v1.0/debit/cancel

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/debit/cancel":{"post":{"tags":["Cancel Purchase"],"summary":"POST snap-adapter/b2b2c/v1.0/debit/cancel","operationId":"debit-cancel","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelPurchaseRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelPurchaseResponse"}}}}}}}},"components":{"schemas":{"CancelPurchaseRequest":{"type":"object","required":["originalPartnerReferenceNo","reason","additionalInfo"],"properties":{"originalPartnerReferenceNo":{"type":"string","description":"Original Transaction ID from partners"},"reason":{"type":"string","description":"Reason cancelation"},"additionalInfo":{"type":"object","description":"Additional Information","required":["approvalCode"],"properties":{"approvalCode":{"type":"string","description":"Unique ID for success transaction from DOKU"}}}}},"CancelPurchaseResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"originalReferenceNo":{"type":"string"},"originalPartnerReferenceNo":{"type":"string"},"cancelTime":{"type":"string"},"transactionDate":{"type":"string"}}}}}}
```

### d. Refund Purchase

Partners can request a refund when the transaction has already settled.

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2F5sxWR32w4MfkAGwgpkPH%2FAPI%20-%20Refund%20Purchase.png?alt=media&#x26;token=c4acb0d7-7d12-48ea-a019-46f499e1971e" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/debit/refund

> POST snap-adapter/b2b2c/v1.0/debit/refund

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/debit/refund":{"post":{"tags":["Refund Purchase"],"summary":"POST snap-adapter/b2b2c/v1.0/debit/refund","operationId":"refund","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundPurchaseRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundPurchaseResponse"}}}}}}}},"components":{"schemas":{"RefundPurchaseRequest":{"type":"object","required":["originalPartnerReferenceNo","reason","partnerRefundNo","additionalInfo"],"properties":{"originalPartnerReferenceNo":{"type":"string","description":"Original Transaction ID from partners"},"reason":{"type":"string","description":"Reason for refund"},"partnerRefundNo":{"type":"string","description":"Transaction ID on service consumer system, when for refund payment."},"additionalInfo":{"type":"object","description":"Additional Information","required":["approvalCode"],"properties":{"approvalCode":{"type":"string","description":"Unique ID for success transaction from DOKU"}}}}},"RefundPurchaseResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"originalReferenceNo":{"type":"string"},"originalPartnerReferenceNo":{"type":"string"},"refundNo":{"type":"string"},"partnerRefundNo":{"type":"string"},"refundTime":{"type":"string"}}}}}}
```

## 7. Transaction History

### a. Transaction History List

This API allows partners to get history from an account with 1 month range time and the oldest transaction is 1 year behind.

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2Fq5WkVPNdIXtSqrJBcFYj%2FAPI%20-%20Transaction%20History%20List.png?alt=media&#x26;token=137185f0-9b42-44b4-b77d-cf6d6d0fac0b" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/transaction-history-list

> POST snap-adapter/b2b2c/v1.0/transaction-history-list

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/transaction-history-list":{"post":{"tags":["Transaction History List"],"summary":"POST snap-adapter/b2b2c/v1.0/transaction-history-list","operationId":"transaction-history-list","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionHistoryListRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionHistoryListResponse"}}}}}}}},"components":{"schemas":{"TransactionHistoryListRequest":{"type":"object","required":["partnerReferenceNo","fromDateTime","toDateTime","pageSize","pageNumber","additionalInfo"],"properties":{"partnerReferenceNo":{"type":"string","description":"Activity ID from partners"},"fromDateTime":{"type":"string","description":"Starting time range ISO-8601"},"toDateTime":{"type":"string","description":"Ending time range ISO-8601"},"pageSize":{"type":"string","description":"Maximum number of transaction returned in one pagination Default 10"},"pageNumber":{"type":"string","description":"Current page number Default 0"},"additionalInfo":{"type":"object","description":"Additional Information","required":["accountId","lastRefId"],"properties":{"accountId":{"type":"string","description":"Account ID of customer from DOKU"},"lastRefId":{"type":"string","description":"Given by DOKU (used if a partner or merchant wants to present a promo)"}}}}},"TransactionHistoryListResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"detailData":{"type":"object","required":["dateTime","amount","value","currency","remark","status","type"],"properties":{"dateTime":{"type":"string"},"amount":{"type":"string","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}},"remark":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"}}},"additionalInfo":{"type":"object","required":["refId","transactionId"],"properties":{"refId":{"type":"string"},"transactionId":{"type":"string"}}}}}}}}
```

### b. Transaction History Detail

This API allows partners to get transaction details from an account.

<div align="left" data-full-width="false" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2F3TTZYGgYP28PtXyxmU3D%2FAPI%20-%20Transaction%20History%20Detail.png?alt=media&#x26;token=ec3d3e47-63ed-4095-9632-cf58965f6e76" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/transaction-history-detail

> POST snap-adapter/b2b2c/v1.0/transaction-history-detail

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/transaction-history-detail":{"post":{"tags":["Transaction History Detail"],"summary":"POST snap-adapter/b2b2c/v1.0/transaction-history-detail","operationId":"transaction-history-detail","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionHistoryDetailRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionHistoryDetailResponse"}}}}}}}},"components":{"schemas":{"TransactionHistoryDetailRequest":{"type":"object","required":["partnerReferenceNo"],"properties":{"partnerReferenceNo":{"type":"string","description":"Transaction ID from partners"}}},"TransactionHistoryDetailResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}},"dateTime":{"type":"string"},"remark":{"type":"string"},"status":{"type":"string"},"type":{"type":"string"}}}}}}
```

## 8. Transfer

### a. Transfer Bank Account Inquiry

This API allows partners to get BANK beneficiary information, so customers can see and confirm the transfer activity

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FtveKPk7dYoViD81E7M55%2FAPI%20-%20Transfer%20Bank%20Inquiry.png?alt=media&#x26;token=bafa55b8-24ca-47d7-bd32-bc06428fd0b8" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/emoney/bank-account-inquiry

> POST snap-adapter/b2b2c/v1.0/emoney/bank-account-inquiry

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/emoney/bank-account-inquiry":{"post":{"tags":["Transfer BANK Account Inquiry"],"summary":"POST snap-adapter/b2b2c/v1.0/emoney/bank-account-inquiry","operationId":"bank-account-inquiry","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferInquiryBankRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferInquiryBankResponse"}}}}}}}},"components":{"schemas":{"TransferInquiryBankRequest":{"type":"object","required":["partnerReferenceNo","customerNumber","amount","beneficiaryAccountNumber","additionalInfo"],"properties":{"partnerReferenceNo":{"type":"string","description":"partnerReferenceNo"},"customerNumber":{"type":"string","description":"customerNumber"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}},"beneficiaryAccountNumber":{"type":"string","description":"beneficiaryAccountNumber"},"additionalInfo":{"type":"object","required":["bankCode"],"properties":{"bankCode":{"type":"string"}}}}},"TransferInquiryBankResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"beneficiaryAccountNumber":{"type":"string"},"beneficiaryAccountName":{"type":"string"},"beneficiaryBankCode":{"type":"string"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}}}}}}}
```

### b. Transfer Bank Account Payment

This API allows partners to trigger transfer balance from account balance to BANK Account

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FGGFAeUgxZZVF8PTrVerJ%2FAPI%20-%20Transfer%20Bank%20Payment.png?alt=media&#x26;token=aeb88f39-d682-4bee-abc2-67976ba9bb34" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/emoney/transfer-bank

> POST snap-adapter/b2b2c/v1.0/emoney/transfer-bank

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/emoney/transfer-bank":{"post":{"tags":["Transfer BANK Account Payment"],"summary":"POST snap-adapter/b2b2c/v1.0/emoney/transfer-bank","operationId":"transfer-bank","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferPaymentBankRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferPaymentBankResponse"}}}}}}}},"components":{"schemas":{"TransferPaymentBankRequest":{"type":"object","required":["partnerReferenceNo","customerNumber","accountType","beneficiaryAccountNumber","beneficiaryBankCode","amount","additionalInfo"],"properties":{"partnerReferenceNo":{"type":"string","description":"Transaction ID from partners"},"customerNumber":{"type":"string","description":"Customer number"},"accountType":{"type":"string","description":"Account type"},"beneficiaryAccountNumber":{"type":"string","description":"Beneficiary account number"},"beneficiaryBankCode":{"type":"string","description":"Beneficiary bank code"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}},"additionalInfo":{"type":"object","required":["referenceNo"],"properties":{"referenceNo":{"type":"string"}}}}},"TransferPaymentBankResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"transactionDate":{"type":"string"},"referenceNumber":{"type":"string"}}}}}}
```

## 9. Top Up

Use this API for a cashback feature where the wallet balance is sent directly from the partner's wallet account to the customer's wallet account.&#x20;

The amount of cashback would be conditioned by the business policy of each partner. Initially, the partner needs to deposit the amount to the partner's DOKUID Corporate before being able to credit/ topup to the customer’s wallet account.

### a. Account Inquiry Top Up

This API allows partners to get DOKU account information, so customers can see and confirm the transfer activity.

<div align="left" data-with-frame="true"><figure><img src="https://3092822868-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqCxtvLoJNNxvp4U7kLHd%2Fuploads%2FObQ8E2xe11QXMwrqZUND%2FAPI%20-%20Account%20Inquiry%20Topup.png?alt=media&#x26;token=35f02f71-bdbb-4022-b86a-81b38b1e1abf" alt=""><figcaption></figcaption></figure></div>

## POST /snap-adapter/b2b2c/v1.0/emoney/account-inquiry

> POST snap-adapter/b2b2c/v1.0/emoney/account-inquiry

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/emoney/account-inquiry":{"post":{"tags":["Account Inquiry Top Up"],"summary":"POST snap-adapter/b2b2c/v1.0/emoney/account-inquiry","operationId":"account-inquiry","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpInquiryRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpInquiryResponse"}}}}}}}},"components":{"schemas":{"TopUpInquiryRequest":{"type":"object","required":["partnerReferenceNo","amount","transactionDate"],"properties":{"partnerReferenceNo":{"type":"string","description":"partnerReferenceNo"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}},"transactionDate":{"type":"string","description":"transactionDate"}}},"TopUpInquiryResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"customerNumber":{"type":"string"},"customerName":{"type":"string"},"customerMonthlyInLimit":{"type":"string"},"maxAmount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}}}}}}}
```

### b. Account Top Up

This API allows partners to trigger transfer balance from their corporate account balance to DOKU Customer Account.

## POST /snap-adapter/b2b2c/v1.0/emoney/topup

> POST snap-adapter/b2b2c/v1.0/emoney/topup

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/emoney/topup":{"post":{"tags":["Account Top Up"],"summary":"POST snap-adapter/b2b2c/v1.0/emoney/topup","operationId":"topup","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpResponse"}}}}}}}},"components":{"schemas":{"TopUpRequest":{"type":"object","required":["partnerReferenceNo","customerNumber","amount","sessionId","notes","additionalInfo"],"properties":{"partnerReferenceNo":{"type":"string","description":"Transaction ID from partners"},"customerNumber":{"type":"string","description":"Customer number"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}},"sessionId":{"type":"string","description":"Session ID"},"notes":{"type":"string","description":"Notes for top up transaction"},"additionalInfo":{"type":"object","required":["deviceId","channel"],"properties":{"deviceId":{"type":"string"},"channel":{"type":"string"}}}}},"TopUpResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"referenceNo":{"type":"string"},"partnerReferenceNo":{"type":"string"},"sessionId":{"type":"string"},"customerNumber":{"type":"string"}}}}}}
```

### c. Query Top Up

This API allows partners to check status top up.

## POST /snap-adapter/b2b2c/v1.0/emoney/topup-status

> POST snap-adapter/b2b2c/v1.0/emoney/topup-status

```json
{"openapi":"3.0.0","info":{"title":"doku-wallet-snap-api","version":"1.0.0"},"servers":[{"url":"{api-domain}","description":"api domain"}],"paths":{"/snap-adapter/b2b2c/v1.0/emoney/topup-status":{"post":{"tags":["Query Top Up"],"summary":"POST snap-adapter/b2b2c/v1.0/emoney/topup-status","operationId":"topup-status","parameters":[{"name":"X-TIMESTAMP","in":"header","required":true,"schema":{"type":"string"},"description":"Client's current local time in yyyyMMddTHH:mm:ss.SSST ZD format"},{"name":"X-PARTNER-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Credential client ID from DOKU"},{"name":"X-EXTERNAL-ID","in":"header","required":true,"schema":{"type":"string"},"description":"Reference number that should be unique in the same day"},{"name":"X-SIGNATURE","in":"header","required":true,"schema":{"type":"string"},"description":"SHA-512 HMAC is used to generate the signature with your Client Secret. Generate stringToSign : HTTPMethod + ”:“+ EndpointUrl +\":\"+ B2BAccessToken + \":“+ Lowercase(HexEncode(SHA-256(minify(RequestBody)))) + \":“ + X-TimeStamp"},{"name":"Authorization","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request, string starts with keyword “Bearer ” followed by Token B2B"},{"name":"Authorization-Customer","in":"header","required":true,"schema":{"type":"string"},"description":"Represents access_token of a request belong customer; string starts with keyword “Bearer ” followed by Token B2B2C"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryTopUpRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryTopUpResponse"}}}}}}}},"components":{"schemas":{"QueryTopUpRequest":{"type":"object","required":["originalPartnerReferenceNo","originalExternalId","serviceCode","additionalInfo"],"properties":{"originalPartnerReferenceNo":{"type":"string","description":"originalPartnerReferenceNo"},"originalReferenceNo":{"type":"string","description":"originalReferenceNo"},"originalExternalId":{"type":"string","description":"originalExternalId"},"serviceCode":{"type":"string","description":"serviceCode"},"additionalInfo":{"type":"object","required":["deviceId","channel"],"properties":{"deviceId":{"type":"string"},"channel":{"type":"string"}}}}},"QueryTopUpResponse":{"type":"object","properties":{"responseCode":{"type":"string"},"responseMessage":{"type":"string"},"originalPartnerReferenceNo":{"type":"string"},"originalReferenceNo":{"type":"string"},"originalExternalId":{"type":"string"},"serviceCode":{"type":"string"},"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string"},"currency":{"type":"string"}}},"latestTransactionStatus":{"type":"string"},"transactionStatusDesc":{"type":"string"},"additionalInfo":{"type":"object","required":["deviceId","channel","approvalCode"],"properties":{"deviceId":{"type":"string"},"channel":{"type":"string"},"approvalCode":{"type":"string"}}}}}}}}
```

## Appendix

### DOKU e-Wallet Customer Type

<table data-full-width="true"><thead><tr><th width="280.6640625">Criteria</th><th>Normal/Basic</th><th>Premium</th></tr></thead><tbody><tr><td>Max Balance</td><td>Rp2.000.000</td><td>Rp20.000.000</td></tr><tr><td>Max Monthly Transaction Limit</td><td>Rp20.000.000/month</td><td>Rp40.000.000/month</td></tr><tr><td>Purchase</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>Transfer</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>Cash Out</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr></tbody></table>

### Response Code

Response code has 3 parts of information, 3 digits for HTTP Code,  2 digits for Service Code and the last is for Case Code, like the example below.&#x20;

{% hint style="info" %}
**Example**

Response Code: 2007300

* 200 : HTTP Code&#x20;
* 73 : Service Code&#x20;
* 00 : Case Code
  {% endhint %}

<table data-full-width="true"><thead><tr><th width="248.7890625">Response Code</th><th>Desc</th></tr></thead><tbody><tr><td>200 ”ServiceCode” 00</td><td>Successful</td></tr><tr><td>401 ”ServiceCode” 01</td><td>Access Token Invalid ( B2B / B2B2B Token )</td></tr><tr><td>401 ”ServiceCode” 00</td><td>Unauthorized Signature</td></tr><tr><td>400 ”ServiceCode” 02</td><td>Invalid Mandatory Field</td></tr><tr><td>400 ”ServiceCode” 01</td><td>Invalid Field Format </td></tr><tr><td>409 ”ServiceCode” 00</td><td>Conflict ( Using same External-ID )</td></tr><tr><td>404 ”ServiceCode” 11</td><td>Account Information Invalid</td></tr><tr><td>404 ”ServiceCode” 15</td><td>OTP/Verification Code Invalid</td></tr><tr><td>403 ”ServiceCode” 18</td><td>Inactive Account</td></tr><tr><td>403 ”ServiceCode” 05</td><td>Account Frozen/Abnormal</td></tr><tr><td>403 ”ServiceCode” 02</td><td>Exceeds Top Up Amount Limit</td></tr><tr><td>403 ”ServiceCode” 14</td><td>Insufficient Fund</td></tr><tr><td>404 ”ServiceCode” 08</td><td>Invalid Merchant</td></tr><tr><td>400 ”ServiceCode” 00</td><td>Parsing Error</td></tr><tr><td>404 ”ServiceCode” 01</td><td>Transaction Not Found</td></tr><tr><td>404 ”ServiceCode” 04</td><td>Transaction Cancelled</td></tr></tbody></table>

<table data-full-width="true"><thead><tr><th width="254.63671875">Service Code</th><th>API</th></tr></thead><tbody><tr><td>04</td><td>Verify OTP</td></tr><tr><td>06</td><td>Account Creation</td></tr><tr><td>07</td><td>Account Binding</td></tr><tr><td>08</td><td>Account Inquiry</td></tr><tr><td>09</td><td>Account Unbinding</td></tr><tr><td>11</td><td>Balance Inquiry</td></tr><tr><td>12</td><td>Transaction History List</td></tr><tr><td>13</td><td>Transaction History Detail</td></tr><tr><td>54</td><td>Purchase</td></tr><tr><td>55</td><td>Query Purchase</td></tr><tr><td>57</td><td>Cancel Purchase</td></tr><tr><td>58</td><td>Refund Purchase</td></tr><tr><td>37</td><td>Account Inquiry Top Up</td></tr><tr><td>39</td><td>Query Top Up</td></tr><tr><td>38</td><td>Account Top Up</td></tr><tr><td>42</td><td>Transfer BANK Account Inquiry</td></tr><tr><td>43</td><td>Transfer Bank Payment</td></tr><tr><td>63</td><td>Authorize Payment</td></tr><tr><td>65</td><td>Capture Payment</td></tr><tr><td>67</td><td>Void Auth Payment</td></tr></tbody></table>
