Registry / payments / cybersource-rest-client

cybersource-rest-client

JSON →
library0.0.79jsnpmunverified

The official Node.js SDK for the CyberSource REST API (version 0.0.79) allows merchants to process payments, manage transactions, and access CyberSource services from Node.js applications. It requires Node.js 14.21.3 or higher. The SDK supports multiple authentication methods: HTTP Signature (deprecated), JWT with P12 certificate, and JWT with Shared Secret (recommended migration path from HTTP Signature, enabling Message Level Encryption). It also supports MetaKey for portfolio-level management. Key differentiators: official CyberSource SDK, support for JWT Shared Secret, MetaKey functionality, and clear deprecation guidance for HTTP Signature.

npm install cybersource-rest-client
INSTALL
IMPORT
SIG · CYBERSOURCE-REST-C
C
cybersource-rest-client
paymentsjavascriptv0.0.79
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
import ApiClient from 'cybersource-rest-client'
const ApiClient = require('cybersource-rest-client').ApiClient
Default export. CommonJS require returns the constructor directly; named imports may fail.
PaymentsApi
import { PaymentsApi } from 'cybersource-rest-client'
const PaymentsApi = require('cybersource-rest-client').PaymentsApi
Named export for the Payments API class. CommonJS destructuring is also correct.
MerchantConfig
import { MerchantConfig } from 'cybersource-rest-client'
const MerchantConfig = require('cybersource-rest-client')
TypeScript type import: import type { MerchantConfig } from 'cybersource-rest-client'.

Shows how to create a merchant config, instantiate the API client, and make a payment using JWT Shared Secret auth.

import ApiClient from 'cybersource-rest-client'; import { PaymentsApi } from 'cybersource-rest-client'; const merchantConfig = { authenticationType: 'jwt', jwtKeyType: 'SHARED_SECRET', merchantID: process.env.CYBERSOURCE_MERCHANT_ID ?? '', runEnvironment: 'apitest.cybersource.com', merchantKeyId: process.env.CYBERSOURCE_MERCHANT_KEY_ID ?? '', merchantsecretKey: process.env.CYBERSOURCE_MERCHANT_SECRET_KEY ?? '', enableLog: true, logDirectory: './log', logFilename: 'cybs' }; const apiClient = new ApiClient(); apiClient.setMerchantConfig(merchantConfig); const paymentsApi = new PaymentsApi(apiClient); const request = { clientReferenceInformation: { code: 'test_123' }, orderInformation: { amountDetails: { totalAmount: '100.00', currency: 'USD' }, billTo: { firstName: 'John', lastName: 'Doe', country: 'US' } }, paymentInformation: { card: { number: '4111111111111111', expirationMonth: '12', expirationYear: '2031' } } }; async function run() { try { const response = await paymentsApi.createPayment(request); console.log('Payment ID:', response.id); } catch (error) { console.error('API Error:', error); } } run();
Debug
Known issues
deprecatedHTTP Signature authentication is deprecated. Migrate to JWT with Shared Secret.
fix
Change authenticationType to 'jwt', set jwtKeyType: 'SHARED_SECRET', and keep same merchantKeyId/merchantsecretKey.
affects: >=0.0.1
breakingNode.js version < 14.21.3 not supported. SDK uses ES2020 features.
fix
Upgrade Node.js to 14.21.3 or higher.
affects: >=0.0.1
gotchaRequiring `cybersource-rest-client` via CommonJS returns the ApiClient constructor directly, not an object with it as a property.
fix
Use const ApiClient = require('cybersource-rest-client'); correctly.
affects: >=0.0.1
deprecated`logObj` configuration property has been replaced by `enableLog` and `logDirectory`.
fix
Use enableLog: true and specify logDirectory and logFilename.
affects: <0.0.70
Errors
Common errors & fixes
TypeError: ApiClient is not a constructor
Incorrect import path: used named import `{ ApiClient }` instead of default import.
fix
Use `import ApiClient from 'cybersource-rest-client'` or `const ApiClient = require('cybersource-rest-client')`.
Error: Merchant config is missing authenticationType
Authentication type property not set or misspelled.
fix
Ensure `authenticationType` is set to 'http_signature' or 'jwt' (string, case-sensitive).
Error: JWT verification failed: invalid signature
Incorrect merchantKeyId or merchantsecretKey for JWT Shared Secret.
fix
Double-check the credentials from CyberSource portal. Ensure jwtKeyType is 'SHARED_SECRET'.
Upgrade
Version history
0.0.79latest on npm
Audit
Dependencies
jsonwebtokenrequiredRequired for JWT authentication (both P12 and Shared Secret).
cryptooptionalNode.js built-in, used for HTTP Signature cryptography (deprecated).
Agent activity
36 hits · last 30 days
node
32
Perplexity
1
Resources
cybersource-rest-client — npm install cybersource-rest-client · libregistry