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 paymentstring | Payment the payment object for the transaction or its id. amountstring | number amount (in cents) which will be charged. currencystring ISO 4217 formatted currency code. descriptionstring A short description for the transaction. clientstring | 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_amountnumber | string Fee included in the transaction amount (set by a connected app). Mandatory if fee_payment is set. fee_paymentstring the identifier of the payment from which the fee will be charged (creditcard-object or directdebit-object). Mandatory if fee_amount is set. fee_currencystring ISO 4217 formatted currency code. If not set, the currency of the transaction is used. cbObject <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 preauthroizationstring | Preauthorization the preauthroization object for the transaction or its id. amountstring | number amount (in cents) which will be charged. currencystring ISO 4217 formatted currency code. descriptionstring A short description for the transaction. clientstring | 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_amountnumber | string Fee included in the transaction amount (set by a connected app). Mandatory if fee_payment is set. fee_paymentstring the identifier of the payment from which the fee will be charged (creditcard-object or directdebit-object). Mandatory if fee_amount is set. fee_currencystring ISO 4217 formatted currency code. If not set, the currency of the transaction is used. cbObject <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 tokenstring the payment token, generated by the PAYMILL bridge. amountstring | number amount (in cents) which will be charged. currencystring ISO 4217 formatted currency code. descriptionstring A short description for the transaction. clientstring | Client <optional>
the identifier of a client or a client. fee_amountnumber | string Fee included in the transaction amount (set by a connected app). Mandatory if fee_payment is set. fee_paymentstring the identifier of the payment from which the fee will be charged (creditcard-object or directdebit-object). Mandatory if fee_amount is set. fee_currencystring ISO 4217 formatted currency code. If not set, the currency of the transaction is used. cbObject <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 objstring | Transaction a transaction object or its id. note, if you set a transaction object it will be updated, no new object will be created. cbObject <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 paymentstring | Payment the payment object for the transaction or its id amountstring | number amount (in cents) which will be charged. currencystring 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 preauthstring | Preauthorization the preauthroization object for the transaction or its id. amountstring | number amount (in cents) which will be charged. currencystring 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 tokenstring the payment token, generated by the PAYMILL bridge. amountstring | number amount (in cents) which will be charged. currencystring 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 countstring | number <optional>
limit of objects to be listed. use for pagination. offsetstring | number <optional>
offset. use for pagination. filterTransaction.Filter | null <optional>
a list filter or null. orderTransaction.Order | null <optional>
a list order or null. cbObject <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 transactionstring | Transaction the transaction object or its id. amountstring | number amount (in cents) which will be charged. descriptionstring additional description for this refund cbObject <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 objTransaction a transaction object or its id. cbObject <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 objTransaction a transaction object or its id.Note, if you specify an object, the same object will be updated and returned! cbObject <optional>
a callback. - Source:
Returns:
a promise, which will be fulfilled with a Transaction or rejected with a PMError.- Type
- Promise