@basis-theory/tokestration-node-sdk-poc
v1.0.2
Published
A POC for a Node.js SDK for Tokestration
Downloads
7
Readme
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.