Documentation


Welcome to Deko Docs! Here you'll find a comprehensive guide to help you get up and running with Deko.


Quick Start

This section provides a summary of the steps in getting started with Deko. See the steps below:

Deko Integration steps

1. Obtain your Credentials

Client ID and Client Secret

Your client ID and client secret are provided during onboarding. Please check with your account manager.

2. Load Deko js Checkout

The integration requires a client side step. You will need to load the Deko JS checkout bundle. The following script tag should be placed close to the end of the tag in your main index file:

<script src="https://assets.dekopay.com/wallet/index.js" type="application/javascript"></script>

3. Access Deko APIs

In order to prevent unauthorised access you must authenticate all requests with an access token. To complete authentication, send an HTTP POST request to the auth endpoint, together with your credentials as the payload: client_id and client_secret. See the example below:

{
  "client_id": "vL0ZsEN9j5NT4VP3cFKBp1jF94sm5C8v",
  "client_secret": "jTQKBCmoMyvrWGSwIwyNJVG3_APoftqbynyU61hScV1nCnj0gLAvMCocsOTT44xj"
}

In response you will receive an authentication token, similar to the following:

{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imp6SXZmaU1HNkJqVEpUWGxkRlVwZSJ9.eyJpc3MiOiJodHRwczovL2Rla29wYXktbWVyY2hhbnQtZGV2LmV1LmF1dGgwLmNvbS8iLCJzdWIiOiJ2TDBac0VOOWo1TlQ0VlAzY0ZLQnAxakY5NHNtNUM4dkBjbGllbnRzIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgxL2FwaS9jaGVja291dCIsImlhdCI6MTYxNjU5MTU4NywiZXhwIjoxNjE2Njc3OTg3LCJhenAiOiJ2TDBac0VOOWo1TlQ0VlAzY0ZLQnAxakY5NHNtNUM4diIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.F-dzPkJVF0ub2kGiWn1As5PSMnIiqAriOhyux47t7lbNk0tD9Wu655JGHmjuAqqQ3uWyqXx9-feuYjv61xufgBfxH17OkIqBB9lVJzEONoVqF5uIzsnaTD2z0FTzcvOuH8RXzA-_q7vFZwvbboE9iZCFd-JN8vI_1jjWDUpdKFWzGk0-AmID9F7qgNnyC2WEb6DK4Ky5VttXPXcGfnIGD2ybOgkg1dOlBhzabJBT9jU_UQuBoKjqQoNqVm1ovhFJzzSWMsHqDIDOb7r-0zXRB33ka4_oKoVnVrvxL2hGblgC-2Jg6gfB7uuVPdbM5FIBFx8Cbt4T83KxXbpJy5hQbg",
        "expires_in": 86400,
     "token_type": "Bearer"
}

4. Verify your basket items

To reduce the risk of you or your customers being exposed to a man-in-the-middle attack and prevent them from purchasing prohibited items, you need to authorise your basket by submitting your merchant ID and basket attributes in the authorisation call:

  • A checkout authorisation certificate (CAC) using base 64 encoding is returned which you will need to pass to the client side.
  • The payload has information about the basket and merchant id.

5. Checkout

When you receive a valid checkout certificate, you are ready to start the application checkout process.

Initialise Deko Wallet

To start the checkout process you must first initialize the Deko Wallet.
Initialise Deko Wallet via the Window object. This should be done in a closure to protect the scope. See below.

function () {
     var wallet = window.dekoWallet.init();
       …
}

Following the Initialise

Now pass the checkout authorisation certificate (CAC) as an argument to the client side by invoking the wallet.checkout function. This function returns an unresolved promise.

wallet.checkout(cac)

6. Customer Completes Checkout

The customer logs in or signs up and completes the checkout on the Deko page. Upon successful checkout, the checkout page resolves with a receipt (scheme). See the example below.

.checkout(cac)
    .then((result) => {
      console.log(‘SUCCESS ====’, result);
      alert(`SUCCESS - ${result}`);
      // This will happen only on a payment success
    })
    .catch((e) => {
      console.log(‘FAILURE ====’, e.message);
      alert(`FAILURE - ${e.message}`);
      // This will happen when either the customer does not meet credit lending qualification or their deposit payment card has been declined
    });

7. Confirm your Order

Once checkout is complete, we will notify you on your callbackUri (included in the payload for /verify-basket) that there is an update which you need to pull from the get transactions endpoint.
You can use the status.state result to update your order management system.
See the example below.

{
  "status": {
    "last_updated": "2021-04-26T17:19:21.988Z",
    "state": "success",
    "_links": {
      "self": {
        "href": "/application/split/f7210019-2e4a-49f7-bd7b-b167285c5424/status"
      }
    }
  },
  "application_id": "f7210019-2e4a-49f7-bd7b-b167285c5424",
  "transaction_id": "d290f1ee-6c54-4b01-90e6-d701748f0851"
}

Updated a day ago



Quick Start


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.