{"id":17525,"library":"classy-pay-client","title":"Classy Pay Client","description":"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.","status":"abandoned","version":"1.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/classy-org/classy-pay-client","tags":["javascript","classy","pay","client"],"install":[{"cmd":"npm install classy-pay-client","lang":"bash","label":"npm"},{"cmd":"yarn add classy-pay-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add classy-pay-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package exports a factory function that must be called immediately with configuration to get the client instance. This is a CommonJS-only module.","wrong":"import PayClient from 'classy-pay-client'; // Not supported, CJS only","symbol":"PayClient","correct":"const PayClient = require('classy-pay-client')({\n  apiUrl: 'https://pay.classy.org',\n  token: process.env.CLASSY_PAY_TOKEN,\n  secret: process.env.CLASSY_PAY_SECRET\n});"},{"note":"All client methods, including `get`, `post`, `put`, `del`, and `request`, are callback-based. There is no native Promise support.","wrong":"PayClient.getAsync(...) // No built-in Promise support","symbol":"PayClient.get","correct":"PayClient.get(0, '/transaction/1', (error, result) => { /* ... */ });"},{"note":"The general `request` method allows for custom HTTP methods and payloads. It also uses the Node.js standard error-first callback pattern.","wrong":"PayClient.requestAsync(...) // No built-in Promise support","symbol":"PayClient.request","correct":"PayClient.request(0, 'GET', '/transaction/1', null, null, (error, result) => { /* ... */ });"}],"quickstart":{"code":"const PayClient = require('classy-pay-client')({\n  apiUrl: process.env.CLASSY_PAY_API_URL || 'https://pay.classy.org',\n  timeout: parseInt(process.env.CLASSY_PAY_TIMEOUT || '10000', 10),\n  token: process.env.CLASSY_PAY_TOKEN || 'YOUR_PAY_TOKEN',\n  secret: process.env.CLASSY_PAY_SECRET || 'YOUR_PAY_SECRET'\n});\n\nconst appId = 0; // Replace with your actual application ID\n\nPayClient.get(appId, '/transaction/1', (error, result) => {\n  if (error) {\n    console.error('Error fetching transaction:', error);\n    // Handle specific error codes if necessary\n    if (error.statusCode === 404) {\n      console.log('Transaction not found.');\n    }\n  } else {\n    console.log('Fetched transaction:', result);\n  }\n});\n\nPayClient.post(appId, '/transactions', { amount: 1000, currency: 'USD' }, (error, result) => {\n  if (error) {\n    console.error('Error creating transaction:', error);\n  } else {\n    console.log('Created transaction:', result);\n  }\n});","lang":"javascript","description":"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."},"warnings":[{"fix":"Access the `del` method using bracket notation: `PayClient['del'](appId, resource, callback)` to avoid potential keyword conflicts.","message":"The `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.","severity":"breaking","affected_versions":">=1.0.0"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always use `process.env.YOUR_VARIABLE` for sensitive information and API URLs, providing fallback defaults for development environments.","message":"Configuration 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Call the factory function: `const PayClient = require('classy-pay-client')({ apiUrl: '...', token: '...', secret: '...' });`","cause":"The `require('classy-pay-client')` returns a factory function that must be immediately invoked with configuration.","error":"TypeError: PayClient is not a function"},{"fix":"Ensure the configuration object passed to `require('classy-pay-client')` includes `apiUrl`, `token`, and `secret`.","cause":"The client initialization object is missing required configuration properties like `token`, `secret`, or `apiUrl`.","error":"Error: Missing configuration option: token"},{"fix":"Replace `import PayClient from 'classy-pay-client';` with `const PayClient = require('classy-pay-client')({ ... });`","cause":"Attempting to use ES module `import` syntax instead of CommonJS `require` for an older package that does not support ESM.","error":"ReferenceError: PayClient is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}