Initialise Deko Wallet

Getting Started | Initialise Deko Wallet | Show Finance Info | Start Checkout | Complete Checkout | Confirm Order | Test Data

4. Initialise Deko Wallet

Deko Wallet is our plugin to enable you to present finance options on any page of your website as well as at checkout. In order to enable the plugin on your sites pages, you must first initialise it.

Obtain a JWT

Call the init endpoint in a machine to machine call to receive a JSON Web Token (JWT):

curl -X 'POST' \
  '' \
  -H 'accept: application/hal+json' \
  -H 'Authorization: Bearer xeyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imp6SXZmaU1HNkJqVEpUWGxkRlVwZSJ9.eyJpc3MiOiJodHRwczovL2Rla29wYXktbWVyY2hhbnQtZGV2LmV1LmF1dGgwLmNvbS8iLCJzdWIiOiJ2TDBac0VOOWo1TlQ0VlAzY0ZLQnAxakY5NHNtNUM4dkBjbGllbnRzIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgxL2FwaS9jaGVja291dCIsImlhdCI6MTYxNjU5MTU4NywiZXhwIjoxNjE2Njc3OTg3LCJhenAiOiJ2TDBac0VOOWo1TlQ0VlAzY0ZLQnAxakY5NHNtNUM4diIsImd0eSI6ImNsaWVudC1jcmVkZW50aWFscyJ9.F-dzPkJVF0ub2kGiWn1As5PSMnIiqAriOhyux47t7lbNk0tD9Wu655JGHmjuAqqQ3uWyqXx9-feuYjv61xufgBfxH17OkIqBB9lVJzEONoVqF5uIzsnaTD2z0FTzcvOuH8RXzA-_q7vFZwvbboE9iZCFd-JN8vI_1jjWDUpdKFWzGk0-AmID9F7qgNnyC2WEb6DK4Ky5VttXPXcGfnIGD2ybOgkg1dOlBhzabJBT9jU_UQuBoKjqQoNqVm1ovhFJzzSWMsHqDIDOb7r-0zXRB33ka4_oKoVnVrvxL2hGblgC-2Jg6gfB7uuVPdbM5FIBFx8Cbt4T83KxXbpJy5hQbg' \
  -d ''

The POST request returns the init_token.

Initialise the Deko Wallet

Initialise the Deko Wallet via the Window object. This should be done in a closure to protect the scope. The function you pass to the dekoWallet.init method must make a request to your server which in turn would request the init token from the Deko Public API. The return type of your function should be a Promise that resolves to the init token retrieved by your server. See below.

const yourFunction = () => { 
    return Promise.resolve(myInitToken);
  const wallet = window.dekoWallet.init(yourFunction);

In this example, the wallet variable is an instance of the dekoWallet Javascript API. This API enables you to checkout and display or hide the wallet UI.

Alternatively you may choose to initialize the wallet in a hidden state so the tile will not pop up immediately after initialization.

const yourFunction = () => { 
    return Promise.resolve(myInitToken);
  const wallet = window.dekoWallet.init(yourFunction, false);