Mollie ES6 API client for Node.js
Mollie API made ready for ES6 usage.
You can see a list of implemented functions at the bottom.
Till Version 1.0.0, this is WIP
Requirements
To use the Mollie API client, the following things are required:
- Node.js v4.4.2 or higher
- You can Sign up here for free.
Installation
You can install this module with NPM:
npm install mollie-es6
Getting started
Examples are in Express.js
Import the library.
import mollie from 'mollie-es6';
Set the basics needed
mollie.api_key = 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM';
All callback functions now return promises,
which you can either yield
in a try / catch
or resolve itfoo.then().catch()
Create a new payment.
try {
const payment = yield mollie.payments.create({
amount: 10.00,
description: "My first API payment",
redirectUrl: "https://webshop.com/api/payments/response"
});
res.redirect(payment.getPaymentUrl());
} catch (e) {
// Handle error
}
Retrieving a payment.
try {
const payment = yield mollie.payments.get(payment.id);
if(payment.isPaid()) {
console.log('Payment is paid');
}
} catch (e) {
// Handle error
}
Implemented Functions
Payments
Functionality | Implemented |
---|
Create | Yes |
Get | Yes |
List | Yes |
Methods
Functionality | Implemented |
---|
List | Yes |
Get | Yes |
Issuer
Functionality | Implemented |
---|
List | Yes |
Get | Yes |
Refunds
Functionality | Implemented |
---|
Create | Yes |
Get | Yes |
List | Yes |
Cancel | Yes |