Prerequisites
Before you begin, make sure you have:- Node.js 20+ (or Bun 1.1+) installed
- A Stripe test secret key (
sk_test_...)
Installation
Create your quickstart file
Create a new file called
quickstart.ts in your project directory:quickstart.ts
This example uses Stripe’s test card number
4242424242424242 which always succeeds. See Stripe’s testing guide for more test cards.Understanding the code
Let’s break down what’s happening in the quickstart:- Initialize VaultClient: Configure the SDK with your payment provider (Stripe) and routing rules
- Create a charge: Call
vault.charge()with payment details, customer information, and metadata - Handle errors: Catch and handle
VaultErrorinstances with detailed error information
The
idempotencyKey ensures that if you run the same charge request multiple times, it won’t create duplicate payments. Learn more in the Idempotency guide.Next steps
Now that you’ve created your first payment, explore these concepts to build production-ready integrations:Routing
Learn how to intelligently route payments across multiple providers
Idempotency
Prevent duplicate charges and ensure safe retries
Error Handling
Handle payment errors gracefully with detailed error context
Webhooks
Process real-time payment events from providers