Registry / http-networking / classy-pay-client

classy-pay-client

JSON →
library1.1.4jsnpmunverified

The `classy-pay-client` package provides a simple CommonJS-based client for interacting with the Classy Pay API. Its current and only stable version is 1.1.4, last published over seven years ago, indicating it is no longer actively maintained. The library utilizes a factory pattern for initialization, requiring an API URL, timeout, authentication token, and secret. It exposes methods for standard HTTP operations like GET, POST, PUT, and DELETE through callback-based functions, lacking modern features such as Promises or ESM support. This package is specifically designed for integration with the Classy Pay service and is likely used in legacy Node.js environments.

npm install classy-pay-client
INSTALL
IMPORT
SIG · CLASSY-PAY-CLIENT
C
classy-pay-client
http-networkingjavascriptv1.1.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PayClient
const PayClient = require('classy-pay-client')({ apiUrl: 'https://pay.classy.org', token: process.env.CLASSY_PAY_TOKEN, secret: process.env.CLASSY_PAY_SECRET });
import PayClient from 'classy-pay-client'; // Not supported, CJS only
The package exports a factory function that must be called immediately with configuration to get the client instance. This is a CommonJS-only module.
PayClient.get
PayClient.get(0, '/transaction/1', (error, result) => { /* ... */ });
PayClient.getAsync(...) // No built-in Promise support
All client methods, including `get`, `post`, `put`, `del`, and `request`, are callback-based. There is no native Promise support.
PayClient.request
PayClient.request(0, 'GET', '/transaction/1', null, null, (error, result) => { /* ... */ });
PayClient.requestAsync(...) // No built-in Promise support
The general `request` method allows for custom HTTP methods and payloads. It also uses the Node.js standard error-first callback pattern.

Demonstrates initializing the PayClient and making a GET request to fetch a transaction, followed by a POST request to create a new transaction, using callback patterns.

const PayClient = require('classy-pay-client')({ apiUrl: process.env.CLASSY_PAY_API_URL || 'https://pay.classy.org', timeout: parseInt(process.env.CLASSY_PAY_TIMEOUT || '10000', 10), token: process.env.CLASSY_PAY_TOKEN || 'YOUR_PAY_TOKEN', secret: process.env.CLASSY_PAY_SECRET || 'YOUR_PAY_SECRET' }); const appId = 0; // Replace with your actual application ID PayClient.get(appId, '/transaction/1', (error, result) => { if (error) { console.error('Error fetching transaction:', error); // Handle specific error codes if necessary if (error.statusCode === 404) { console.log('Transaction not found.'); } } else { console.log('Fetched transaction:', result); } }); PayClient.post(appId, '/transactions', { amount: 1000, currency: 'USD' }, (error, result) => { if (error) { console.error('Error creating transaction:', error); } else { console.log('Created transaction:', result); } });
Debug
Known issues
breakingThe `del` method is a JavaScript reserved keyword. While the client exports `del`, using it directly as an object property might lead to syntax errors in strict mode or certain environments. It's generally safer to use `client['del'](...)` if encountering issues.
fix
Access the `del` method using bracket notation: `PayClient['del'](appId, resource, callback)` to avoid potential keyword conflicts.
affects: >=1.0.0
gotchaThis package exclusively uses a CommonJS module syntax (`require`) and callback-based APIs. It does not natively support ES Modules (`import`) or modern Promise-based async/await patterns, which can lead to integration challenges in contemporary Node.js applications.
fix
For ESM projects, consider a wrapper function that returns a Promise or migrate to a more modern API client. For CJS projects, ensure all usage adheres to the callback pattern.
affects: >=1.0.0
gotchaThe `classy-pay-client` package has not been updated in over seven years (last published 2017). This means it likely contains outdated dependencies with potential security vulnerabilities and may not be compatible with newer Node.js versions or API changes in Classy Pay itself.
fix
Before using in production, thoroughly audit the package's dependencies for known vulnerabilities. Consider if an alternative or a direct API integration is more appropriate for long-term maintenance and security.
affects: >=1.0.0
gotchaConfiguration parameters like `apiUrl`, `token`, and `secret` are passed directly into the factory function. Hardcoding these values is insecure. They should always be sourced from environment variables or a secure configuration management system.
fix
Always use `process.env.YOUR_VARIABLE` for sensitive information and API URLs, providing fallback defaults for development environments.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: PayClient is not a function
The `require('classy-pay-client')` returns a factory function that must be immediately invoked with configuration.
fix
Call the factory function: `const PayClient = require('classy-pay-client')({ apiUrl: '...', token: '...', secret: '...' });`
Error: Missing configuration option: token
The client initialization object is missing required configuration properties like `token`, `secret`, or `apiUrl`.
fix
Ensure the configuration object passed to `require('classy-pay-client')` includes `apiUrl`, `token`, and `secret`.
ReferenceError: PayClient is not defined
Attempting to use ES module `import` syntax instead of CommonJS `require` for an older package that does not support ESM.
fix
Replace `import PayClient from 'classy-pay-client';` with `const PayClient = require('classy-pay-client')({ ... });`
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
24
Perplexity
1
OpenAI (training)
1
Resources