npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@streamsdk/typescript

v1.0.4

Published

Official Node.js/TypeScript SDK for Stream API - Complete payment processing with consumers, products, subscriptions, invoices, and payment links

Readme

@streamsdk/typescript · Official Stream SDK for TypeScript

Official Node.js/TypeScript SDK for Stream API

npm version TypeScript License


📚 Table of Contents


Overview

The Stream SDK provides a complete TypeScript/JavaScript interface to the Stream payment platform. Process payments, manage subscriptions, create invoices, and handle customer data with full type safety and modern JavaScript features.

Key Features:

  • 🔐 Secure API Key authentication
  • 👥 Customer (Consumer) management
  • 📦 Product catalog management
  • 💳 Payment link creation
  • 🔄 Subscription handling
  • 🧾 Invoice generation
  • 🎟️ Coupon & discount management
  • 📝 Full TypeScript support
  • ⚡ ES Modules and CommonJS compatible

Installation

npm install @streamsdk/typescript

Or install from GitHub:

npm install github:streampayments/streamsdk-typescript#v1.0.0

Add to package.json

{
  "dependencies": {
    "@streamsdk/typescript": "^1.0.0"
  }
}

Quick Start

import StreamSDK from "@streamsdk/typescript";

// Initialize the SDK
const client = StreamSDK.init(process.env.STREAM_API_KEY!);

// Create a payment link
const result = await client.createSimplePaymentLink({
  name: "Monthly Subscription",
  amount: 99.99,
  consumer: {
    email: "[email protected]",
    name: "Ahmad Ali",
    phone: "+966501234567",
  },
  product: {
    name: "Premium Plan",
    price: 99.99,
  },
  successRedirectUrl: "https://yourapp.com/success",
  failureRedirectUrl: "https://yourapp.com/failure",
});

console.log("Payment URL:", result.paymentUrl);

SDK Features

Core Capabilities

| Feature | Description | | ------------------ | ------------------------------------------ | | Authentication | API Key and Bearer Token support | | Consumers | Create, update, list, and delete customers | | Products | Manage your product catalog | | Payment Links | Generate secure payment links | | Subscriptions | Handle recurring payments | | Invoices | Create and manage invoices | | Coupons | Discount and promotion management | | Webhooks | Real-time event notifications |

Supported Features

  • ✅ Single or multiple products per payment
  • ✅ Guest checkout (no consumer required)
  • ✅ Smart resource matching (automatic deduplication)
  • ✅ SAR currency (default)
  • ✅ Custom metadata support
  • ✅ Full TypeScript type definitions
  • ✅ ESM and CommonJS support

Usage

For detailed usage examples and API documentation, please refer to the API Documentation section below.

Authentication

Initialize the SDK with your API key:

import StreamSDK from "@streamsdk/typescript";

const client = StreamSDK.init(process.env.STREAM_API_KEY!);

For more authentication options and detailed examples for each resource, see the documentation links in the Available Resources and Operations section.


Examples

Explore complete TypeScript SDK examples in the examples directory:

View All Examples →

For Express.js examples, see streamsdk-express


Express.js Integration

For Express.js applications, we provide a separate adapter package with declarative handlers for checkout and webhooks:

streamsdk-express →


API Documentation

Available Resources and Operations

Consumers

Coupons

Invoices

  • get - Get Invoice
  • list - List Invoices

PaymentLinks

  • get - Get Payment Link
  • create - Create Payment Link
  • list - List Payment Links

Payments

Products

Subscriptions

Subscriptions.Freeze

  • delete - Delete Subscription Freeze

Click on each resource above to see detailed documentation with code examples, parameters, and response types.


Error Handling

The SDK throws errors for failed requests:

try {
  const consumer = await client.createConsumer({
    name: "Ahmad Ali",
    email: "invalid-email",
  });
} catch (error) {
  console.error("Error creating consumer:", error.message);
  console.error("Status:", error.status);
  console.error("Response:", error.response);
}

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Clone the repository
git clone https://github.com/streampayments/streamsdk-typescript.git
cd streamsdk-typescript

# Install dependencies
npm install

# Build the SDK
npm run build

# Run examples
npm run example

Support

Documentation

Help & Issues


License

MIT License - see LICENSE for details.