npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@smartbase-js/raiaccept-api-client

v0.9.4

Published

TypeScript SDK for RaiAccept payment gateway API

Readme

RaiAccept TypeScript SDK

CI npm version License TypeScript

TypeScript/JavaScript SDK for RaiAccept payment gateway API.

Installation

npm install @smartbase-js/raiaccept-api-client

Usage

import { RaiAcceptService } from '@smartbase-js/raiaccept-api-client';

// Create service instance
const service = new RaiAcceptService();

// Authenticate with your credentials
const authResult = await service.retrieveAccessTokenWithCredentials(
  'your-username',  // Replace with your actual username
  'your-password',  // Replace with your actual password
  cert,             // Client certificate for mTLS
  key               // Client private key for mTLS
);
const accessToken = authResult?.accessToken;

const response = await service.createOrderEntry(accessToken, orderRequest);

Create Payment

import { RaiAcceptService, HttpClient } from '@smartbase-js/raiaccept-api-client';

// Initialize HTTP client (optional, for logging)
const httpClient = new HttpClient({
  logger: console, // Optional: for debugging
});

// Initialize the unified SDK client
const service = new RaiAcceptService(httpClient);

// Authenticate
const authResult = await service.retrieveAccessTokenWithCredentials(
  'your-username',
  'your-password',
  cert,  // Client certificate for mTLS
  key    // Client private key for mTLS
);
const accessToken = authResult?.accessToken;

// Create an order and payment session (two-step process)
const orderRequest = {
  invoice: {
    amount: 100.00,
    currency: 'EUR',
    description: 'Test payment',
    merchantOrderReference: 'ORDER-123',
    items: [
      {
        description: 'Product 1',
        numberOfItems: 1,
        price: 100.00
      }
    ]
  },
  urls: {
    successUrl: 'https://example.com/success',
    failUrl: 'https://example.com/fail',
    cancelUrl: 'https://example.com/cancel',
    notificationUrl: 'https://example.com/webhook'
  },
  consumer: {
    email: '[email protected]',
    firstName: 'John',
    lastName: 'Doe',
    phone: '+1234567890'
  },
  paymentMethodPreference: 'CARD',
  linkId: 'unique-link-id'
};

// Step 1: Create order entry
const orderResponse = await service.createOrderEntry(accessToken, orderRequest);
const orderIdentification = orderResponse.object.getOrderIdentification();
console.log('Order created:', orderIdentification);

// Step 2: Create payment session for the order
const paymentSessionResponse = await service.createPaymentSession(
  accessToken,
  orderRequest,
  orderIdentification
);

const paymentRedirectURL = paymentSessionResponse.object?.paymentRedirectURL;
console.log('Payment session created. Redirect customer to:', paymentRedirectURL);

API Reference

Initialization

import { RaiAcceptService, HttpClient } from '@smartbase-js/raiaccept-api-client';

// With HTTP client (recommended for logging)
const httpClient = new HttpClient({ logger: console });
const client = new RaiAcceptService(httpClient);

// Without HTTP client (uses default)
const client = new RaiAcceptService();

Authentication

const authResult = await client.retrieveAccessTokenWithCredentials(
  username,
  password,
  cert,  // Client certificate for mTLS
  key    // Client private key for mTLS
);
const accessToken = authResult?.accessToken;
// Also available: authResult.refreshToken, authResult.accessTokenExpiresIn, authResult.refreshTokenExpiresIn

Order Operations

  • client.createOrderEntry(accessToken, orderRequest) - Create a new order
  • client.createPaymentSession(accessToken, sessionRequest, externalOrderId) - Create payment session
  • client.getOrderDetails(accessToken, orderId) - Get order details
  • client.getOrderTransactions(accessToken, orderId) - Get order transactions

Transaction Operations

  • client.getTransactionDetails(accessToken, orderId, transactionId) - Get transaction details
  • client.refund(accessToken, orderId, transactionId, refundRequest) - Process a refund

Utility Functions

  • RaiAcceptService.transliterate(string) - Transliterate non-Latin characters
  • RaiAcceptService.transliterateAndLimitLength(string, limit) - Transliterate and limit length
  • RaiAcceptService.cleanPhoneNumber(phoneNumber) - Clean phone number format
  • RaiAcceptService.getCountryIso3(countryCode) - Convert 2-letter to 3-letter country code

TypeScript Support

This SDK is written in TypeScript and includes full type definitions. All types are exported and available for use in your TypeScript projects.

Testing

Run the test suite:

# Run unit tests (mocked)
npm run unit-tests

# Run integration tests (real API calls!)
npm run integration-tests

For more details, see TEST_SETUP.md and tests/README.md.

License

OSL-3.0