# DANA

## Integration Steps

Overview of integration process with DANA.

1. [Payment](#1.-payment)
2. [Payment Notification](#id-2.-payment-notification)
3. [Additional Feature](#id-3.-additional-feature)

***

### 1. Payment&#x20;

Payment process using DANA doesn't require account binding. After customer creates an order and chooses DANA as payment method on merchant's platform, merchant will hit this payment API to get redirect URLs to DANA's platform for customer to complete the payment.

**API Endpoint**

<table><thead><tr><th width="176">Environment</th><th>Endpoint</th></tr></thead><tbody><tr><td>HTTP Method</td><td>POST</td></tr><tr><td>API Sandbox</td><td><a href="https://api-sandbox.doku.com">https://api-sandbox.doku.com</a></td></tr><tr><td>API Production</td><td><a href="https://api.doku.com">https://api.doku.com</a></td></tr><tr><td>Path</td><td><code>.../direct-debit/core/v1/debit/payment-host-to-host</code></td></tr></tbody></table>

**Sample of Request Header, Request Body and Response Body**

Notes:&#x20;

Parameter with (\*) is mandatory&#x20;

Paramater without (\*) is optional/conditional

## POST /direct-debit/core/v1/debit/payment-host-to-host

> Payment

```json
{"openapi":"3.0.3","info":{"title":"Swagger E-Wallet SNAP DANA","version":"1.0.11"},"servers":[{"url":"https://{api-domain}"}],"paths":{"/direct-debit/core/v1/debit/payment-host-to-host":{"post":{"summary":"Payment","parameters":[{"in":"header","name":"X-TIMESTAMP","schema":{"type":"string","format":"utc timestamp"},"required":true,"description":"Client's current local time in yyyy-MM- ddTHH:mm:ssTZD format"},{"in":"header","name":"X-SIGNATURE","schema":{"type":"string"},"description":"Algorithm symmetric signature HMAC_SHA512 (clientSecret, stringToSign)","required":true},{"in":"header","name":"X-PARTNER-ID","schema":{"type":"string"},"required":true,"description":"Unique ID for a partner (DOKU'S Client ID)"},{"in":"header","name":"X-EXTERNAL-ID","schema":{"type":"string"},"required":true,"description":"Numeric String. Reference number that should be unique in the same day (request-id)"},{"in":"header","name":"X-DEVICE-ID","schema":{"type":"string"},"description":"Device identification on which the API services are currently being accessed by the end user (customer). Can’t contain symbols"},{"in":"header","name":"X-IP-ADDRESS","schema":{"type":"string"},"description":"conditional. IP address of the end user (customer) using IPv4 format"},{"in":"header","name":"Authorization","schema":{"type":"string","description":"Access Token obtained from Get B2B Token API"},"required":true,"description":"Access Token obtained from Get B2B Token API | Go to [here](https://dokucom.gitbook.io/api-reference/direct-api/get-token-api/b2b) for detailed documentation"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentRequest"}}}},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentResponse"}}}}}}}},"components":{"schemas":{"PaymentRequest":{"type":"object","required":["partnerReferenceNo","amount","urlParam"],"properties":{"partnerReferenceNo":{"type":"string","description":"invoice number from partner | max: 64 | Mandatory "},"validUpTo":{"type":"string","description":"Expired time payment url | format: 2024-07-10T11:57:58+07:00 "},"pointOfInitiation":{"type":"string","description":"Point of initiation from partner | value: app/pc/mweb | max: 20"},"urlParam":{"type":"object","required":["url","type","isDeepLink"],"properties":{"url":{"type":"string","description":"URL partner for redirect back from DANA | format: www.merchant.co.id | max: 255 | Mandatory"},"type":{"type":"string","description":"Pay Return | Value should be always PAY_RETURN | Mandatory"},"isDeepLink":{"type":"string","description":"Is Merchant use deep link or not | value: Y/N | Mandatory"}}},"amount":{"$ref":"#/components/schemas/AmountObject"},"additionalInfo":{"type":"object","required":["channel"],"properties":{"channel":{"type":"string","description":"Value should be always EMONEY_DANA_SNAP | Mandatory"},"orderTitle":{"type":"string","description":"Order title from merchant"},"supportDeepLinkCheckoutUrl":{"type":"string","description":"Value 'true' for Jumpapp behaviour, 'false' for webview, false by default"}}}}},"AmountObject":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string","description":"Transaction Amount. Total Amount with 2 decimal, format ISO 4217 | Mandatory | min length: 1 | max length: 16.2"},"currency":{"type":"string","description":"Currency. | Mandatory | min length: 1 | max length: 3"}}},"PaymentResponse":{"type":"object","required":["responseCode","responseMessage","webRedirectUrl"],"properties":{"responseCode":{"type":"string","description":"Response Code with format HTTP status code + service code + case code. service code and status code refer to: https://developers.doku.com/getting-started-with-doku-api/response-code/http-status-and-case-code#id-3.-e-wallet . | Mandatory | min length: 1 | max length: 7."},"responseMessage":{"type":"string","description":"Response Message"},"webRedirectUrl":{"type":"string","description":"Redirect URL to Merchant's page/platform for customer to input OTP/PIN"},"partnerReferenceNo":{"type":"string","description":"Invoice Number from Partner"}}}}}}
```

### 2. Payment Notification

After payment is completed, DOKU will send **HTTP Notification** to merchant's defined `Notification URL.`Learn how to [handle the notification from DOKU](https://developers.doku.com/get-started-with-doku-api/notification).

### 3. Additional Feature

### **Online Refund**

This endpoint is used to create refund request for previous successful payment. Merchant can request a transaction refund to DOKU.

**API Endpoint**

<table><thead><tr><th width="181">Environment</th><th>Endpoint</th></tr></thead><tbody><tr><td>HTTP Method</td><td>POST</td></tr><tr><td>API Sandbox</td><td><a href="https://api-sandbox.doku.com">https://api-sandbox.doku.com</a></td></tr><tr><td>API Production</td><td><a href="https://api.doku.com">https://api.doku.com</a></td></tr><tr><td>Path</td><td><code>.../direct-debit/core/v1/debit/refund</code></td></tr></tbody></table>

**Sample of Request Header, Request Body and Response Body**

Notes:&#x20;

Parameter with (\*) is mandatory&#x20;

Paramater without (\*) is optional/conditional

## POST /direct-debit/core/v1/debit/refund

> Request Refund From Merchant for E-Wallet Transaction

```json
{"openapi":"3.0.3","info":{"title":"Swagger E-Wallet SNAP DANA","version":"1.0.11"},"servers":[{"url":"https://{api-domain}"}],"paths":{"/direct-debit/core/v1/debit/refund":{"post":{"summary":"Request Refund From Merchant for E-Wallet Transaction","parameters":[{"in":"header","name":"X-TIMESTAMP","schema":{"type":"string","format":"utc timestamp"},"required":true,"description":"Client's current local time in yyyy-MM- ddTHH:mm:ssTZD format"},{"in":"header","name":"X-SIGNATURE","schema":{"type":"string"},"description":"Algorithm symmetric signature HMAC_SHA512 (clientSecret, stringToSign)","required":true},{"in":"header","name":"X-PARTNER-ID","schema":{"type":"string"},"required":true,"description":"Unique ID for a partner (DOKU'S Client ID)"},{"in":"header","name":"X-EXTERNAL-ID","schema":{"type":"string"},"required":true,"description":"Numeric String. Reference number that should be unique in the same day (request-id)"},{"in":"header","name":"X-DEVICE-ID","schema":{"type":"string"},"description":"Device identification on which the API services are currently being accessed by the end user (customer). Can’t contain symbols"},{"in":"header","name":"X-IP-ADDRESS","schema":{"type":"string"},"description":"conditional. IP address of the end user (customer) using IPv4 format"},{"in":"header","name":"Authorization","schema":{"type":"string","description":"Access Token obtained from Get B2B Token API"},"required":true,"description":"Access Token obtained from Get B2B Token API | Go to [here](https://dokucom.gitbook.io/api-reference/direct-api/get-token-api/b2b) for detailed documentation"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundRequest"}}}},"responses":{"200":{"description":"Successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundResponse"}}}}}}}},"components":{"schemas":{"RefundRequest":{"type":"object","required":["originalPartnerReferenceNo","amount","partnerRefundNo","additionalInfo"],"properties":{"additionalInfo":{"type":"object","required":["channel"],"properties":{"channel":{"type":"string","description":"Value should be always EMONEY_DANA_SNAP | Mandatory"}}},"originalPartnerReferenceNo":{"type":"string","description":"Partner Reference No from Purchase Transaction | max: 64 | Mandatory"},"originalExternalId":{"type":"string","description":"External ID from Purchase Transaction | max: 64 |"},"refundAmount":{"$ref":"#/components/schemas/AmountObject"},"reason":{"type":"string","description":"Reason for Refund | max: 255"},"partnerRefundNo":{"type":"string","description":"Partner Refund No from Partner | max: 64 | Mandatory"}}},"AmountObject":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"string","description":"Transaction Amount. Total Amount with 2 decimal, format ISO 4217 | Mandatory | min length: 1 | max length: 16.2"},"currency":{"type":"string","description":"Currency. | Mandatory | min length: 1 | max length: 3"}}},"RefundResponse":{"type":"object","required":["responseCode","responseMessage","refundAmount","refundTime"],"properties":{"responseCode":{"type":"string","description":"Response Code with format HTTP status code + service code + case code. service code and status code refer to: https://developers.doku.com/getting-started-with-doku-api/response-code/http-status-and-case-code#id-3.-e-wallet . | Mandatory | min length: 1 | max length: 7."},"responseMessage":{"type":"string"},"refundAmount":{"$ref":"#/components/schemas/AmountObject"},"refundTime":{"type":"string","description":"format: yyyy-MM-dd'T'HH:mm:ssXXX"}}}}}}
```
