Class: PreauthorizationService

PreauthorizationService

new PreauthorizationService()

Creates a new PreauthorizationService. Generally you should never create a PAYMILL service on your own. Instead use the exported "preauthorizations".
Source:

Methods

createWithPayment(payment, amount, currency, description, cb) → {Promise}

Create a preauthorization with a payment object.
Parameters:
Name Type Argument Description
payment string | Payment the payment object for the preauthorization or its id.
amount string | number amount (in cents) which will be charged.
currency string ISO 4217 formatted currency code.
description string A short description for the preauthorization.
cb Object <optional>
a callback.
Source:
Returns:
a promise, which will be fulfilled with a Preauthorization or rejected with a PMError. The actual preauthorization is in the transaction member "preauthorization".
Type
Promise

createWithToken(token, amount, currency, description, cb) → {Promise}

Create a preauthorization with a token.
Parameters:
Name Type Argument Description
token string the payment token, generated by the PAYMILL bridge.
amount string | number amount (in cents) which will be charged.
currency string ISO 4217 formatted currency code.
description string A short description for the preauthorization.
cb Object <optional>
a callback.
Source:
Returns:
a promise, which will be fulfilled with a Preauthorization or rejected with a PMError. The actual preauthorization is in the transaction member "preauthorization".
Type
Promise

detail(obj, cb) → {Promise}

Get a preauthorization.
Parameters:
Name Type Argument Description
obj string | Preauthorization a preauthorization object or its id. note, if you set a preauthorization object it will be updated, no new object will be created.
cb Object <optional>
a callback.
Source:
Returns:
a promise, which will be fulfilled with a Preauthorization or rejected with a PMError.
Type
Promise

list(count, offset, filter, order, cb) → {Promise}

List preauthorizations.
Parameters:
Name Type Argument Description
count string | number <optional>
limit of objects to be listed. use for pagination.
offset string | number <optional>
offset. use for pagination.
filter Preauthorization.Filter | null <optional>
a list filter or null.
order Preauthorization.Order | null <optional>
a list order or null.
cb Object <optional>
a callback.
Source:
Returns:
a promise, which will be fulfilled with a PayMillObjectList or rejected with a PMError.
Type
Promise

remove(obj, cb) → {Promise}

Remove a preauthorization.
Parameters:
Name Type Argument Description
obj Preauthorization a preauthorization object or its id.
cb Object <optional>
a callback.
Source:
Returns:
a promise, which will be fulfilled with a Preauthorization or rejected with a PMError.
Type
Promise