Registry / payments / cybersource-rest-auth

cybersource-rest-auth

JSON →
library0.0.10jsnpmunverified

A Node.js helper library for authenticating to the CyberSource REST API. Version 0.0.10 is the current stable release; maintained as part of CyberSource's official SDK suite. Supports HTTP Signature and JWT authentication mechanisms. Enables POST, GET, PUT, DELETE requests with automatic signing. Provides MetaKey support for child merchants. Configurable via cybs.json. Key differentiator: dedicated auth abstraction layer for CyberSource REST API, not a generic HTTP client. Low release cadence (limited updates). Unsuitable for browser usage; Node.js only (v8.11.1+). ESM not supported (CommonJS only).

npm install cybersource-rest-auth
INSTALL
IMPORT
SIG · CYBERSOURCE-REST-A
C
cybersource-rest-auth
paymentsjavascriptv0.0.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

ApiClient
var ApiClient = require('cybersource-rest-auth').ApiClient;
import { ApiClient } from 'cybersource-rest-auth';
CommonJS only; no ESM support. Use require() always.
cybersource-rest-auth
var auth = require('cybersource-rest-auth');
import auth from 'cybersource-rest-auth';
Default export via module.exports; no named exports for the main module.
AuthenticationSDK
var AuthSDK = require('cybersource-rest-auth').AuthenticationSDK;
import { AuthenticationSDK } from 'cybersource-rest-auth';
AuthenticationSDK is a property of the exported object, not a direct export.

CommonJS initialization with HTTP Signature authentication and a POST request to the CyberSandbox sandbox endpoint.

var auth = require('cybersource-rest-auth'); var config = { authenticationType: 'http_signature', merchantID: 'your_merchant_id', runEnvironment: 'CyberSource.Environment.SANDBOX', merchantKeyId: 'your_key_id', merchantsecretKey: 'your_secret_key', enableLog: true, logDirectory: './log', logMaximumSize: 10485760, logFilename: 'cybs', useMetaKey: false }; var authInstance = new auth.AuthenticationSDK(config); var payload = { clientReferenceInformation: { code: 'test' } }; authInstance.post('/pts/v2/payments', payload, function(err, response) { if (err) console.error(err); else console.log('Payment created:', response); });
Debug
Known issues
breakingNode.js version <8.11.1 is not supported and will cause runtime errors.
fix
Upgrade Node.js to 8.11.1 or later.
affects: >=0.0.1
deprecatedThe 'request' dependency is deprecated and not maintained. Node.js built-in fetch is recommended.
fix
Switch to a maintained HTTP client like axios or use the native fetch if available.
affects: <1.0.0
gotchaESM imports will not work; the package is CommonJS only. Attempting 'import' will fail with SyntaxError.
fix
Use require() instead of import.
affects: >=0.0.1
gotchaThe 'cybs.json' file must be in the project root or the config must be passed programmatically; otherwise the SDK throws 'Cannot read property of undefined'.
fix
Ensure cybs.json is in the root directory or pass config object to the constructor.
affects: >=0.0.1
gotchaMetaKey usage requires setting 'useMetaKey: true' and providing 'portfolioID' for HTTP Signature. Missing portfolioID leads to 'Invalid request' errors.
fix
Include portfolioID in the config when using MetaKey with HTTP Signature.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'cybersource-rest-auth'
Package not installed or not in node_modules.
fix
Run 'npm install cybersource-rest-auth' in the project directory.
TypeError: Cannot read property 'AuthenticationSDK' of undefined
Using import instead of require() or incorrect path.
fix
Use 'var auth = require('cybersource-rest-auth');' and then 'auth.AuthenticationSDK'.
TypeError: authInstance.post is not a function
AuthSDK not properly initialized or wrong method name (e.g., .get, .post, .put, .delete).
fix
Ensure you create an instance with 'new auth.AuthenticationSDK(config)' and use .post/ .get/ .put/ .delete.
Error: Unable to parse configuration file. Please ensure that cybs.json is present.
Missing or malformed cybs.json.
fix
Create a valid cybs.json file in the application root directory.
Upgrade
Version history
0.0.10latest on npm
Audit
Dependencies
node-forgerequiredCryptographic operations for JWT and HTTP signature
jwt-simplerequiredJWT encoding/decoding
requestrequiredHTTP client for API calls
winstonrequiredLogging framework
node-localstoragerequiredLocal storage for caching tokens
Agent activity
40 hits · last 30 days
node
36
Perplexity
1
Resources
cybersource-rest-auth — npm install cybersource-rest-auth · libregistry