
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
cybersource-api
Advanced tools
NodeJs module for connect to cybersource using soap, with predefined functions.
Install with npm:
npm install cybersource-api
To start using this module it is only necessary to import and instantiate a CybersourceApi object, for versions check https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor/.
const CybersourceApi = require('cybersource-api');
let password = "<password provided by cybersource>";
let merchantID = "<merchandID provided by cybersource>";
let enviroment = "<enviroment for test or production>"; //use "production" or "development"
let language = "<language for message from api>"; // use "es" or "en"
let version = "<soap url version of cybersource>"; // ej: "1.151". check https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor/ for versions
let currency = "<currency definition for transactions>";
let cybersourceApi = new CybersourceApi(password,merchantID,enviroment,language,version,currency);
For authorize charge use next example, this will return an authorization that will be used later to capture
// Create object of type BillTo with required data
let billTo = new cybersourceApi.Models.BillTo("firstName","lastName","address","city","state","postalCode","country","email");
//Create object of type Card with required data
let card = new cybersourceApi.Models.Card("4111111111111111","02","2020","001");
//Create object of type AuthorizationRequest with previus objects created
let authorizationRequest = new cybersourceApi.Models.AuthorizationRequest("referenceCode",billTo,card);
//Call method authorizeCharge parsing the authorizationRequest object and amount to authorize
cybersourceApi.authorizeCharge(authorizationRequest,200).then(res=>{
console.log("Authorization Response: ",res);
/*
res = {
message: 'Success',
code: 100,
authorization: '5543146435356332104008' // <== save this for capture amount after
}
*/
}).catch(e=>{
console.log("Authorization Reqest: ",e);
/*
e = {
message: <message error>,
code: <code error>,
data: <object with more error info>
}
*/
});
For capture charge use next example, use authorization obtained in the previous step
let authorization = "1232313123123123";// authorization obtained in authorizationRequest
let captureRequest = new cybersourceApi.Models.CaptureRequest("referenceCode",authorization);
cybersourceApi.captureCharge(captureRequest,200).then(resCapture=>
console.log("Capture Request: ",resCapture)
/*
resCapture = {
message: 'Success',
code: 100
}
*/
).catch(e=>{
console.log("Capture Request: ",e);
/*
e = {
message: <message error>,
code: <code error>,
data: <object with more error info>
}
*/
});
// Create object of type BillTo with required data
let billTo = new cybersourceApi.Models.BillTo("firstName","lastName","address","city","state","postalCode","country","email");
//Create object of type Card with required data
let card = new cybersourceApi.Models.Card("4111111111111111","02","2020","001");
//Create object of type ChargeRequest with previus objects created
let chargeRequest = new cybersourceApi.Models.ChargeRequest("referenceCode",billTo,card);
//Call method chargeCard parsing the chargeRequest object and amount to charge
cybersourceApi.chargeCard(chargeRequest,200).then(res=>{
console.log("Charge Card Response: ",res);
/*
res = {
message: 'Success',
code: 100
}
*/
}).catch(e=>{
console.log("Authorization Reqest: ",e);
/*
e = {
message: <message error>,
code: <code error>,
data: <object with more error info>
}
*/
});
FAQs
Module for connect with CyberSource by soap methods.
The npm package cybersource-api receives a total of 26 weekly downloads. As such, cybersource-api popularity was classified as not popular.
We found that cybersource-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.