# Frontend Integration

### Frontend Integration to display DOKU Checkout Page

The aim of integrating the frontend is to present the DOKU Checkout payment page seamlessly within your website.

Once you have the `payment.url`, you can now display the payment page by embedding the DOKU Checkout JS on your HTML file.

#### DOKU Checkout js location

Simply import the `jokul-checkout-1.0.0.js` and then call the `loadJokulCheckout()` with the `payment.url:`

<table><thead><tr><th width="144">Type</th><th>Value</th></tr></thead><tbody><tr><td>JS (sandbox)</td><td><a href="https://sandbox.doku.com/jokul-checkout-js/v1/jokul-checkout-1.0.0.js">https://sandbox.doku.com/jokul-checkout-js/v1/jokul-checkout-1.0.0.js</a></td></tr><tr><td>JS (production)</td><td><a href="https://jokul.doku.com/jokul-checkout-js/v1/jokul-checkout-1.0.0.js">https://jokul.doku.com/jokul-checkout-js/v1/jokul-checkout-1.0.0.js</a></td></tr></tbody></table>

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

The `viewport` on the `<head>` tag is important to ensure that the payment page is load correctly.
{% endhint %}

```html
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="https://sandbox.doku.com/jokul-checkout-js/v1/jokul-checkout-1.0.0.js"></script>
    </head>
    <body>
        <button id="checkout-button">Checkout Now</button>

        <script type="text/javascript">
        var checkoutButton = document.getElementById('checkout-button');
        // Example: the payment page will show when the button is clicked
        checkoutButton.addEventListener('click', function () {
            loadJokulCheckout('https://jokul.doku.com/checkout/link/SU5WFDferd561dfasfasdfae123c20200510090550775'); // Replace it with the response.payment.url you retrieved from the response
        });
        </script>
    </body>
</html>
```

There are 2 approaches for integrating the DOKU Checkout page into your web/app interface.&#x20;

1. Redirect customer to a new page.

   Use the `payment.url`value **without** importing the JS file
2. Present it as modal overlay (pop-up mode)

   Kindly importing the JS file as the sample attached above

<figure><img src="/files/ZKPmxR4l4ZL3ck0N7o7d" alt=""><figcaption><p>Pop up mode integration</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.doku.com/accept-payments/doku-checkout/integration-guide/frontend-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
