New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@billingrails/node

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@billingrails/node

Official Node.js SDK for Billingrails API - Flexible, composable, and intuitive API-first commerce platform

latest
Source
npmnpm
Version
0.1.7
Version published
Maintainers
1
Created
Source

Billingrails Node.js SDK

npm version License: MIT Node.js Version

Official Node.js SDK for Billingrails

Installation

pnpm add @billingrails/node

Or with npm:

npm install @billingrails/node

Or with yarn:

yarn add @billingrails/node

Quick Start

import { Billingrails } from '@billingrails/node';

// Initialize the client
const client = new Billingrails({
  apiKey: 'your-api-key',
});

// List accounts
const listResponse = await client.accounts.list();
console.log(listResponse.accounts);

// Create an account
const createResponse = await client.accounts.create({
  name: 'John Doe',
  email: 'john@example.com',
  country: 'US',
  default_currency: 'USD',
});
console.log(createResponse.account);

// Retrieve an account
const retrieveResponse = await client.accounts.retrieve('acc_123');
console.log(retrieveResponse.account);

// Update an account
const updateResponse = await client.accounts.update('acc_123', {
  name: 'Jane Doe',
});
console.log(updateResponse.account);

// Get account balances
const balancesResponse = await client.accounts.getBalances('acc_123');
console.log(balancesResponse.balances);

// Debit an account
const debitResponse = await client.accounts.debit('acc_123', {
  amount: 1000, // Amount in cents
  currency: 'USD',
});
console.log(debitResponse.balances);

Configuration

Basic Configuration

const client = new Billingrails({
  apiKey: 'your-api-key',
});

Advanced Configuration

const client = new Billingrails({
  apiKey: 'your-api-key',
  baseUrl: 'https://api.billingrails.com/v1', // Production URL
  timeout: 30000, // Request timeout in milliseconds
  maxRetries: 3, // Maximum number of retries for failed requests
});

Error Handling

The SDK throws BillingrailsError for API errors:

import { Billingrails, BillingrailsError } from 'billingrails';

try {
  const retrieveResponse = await client.accounts.retrieve('invalid_id');
} catch (error) {
  if (error instanceof BillingrailsError) {
    console.error('API Error:', error.message);
    console.error('Error Code:', error.code);
    console.error('Status Code:', error.statusCode);
    console.error('Details:', error.details);
  }
}

TypeScript Support

The SDK is written in TypeScript and includes full type definitions:

import type { Account, AccountCreate, AccountUpdate } from 'billingrails';

const accountData: AccountCreate = {
  name: 'John Doe',
  email: 'john@example.com',
};

const createResponse = await client.accounts.create(accountData);

License

MIT

Support

For support, please contact ugo@billingrails.com or visit our documentation.

Keywords

billingrails

FAQs

Package last updated on 29 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts