Installing

You can find our SDK on any of the following package managers or you can use our CDN to include it in your project.

Our SDK requires a minimum of Node.js 18 to work, or any modern browser. We rely on the Fetch API, so if you are using an older browser, you will need to use a polyfill. You can find out more information here.


Getting started

You first need to create an API key, which you can find our documentation on here. Please also read our Best Practices guide to learn how to best use our SDK.

import { SDK } from '@drivly/commerce'

const sdk = new SDK({ apiKey: 'your-api-key', environment: 'sandbox' })

Environment variables

If you wish to use environment variables, you can set the DRIVLY_API_KEY and DRIVLY_ENV variables in your environment. Our SDK will automatically pick up these environment variables and use them to authenticate your requests.

export DRIVLY_API_KEY=your-api-key
export DRIVLY_ENV=sandbox

Making your first request

Now that you have your SDK set up, you can start making requests to our API. Here is an example of how you can get a list of customers.

const customers = await sdk?.commerce.customers.find()

Types

We also offer TypeScript interfaces for our SDK, which you can use to get better type safety in your code. You can import the types like so:

import type { Customer, PreApproval } from '@drivly/commerce'

Next steps

Now that you have our SDK set up, you can start using it to interact with our API. You can find our API references here.