Installation & Setup
Get Pesastream SDK up and running in your project
NPM Installation
Install the Pesastream SDK using npm:
npm install @pesastream/sdk
Initialize SDK
Create a new instance of Pesastream in your application:
import Pesastream from '@pesastream/sdk';
const pesastream = new Pesastream({
apiKey: process.env.PESASTREAM_API_KEY,
environment: 'production'
});Environment Variables
Create a .env.local file in your project root:
PESASTREAM_API_KEY=your_api_key_here PESASTREAM_ENVIRONMENT=production PESASTREAM_SECRET=your_webhook_secret
Next.js App Router Setup
For Next.js 13+ with App Router:
// lib/pesastream.ts
import Pesastream from '@pesastream/sdk';
export const pesastream = new Pesastream({
apiKey: process.env.PESASTREAM_API_KEY!,
environment: process.env.PESASTREAM_ENVIRONMENT as 'production' | 'sandbox'
});⚠️ Important: Never commit your .env.local file to version control. Add it to your .gitignore file.
✓ Ready to go! You're all set. Check out the API Reference section to start making your first payment request.