Skip to main content

Express SDK

For the complete Express SDK documentation, please visit our GitHub repository:

📦 @streamsdk/express on GitHub →

Overview​

The Stream Express SDK provides a clean, declarative way to integrate Stream payments into your Express.js applications. Built on top of @streamsdk/typescript, it offers drop-in handlers for checkout flows and webhook processing.

Key Benefits:

  • 🚀 Simple Integration - Add payment processing in minutes
  • 🔒 Type-Safe - Full TypeScript support with type definitions
  • 🎯 Event-Driven - Clean event handlers for webhook processing
  • 🔄 Flexible - Supports guest and authenticated checkout flows
  • 📦 Lightweight - Minimal dependencies (~7KB)
  • 🔗 Auto-Updates - Inherits stream-sdk updates automatically

Installation​

npm install @streamsdk/express

Quick Example​

import express from "express";
import { Checkout, Webhooks } from "@streamsdk/express";

const app = express();
app.use(express.json());

// Payment link handler
app.get("/checkout", Checkout({
apiKey: process.env.STREAM_API_KEY!,
successUrl: "https://myapp.com/success",
returnUrl: "https://myapp.com/cancel",
}));

// Webhook handler with events
app.post("/webhooks/stream", Webhooks({
apiKey: process.env.STREAM_API_KEY!,
onPaymentSucceeded: async (data) => {
console.log("Payment succeeded:", data);
// Update your database, send confirmation emails, etc.
},
onPaymentFailed: async (data) => {
console.log("Payment failed:", data);
},
onInvoiceCreated: async (data) => {
console.log("Invoice created:", data);
},
}));

app.listen(3000);

For complete documentation, examples, and API reference, visit the GitHub repository.

Demo Application​

Want to see it in action? Clone and run the Express SDK demo repository locally for a quick working example.