Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@basis-theory/tokestration-node-sdk-poc

Package Overview
Dependencies
Maintainers
10
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@basis-theory/tokestration-node-sdk-poc

A POC for a Node.js SDK for Tokestration

latest
npmnpm
Version
1.0.2
Version published
Maintainers
10
Created
Source

Multi-Provider Payment SDK

A TypeScript SDK for integrating multiple payment providers with a unified interface.

Supported Payment Providers

  • Stripe
  • Adyen
  • Braintree
  • TabaPay
  • Chase Orbital

Installation

npm install 🦄

Usage

  • Initialize the SDK:
const paymentService = new PaymentService({
    basisTheoryApiKey: "",
    providerAuth: {
        ...
    }
});
  • Tokenize a payment method:
const token = await paymentService.tokenize.stripe({ token: '15dab1fa-61c9-4ac1-a1f0-8199001dca74' });
const token = await paymentService.tokenize.braintree({ token: '15dab1fa-61c9-4ac1-a1f0-8199001dca74' });
  • Charge a token:
const charge = await paymentService.charge.stripe({ processingToken: token.processingToken, amount: 1000 });
const charge = await paymentService.charge.braintree({ processingToken: token.processingToken, amount: 1000 });

Running the Test Client

To run the test client and see the SDK in action, follow these steps:

  • Set up environment variables: Copy the .env.example file to .env and fill in your actual API keys and credentials for each payment provider.

    cp .env.example .env
    

    Then edit the .env file with your real credentials. (you can find these here)

  • Install dependencies: Make sure you have all the necessary dependencies installed.

    npm install
    
  • Run the test client: Execute the test client using the following command:

    npx tsx testClient.ts
    

    This will run through a series of tests for each supported payment provider, attempting to tokenize and charge (where implemented) using each provider.

Note: Some providers may throw errors if not fully configured or if there are issues with the provided credentials. These errors will be caught and logged to help with debugging.

Keywords

api

FAQs

Package last updated on 01 Oct 2024

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