New:Socket for Asana Is Now Available.Learn more
Get Started

@sapiom/node-http

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sapiom/node-http

Node.js HTTP/HTTPS integration for Sapiom SDK

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
11
-47.62%
Maintainers
1
Weekly downloads
 
Created
Source

@sapiom/node-http

npm version License: MIT

⚠️ Beta Status: Currently in v0.x. API may change before v1.0.0. Production-ready and actively maintained.

Node.js HTTP/HTTPS integration for Sapiom SDK providing automatic payment handling (402 errors) and pre-emptive authorization.

Installation

npm install @sapiom/node-http

Quick Start

import { createSapiomClient } from '@sapiom/node-http';

const client = createSapiomClient({
  sapiom: {
    apiKey: process.env.SAPIOM_API_KEY
  }
});

const response = await client.request({
  method: 'GET',
  url: 'https://api.example.com/data'
});

Features

  • ✅ Native Node.js http/https support
  • ✅ Automatic 402 payment handling
  • ✅ Pre-emptive authorization
  • ✅ Full TypeScript support
  • ✅ Uses Node.js standard library (no additional HTTP client needed)
  • ✅ Environment variable configuration

Configuration

import { createSapiomClient } from '@sapiom/node-http';

const client = createSapiomClient({
  sapiom: {
    apiKey: string;
    baseURL?: string;
    timeout?: number;
  },
  authorization?: {
    enabled?: boolean;
    authorizedEndpoints?: Array<{
      pathPattern: RegExp;
      service: string;
    }>;
  },
  payment?: {
    enabled?: boolean;
    onPaymentRequired?: (txId: string, payment: PaymentDetails) => void;
  }
});

Environment Variables

Automatically reads from environment:

  • SAPIOM_API_KEY (required)
  • SAPIOM_BASE_URL or SAPIOM_API_URL (optional)
  • SAPIOM_TIMEOUT (optional, in milliseconds)

License

MIT © Sapiom

Keywords

sapiom

FAQs

Package last updated on 12 Nov 2025

Related posts