new TransactionService()
Creates a new TransactionService. Generally you should never create a PAYMILL service on your own. Instead use the exported "transactions".
- Source:
Classes
Methods
-
createWithPayment(payment, amount, currency, description, client, fee_amount, fee_payment, fee_currency, cb) → {Promise}
-
Create a transaction with a payment object.
Parameters:
Name Type Argument Description payment
string | Payment the payment object for the transaction 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 transaction. client
string | Client <optional>
the identifier of a client or a client. When this parameter is used, you have also to specify a payment method which is not assigned to a client yet. If you attempt to use this parameter when creating a transaction and when specifying a token or preauthorization, the specified client will be ignored. fee_amount
number | string Fee included in the transaction amount (set by a connected app). Mandatory if fee_payment is set. fee_payment
string the identifier of the payment from which the fee will be charged (creditcard-object or directdebit-object). Mandatory if fee_amount is set. fee_currency
string ISO 4217 formatted currency code. If not set, the currency of the transaction is used. cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Transaction or rejected with a PMError.- Type
- Promise
-
createWithPreauthorization(preauthroization, amount, currency, description, client, fee_amount, fee_payment, fee_currency, cb) → {Promise}
-
Create a transaction with a payment object.
Parameters:
Name Type Argument Description preauthroization
string | Preauthorization the preauthroization object for the transaction 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 transaction. client
string | Client <optional>
the identifier of a client or a client. When this parameter is used, you have also to specify a payment method which is not assigned to a client yet. If you attempt to use this parameter when creating a transaction and when specifying a token or preauthorization, the specified client will be ignored. fee_amount
number | string Fee included in the transaction amount (set by a connected app). Mandatory if fee_payment is set. fee_payment
string the identifier of the payment from which the fee will be charged (creditcard-object or directdebit-object). Mandatory if fee_amount is set. fee_currency
string ISO 4217 formatted currency code. If not set, the currency of the transaction is used. cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Transaction or rejected with a PMError.- Type
- Promise
-
createWithToken(token, amount, currency, description, client, fee_amount, fee_payment, fee_currency, cb) → {Promise}
-
Create a transaction 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 transaction. client
string | Client <optional>
the identifier of a client or a client. fee_amount
number | string Fee included in the transaction amount (set by a connected app). Mandatory if fee_payment is set. fee_payment
string the identifier of the payment from which the fee will be charged (creditcard-object or directdebit-object). Mandatory if fee_amount is set. fee_currency
string ISO 4217 formatted currency code. If not set, the currency of the transaction is used. cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Transaction or rejected with a PMError.- Type
- Promise
-
detail(obj, cb) → {Promise}
-
Get a transaction.
Parameters:
Name Type Argument Description obj
string | Transaction a transaction object or its id. note, if you set a transaction 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 Transaction or rejected with a PMError.- Type
- Promise
-
fromPayment(payment, amount, currency) → {TransactionService.Creator}
-
Create a transaction with a preauthorization. Chain further values by calling withXXX() functions and finish by calling create().
Parameters:
Name Type Description payment
string | Payment the payment object for the transaction or its id amount
string | number amount (in cents) which will be charged. currency
string ISO 4217 formatted currency code. - Source:
Returns:
a creator. when configured, please call create() -
fromPreauth(preauth, amount, currency) → {TransactionService.Creator}
-
Create a transaction with a preauthorization. Chain further values by calling withXXX() functions and finish by calling create().
Parameters:
Name Type Description preauth
string | Preauthorization the preauthroization object for the transaction or its id. amount
string | number amount (in cents) which will be charged. currency
string ISO 4217 formatted currency code. - Source:
Returns:
a creator. when configured, please call create() -
fromToken(token, amount, currency) → {TransactionService.Creator}
-
Create a transaction with a token. Chain further values by calling withXXX() functions and finish by calling create().
Parameters:
Name Type 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. - Source:
Returns:
a creator. when configured, please call create() -
list(count, offset, filter, order, cb) → {Promise}
-
List transactions.
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
Transaction.Filter | null <optional>
a list filter or null. order
Transaction.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
-
refund(transaction, amount, description, cb) → {Promise}
-
This function refunds a transaction that has been created previously and was refunded in parts or wasn't refunded at all. The inserted amount will be refunded to the credit card / direct debit of the original transaction. There will be some fees for the merchant for every refund.
Parameters:
Name Type Argument Description transaction
string | Transaction the transaction object or its id. amount
string | number amount (in cents) which will be charged. description
string additional description for this refund cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Refund or rejected with a PMError.- Type
- Promise
-
remove(obj, cb) → {Promise}
-
Remove a transaction.
Parameters:
Name Type Argument Description obj
Transaction a transaction object or its id. cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Transaction or rejected with a PMError.- Type
- Promise
-
update(obj, cb) → {Promise}
-
Update a transaction.
Parameters:
Name Type Argument Description obj
Transaction a transaction object or its id.Note, if you specify an object, the same object will be updated and returned! cb
Object <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Transaction or rejected with a PMError.- Type
- Promise