> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dimepayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript SDK

> Official JavaScript client for the Dime Payments API

## Installation

Requires Node.js 18+

```bash theme={null}
npm install @dime-technology/dime-js-sdk
```

## Quickstart

```javascript theme={null}
import { Client } from '@dime-technology/dime-js-sdk';

const dime = new Client('your-api-token');

const txn = await dime.transactions.chargeCard('YOUR_SID', {
  amount: 49.99,
  token: 'tok_abc123',
});

console.log(txn.transactionStatus); // "Success"
```

## Configuration

```javascript theme={null}
import { Client, Config } from '@dime-technology/dime-js-sdk';

// Simple setup
const dime = new Client('your-api-token');

// Full control
const dime = new Client(new Config({
  token: 'your-api-token',
  baseUrl: 'https://app.dimepayments.com',
  timeout: 30000,
  maxRetries: 2,
}));
```

## Available Resources

| Property                 | Endpoints                                                     |
| ------------------------ | ------------------------------------------------------------- |
| `dime.transactions`      | chargeCard, chargeAch, tokenizeCard, refund, void, show, list |
| `dime.customers`         | list, show, create, update, delete                            |
| `dime.paymentMethods`    | list, show, create, update, delete                            |
| `dime.merchants`         | list, show, create, update, getFormLink                       |
| `dime.addresses`         | list, show, create, update, delete                            |
| `dime.deposits`          | list, listWithTransactions, show                              |
| `dime.recurringPayments` | list, show, create, edit, pause, cancel, activate, delete     |

## Error Handling

```javascript theme={null}
import { DimeException, ValidationException } from '@dime-technology/dime-js-sdk';

try {
  await dime.transactions.chargeCard('YOUR_SID', { amount: 0 });
} catch (e) {
  if (e instanceof ValidationException) {
    console.log(e.getErrors());
  }
}
```

## Links

* [GitHub](https://github.com/dime-technology/dime-js-sdk)
* [npm](https://www.npmjs.com/package/@dime-technology/dime-js-sdk)
* [API Reference](/api-reference)
