Node.js wrapper for Paymill API/V2.x.
This module as been created as a drop in replacement for komola's paymill-node which does not support the latest features in the Paymill API/V2.1
npm install paymill
The first thing to do, is create a paymill instance using your Paymill private key
and an optional apiVersion
(which can be either v2
or v2.1
, with the last one being the default, if the argument is omitted).
var paymill = require('paymill')('apiKey'[, 'apiVersion']);
We can now access the API using a generic pattern, either with a callback as the last argument otherwise a Promise is returned.
paymill.{resourceName}.{method}([arguments], function (err, response) {
// ...
});
paymill.{resourceName}.{method}([arguments])
.then(function (response) {
// ...
})
.catch(function (err) {
// ...
});
Plain JavaScript object, e.g. { key: 'value' }
is expected as data
and as the argument in all create
-method
- clients
create(client)
list(data)
details(clientId)
update(clientId, data)
remove(clientId)
- offers
create(offer)
list(data)
details(offerId)
update(offerId, data)
remove(offerId)
- payments
create(payment)
list(data)
details(paymentsId)
remove(paymentsId)
- preauthorizations
create(preauthorization)
list(data)
details(preauthorizationId)
remove(preauthorizationId)
- refunds
create(transactionId, amount[, description])
(for consistency,amount
can also be an object withamount
anddescription
)list(data)
details(refundId)
- subscriptions
create(subscription)
list(data)
details(subscriptionId)
update(subscriptionId, data)
remove(subscriptionId, data)
- transactions
create(transaction)
list(data)
details(transactionId)
update(transactionId, data)
- webhooks
create(webhook)
list(data)
details(webhookId)
update(webhookId, data)
remove(webhookId)
- Add unit and integration tests
- Add examples to show how to use the wrapper in various cases
Written by Daniel Juhl. Inspiration from Ask Bjørn Hansen and komola's paymill-node.