Typescripts SDK
Type-safe SDK for the BagelPay API – manage SaaS subscriptions, products, and revenue in TypeScript/Node.js environments.
📦 Installation Guide
npm install bagelpay🚀 Quick Start
30-Second Quick Demo
import { BagelPayClient } from 'bagelpay';
async function main() {
// Initialize the client
const client = new BagelPayClient({
apiKey: 'your-api-key'
});
try {
// Create a product
const product = await client.createProduct({
name: `Premium Subscription ${Date.now()}`,
description: 'Monthly premium subscription with unique identifier',
price: 29.99,
currency: 'USD',
billingType: 'subscription',
taxInclusive: false,
taxCategory: 'digital_products',
recurringInterval: 'monthly',
trialDays: 7
});
console.log('✅ Product url:', product.productUrl);
} catch (error) {
console.error('❌ Error:', error);
}
}
// Run the main function
main().catch(console.error);Core Features
🛍️ Product Management
Create and manage products
Support for both subscriptions and one-time payments
Flexible pricing and billing intervals
Tax configuration options
💳 Checkout & Payments
Secure checkout session creation
Customizable success/cancel URLs
Metadata support for tracking
Real-time payment status
👥 Customer Management
Customer creation and retrieval
Subscription management
Payment history tracking
📊 Analytics & Reporting
Transaction listing and filtering
Subscription analytics
Customer insights
API Reference
Client Initialization
Products
Create Product
List Products
Get Product
Checkout
Create Checkout Session
Transactions
List Transactions
Subscriptions
List Subscriptions
Customers
List Customers
Error Handling
The SDK provides specific error types for better error handling:
TypeScript Support
The SDK is written in TypeScript and provides full type definitions out of the box. No additional @types packages are required.
Environment Configuration
Test Mode
Use test mode for development and testing:
Production Mode
For production environments:
🚀 Webhook Integration
Support
Documentation: https://bagelpay.gitbook.io/docs/documentation
API Reference: https://bagelpay.gitbook.io/docs/apireference
Support: support@bagelpayent.com
GitHub Issues: Report bugs and feature requests
License
MIT License - see LICENSE file for details.
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Last updated