Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@cybersource/flex-sdk-web
Advanced tools
Storing your customer’s card data dramatically increases your repeat-custom conversion rate, but it can also introduce additional risks along with a PCI DSS overhead - these are mitigated by tokenizing the card data. CyberSource replaces your customer’s card data with a token that can be used only by you.
Secure Acceptance Flexible Token API provides a secure method for tokenizing card data and reducing your PCI DSS burden. Card data is encrypted on the customer’s device and sent directly to CyberSource, bypassing your systems altogether.
This SDK simplifies the client-side integration and enables:
npm install @cybersource/flex-sdk-web --save
yarn add @cybersource/flex-sdk-web
The SDK is exposed as a UMD providing compatibility with most module loader specs or direct use in the browser via a script tag.
import flex from '@cybersource/flex-sdk-web';
flex.createToken(
{
/* options */
},
response => {
// use response
}
);
var flex = require('@cybersource/flex-sdk-web');
flex.createToken(
{
/* options */
},
function(response) {
// use response
}
);
<script data-main="main.js" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.3.1/require.min.js"></script>
// main.js
require.config({
paths: {
flex: '@cybersource/flex-sdk-web'
}
});
require(['flex'], function(flex) {
flex.createToken(
{
/* options */
},
function(response) {
// use response
}
);
});
<html>
<body>
<script src="flex-sdk-web.js"></script>
<script>
FLEX.createToken(
{
/* options */
},
function(response) {
// use response
}
);
</script>
</body>
</html>
Full documentation is located in the /docs
folder at the root of the installation directory.
The SDK is non-prescriptive on your payment flow design, making few assumptions about your development stack. It is easily integrated into any front-end setup. Described below is a minimal example for a web app using full page refreshes and form POSTs.
<!-- checkout template -->
<html>
<body>
<form id="paymentForm" action="/your/server/endpoint" method="post">
<input type="text" id="cardNumber" />
<input type="text" name="securityCode" />
<input type="text" name="expiryMonth" />
<input type="text" name="expiryYear" />
<select name="cardType">
<option value="001">VISA</option>
<option value="002">MasterCard</option>
<option value="003">AmericanExpress</option>
</select>
<input type="hidden" name="token" />
<button type="button" id="payBtn">Pay Now</button>
</form>
<script>
var jwk = {
/* flex public key in jwk format */
};
</script>
<script src="integration.js"></script>
</body>
</html>
// integration.js
import flex from '@cybersource/flex-sdk-web';
document.querySelector('#payBtn').on('click', () => {
const options = {
kid: jwk.kid,
encryptionType: 'RsaOaep',
keystore: jwk,
cardInfo: {
cardNumber: document.querySelector('#cardNumber').value,
cardType: document.querySelector('select[name="cardType"]').value,
expiryMonth: document.querySelector('input[name="expiryMonth"]').value,
expiryYear: document.querySelector('input[name="expiryYear"]').value
}
// production: true // without specifying this tokens are created in test env
};
flex.createToken(options, response => {
if (response.error) {
alert('There has been an error!');
console.log(response);
return;
}
document.querySelector("input[name='token']").value = response.token;
document.querySelector('#paymentForm').submit();
});
});
Note that the SDK can easily be integrated into a single page application, using AJAX for the key fetch and token submission.
Note that Safari 10 and below does not support an encryptionType of RsaOaep256
Code and documentation copyright 2017 CyberSource. Released under the CyberSource SDK License Agreement as detailed in ./LICENSE.md
.
FAQs
Easily create payment tokens using Flex API
The npm package @cybersource/flex-sdk-web receives a total of 1,223 weekly downloads. As such, @cybersource/flex-sdk-web popularity was classified as popular.
We found that @cybersource/flex-sdk-web demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.