Skip to main content

Install SDK

Initialize Client

Setup the client with your Project ID. You can find your Project ID in the WalletKit Dashboard.
At this point, the client is unauthenticated. To authenticate your client, check out the Authentication section.

The Store

You only need to set the store object if you are making client-side calls. If you are only making server-side calls, you can skip this section and use the API key to authenticate your client.
In order to make sure that the client is able to persist data, such as the authentication token, you need to provide a store object. The store object is a simple key-value store that implements the following interface:
You can use the KVStore interface to store the authentication token in the browser’s local storage, or in a cookie.

Local Storage

The following example shows how to use the browser’s local storage to store the authentication token:

Cookies

The following example shows how to use cookies to store the authentication token. It uses the js-cookie library to set, get and delete cookies.
Note that the set and delete methods in the KVStore interface are optional. This is useful if you need to read an existing authentication token to make calls, but you don’t have the ability to modify cookies.