Skip to main content

Installation

Requires Node.js 18+
npm install @dime-technology/dime-js-sdk

Quickstart

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

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

PropertyEndpoints
dime.transactionschargeCard, chargeAch, tokenizeCard, refund, void, show, list
dime.customerslist, show, create, update, delete
dime.paymentMethodslist, show, create, update, delete
dime.merchantslist, show, create, update, getFormLink
dime.addresseslist, show, create, update, delete
dime.depositslist, listWithTransactions, show
dime.recurringPaymentslist, show, create, edit, pause, cancel, activate, delete

Error Handling

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());
  }
}