This wrapper simplifies working with the MultiSafepay API and lets you integrate MultiSafepay in your Node.js application.
MultiSafepay is a Dutch payment service provider, which takes care of contracts, processing transactions, and collecting payment for a range of local and international payment methods. Start selling online today and manage all your transactions in one place!
- You will need a MultiSafepay account. Consider creating a test account first.
- If using Node 8.0+, we recommend using async/await. For older versions of Node, use promises or callbacks instead of async/await.
With npm:
npm install @multisafepay/api-wrapper --save
And yarn:
yarn add @multisafepay/api-wrapper
Set up the client for testing with ES6 imports:
import MSPClient from '@multisafepay/api-wrapper';
const client = new MSPClient('apiKey');
With require module:
const MSPClient = require('@multisafepay/api-wrapper').default;
const client = new MSPClient('apiKey');
To use the test environment:
const client = new MSPClient('apiKey', { environment: 'test' });
Create a test order with async/await:
# This code creates a redirect iDEAL order
async () => {
try {
const multiSafePayClient = new MSPClient(apiKey, { environment: 'test' });
return await multiSafePayClient.orders.create({
type: 'redirect',
order_id: "my-order-id-1",
gateway: 'iDEAL',
currency: 'EUR',
amount: '1000',
description: 'Test Order Description',
payment_options: {
notification_url:
'http://www.example.com/client/notification?type=notification',
redirect_url:
'http://www.example.com/client/notification?type=redirect',
cancel_url: 'http://www.example.com/client/notification?type=cancel',
close_window: '',
},
customer: {
locale: 'en_US',
},
second_chance: {
send_email: true,
},
});
} catch (error) {
console.log(error);
}
};
With promises:
# This code creates a redirect iDEAL order
multiSafePayClient.orders
.create({
type: 'redirect',
order_id: 'my-order-id-1',
gateway: 'iDEAL',
currency: 'EUR',
amount: '1000',
description: 'Test Order Description',
payment_options: {
notification_url:
'http://www.example.com/client/notification?type=notification',
redirect_url: 'http://www.example.com/client/notification?type=redirect',
cancel_url: 'http://www.example.com/client/notification?type=cancel',
close_window: '',
},
customer: {
locale: 'en_US',
},
second_chance: {
send_email: true,
},
})
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
See more examples.
Create an issue on this repository or email integration@multisafepay.com
Feel free to create a pull request on this repository to suggest improvements.
See MultiSafepay Docs – API reference.