# JS SDK quickstart

This guide describes how to install and use the Rebilly JS SDK.
To view the Rebilly JS SDK, see [Rebilly JS SDK](https://www.npmjs.com/package/rebilly-js-sdk).

## Installation

### npm

Install the latest version of the Rebilly JS SDK using npm:


```bash
npm install rebilly-js-sdk --save
```

## Obtain API key and organization ID

To authenticate with the Rebilly API, you must provide your secret Rebilly API key and organization ID.
Depending on the API operation you are executing, you may also need to provide a website ID.

To obtain them, see [Obtain a secret key](/docs/dev-docs/api-keys#obtain-a-secret-key) and [Obtain your organization ID and website ID](/docs/settings/organizations-and-websites#obtain-your-organization-id-and-website-id).

## Usage

Import the `RebillyAPI` method and initialize it with your secret API key.
For a list of configuration options, see [Configuration options](/docs/dev-docs/reference#configuration-options).

### Retrieve a customer

This example describes how to initialize the Rebilly JS SDK and retrieve a customer using the Rebilly JS SDK.


```js
import RebillyAPI from 'rebilly-js-sdk';

// Define Rebilly organization ID and API key
const REBILLY_ORGANIZATION_ID = 'REBILLY_ORGANIZATION_ID';
const REBILLY_API_SECRET_KEY = 'REBILLY_API_SECRET_KEY';

// Initialize the Rebilly API client with your API key
const api = RebillyAPI({
  sandbox: true,
  organizationId: REBILLY_ORGANIZATION_ID,
  apiKey: REBILLY_API_SECRET_KEY,
});

try {
  // Fetch a specific customer by ID
  const customer = await api.customers.get({ id: 'customer-123' });
  console.log(customer);
} catch (err) {
  // Handle errors
  console.error(err);
}
```

### Payment form examples

The following examples use the Rebilly Instruments JavaScript library and the Rebilly JS SDK to set up payment forms:

- [Payment form example](/docs/dev-docs/process-a-payment-jwt)
- [Deposit form example](/docs/dev-docs/integrate-a-deposit-form)
- [Payout form example](/docs/dev-docs/integrate-a-payout-form)


## Build commands

For build commands, see [Development](https://www.npmjs.com/package/rebilly-js-sdk#Development).