Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
mangopay-cardregistration-js-kit
Advanced tools
MANGOPAY Card Registration JavaScript Kit is a client library designed to take care of the card registration process.
MANGOPAY CardRegistration JavaScript Kit is a client library designed to take care of the card registration process. Refer to MANGOPAY REST API documentation and MANGOPAY card registration process for more information.
The library makes cross-origin Ajax calls (CORS) to get the card token and handle card registration with MANGOPAY API. Therefore it requires a browser that supports CORS. The kit does not support Internet Explorer 6 & 7 and Opera Mini.
The payment page that collects card details should use HTTPS. The kit will not work in Internet Explorer 8 and 9 if this page is not encrypted with SSL.
The kit has been written in pure JavaScript and has no external dependencies. It is enough to include the kit file on your card payment page:
<script type="text/javascript" src="mangopay-kit.js"></script>
Typically you would also have MANGOPAY SDK up and running to work with the MANGOPAY API. Java, PHP, .NET, Python and Ruby distributions are available.
The kit is also available for installation from npm if you prefer.
Set mangoPay.cardRegistration.clientId
to your MANGOPAY Client ID. mangoPay.cardRegistration.baseURL
is set to
sandbox environment by default. To enable production environment, set it to https://api.mangopay.com
.
Make sure you have the right configuration in place:
// Set MANGOPAY API base URL and Client ID
mangoPay.cardRegistration.baseURL = "https://api.sandbox.mangopay.com";
mangoPay.cardRegistration.clientId = {your-client-id};
Create a new CardRegistration object on the server and pass it over to the JavaScript kit:
// Initialize with card register data prepared on the server
mangoPay.cardRegistration.init({
cardRegistrationURL: {CardRegistrationURL property},
preregistrationData: {PreregistrationData property},
accessKey: {AccessKey property},
Id: {Id property}
});
Collect card details from the user on a payment form:
// Card data collected from the user
var cardData = {
cardNumber: $("#card_number").val(),
cardExpirationDate: $("#card_exp_date").val(),
cardCvx: $("#card_cvx").val(),
cardType: $("#card_type").val()
};
Then call mangoPay.cardRegistration.registerCard
:
// Register card
mangoPay.cardRegistration.registerCard(
cardData,
function(res) {
// Success, you can use res.CardId now that points to registered card
},
function(res) {
// Handle error, see res.ResultCode and res.ResultMessage
}
);
There is a simple PHP demo code included that shows how to use the kit. The demo page requires MANGOPAY SDK class to do the server-side work. Make sure that MANGOPAY PHP SDK is accessible to the demo page.
Jasmine unit tests are placed under tests dir and can be launched in a browser using tests/index.html. Unit test covers only validation classes and requests with invalid data.
MANGOPAY JavaScript Kit is distributed under MIT license.
Report bugs or suggest features using issue tracker at GitHub.
FAQs
MANGOPAY Card Registration JavaScript Kit is a client library designed to take care of the card registration process.
The npm package mangopay-cardregistration-js-kit receives a total of 5,370 weekly downloads. As such, mangopay-cardregistration-js-kit popularity was classified as popular.
We found that mangopay-cardregistration-js-kit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.