Socket
Socket
Sign inDemoInstall

mollie

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mollie

Process payments with Mollie (unofficial)


Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Install size
128 kB
Created
Weekly downloads
 

Readme

Source

mollie

Unofficial Node.js module to access the Mollie payments API.

Build Status

Example

Create a payment for order 112233 at €12.34, return the paymentUrl to the customer.

var mollie = require ('mollie') ({
  apikey: 'test_apikey'
});

var payment = {
  amount: 12.34,
  description: 'Order #112233',
  redirectUrl: 'https://mywebshop.tld/order/112233',
  metadata: {
    order_id: 112233
  }
};

mollie.payments.create (payment, function (err, data) {
  if (err) { return console.log (err); }

  // i.e. redirect the user
  tellCustomer (data.links.paymentUrl);
});

Installation

To use this module you need an API key from your Mollie account. It is recommended to use your test API key during development.

npm install mollie

Error handling

The callbacks receive two parameters, err and data. When an error occurs err is an instance of Error with stack trace and additional properties, data will not be available. On success err is null and data is the parsed API response.

Example
function myCallback (err, data) {
  if (err) {
    console.log (err);
  } else {
    console.log (data);
  }
}

mollie.methods (myCallback);
Errors
messagedescriptionproperties
request failedThe request can not be madeerror
invalid responseThe API response can't be processederror, statusCode
API errorThe API returned an errorerror, statusCode

Usage

payments.create

( params, callback )

Create a payment.

argumenttyperequireddescription
paramsobjectyesPayment-object
callbackfunctionyesCallback function
var paymentObject = {
  amount: 12.34,
  description: 'Order #112233',
  redirectUrl: 'https://mywebshop.tld/order/112233',
  metadata: {
    order_id: 112233
  }
};

mollie.payments.create (paymentObject, callback);

API documentation

payments.list

( [params], callback )

List payments in your account.

argumenttyperequireddescription
paramsobjectnoPagination, count and offset
callbackfunctionyesCallback function
// Just recent
mollie.payments.list (callback)

// Specify a set
mollie.payments.list ({ offset: 20, count: 20 }, callback);

API documentation

payments.get

( paymentId, callback )

Get details about a payment.

argumenttyperequireddescription
paymentIdstringyesPayment id
callbackfunctionyesCallback function
mollie.payments.get ('tr_7UhSN1zuXS', callback);

API documentation

refunds.create

( paymentId, [amount], callback)

Create a refund for a payment

argumenttyperequireddescription
paymentIdstringyesPayment id
amountnumbernoAmount to refund, defaults to full amount
callbackfunctionyesCallback function
mollie.refunds.create ('tr_WDqYK6vllg', 10.95, callback);

API documentation

refunds.list

( paymentId, callback)

List refunds for a payment.

argumenttyperequireddescription
paymentIdstringyesPayment id
callbackfunctionyesCallback function
mollie.refunds.list ('tr_WDqYK6vllg', callback);

API documentation

refunds.delete

( paymentId, refundId, callback)

Get details about one refund for a payment.

argumenttyperequireddescription
paymentIdstringyesPayment id
refundIdstringyesRefund id
callbackfunctionyesCallback function
mollie.refunds.get ('tr_WDqYK6vllg', 're_4qqhO89gsT', callback);
  • The data argument to callback is boolean true on success.
  • The data argument to callback is boolean false on fail.

API documentation

methods.list

( [params], callback )

Get payment methods available to your account.

argumenttyperequireddescription
paramsobjectnoPagination, offset and count
callbackfunctionyesCallback function
mollie.methods.list (callback);

API documentation

issuers.list

( [params], callback )

List issuers for iDeal.

argumenttyperequireddescription
paramsobjectnoPagination, offset and count
callbackfunctionyesCallback function
mollie.issuers.list (callback);

API documentation

issuers.get

( issuerId, callback )

Get details about an issuer.

argumenttyperequireddescription
issuerIdstringyesIssuer id
callbackfunctionyesCallback function
mollie.issuers.get ('ideal_ABNANL2A', callback);

API documentation

Unlicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

Author

Franklin van de Meent | Website | Github

Keywords

FAQs

Last updated on 02 Oct 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc