Recurring billing is also used to keep track of the payments and outstanding charges of a customer according to their payment plan. The transaction types described below are available to align the customer’s balance.
Since all these transactions are initiated and controlled by a merchant, they belong to a group of merchant-initiated transactions. However, in the process of recurring billing you may also receive transactions from a processor. This type of transactions is considered as processor/bank initiated.
All transactions are divided into
merchant-initiated (i.e. that are submitted by a merchant) and
bank/processor-initiated (i.e. that are retrieved from a processor).
The following merchant-initiated transactions are available within the billing API:
To track the amounts that are expected to be withdrawn from a customer:
Invoice - represents an amount that a customer owes to a merchant.
Fee - represents the amount of a fee collected from a customer under certain conditions. The fee can be charged to a customer only if this condition is explicitly stated in the agreement between the customer and the merchant.
To record the funds withdrawn from a customer and deposited to the merchant’s account:
Payment - represents a real-time transaction used to cover a customer’s debt to a merchant. The amount of the debt equals the amount of a previously generated invoice.
Claim – represents a batch transaction used to cover a customer’s debt to a merchant. The amount of the debt equals the amount of a previously generated invoice.
To record funds withdrawn from the merchant’s bank account and transferred to the customer in case of an error, or when specific business scenario is applied:
Credit - represents an amount that a merchant owes to a customer. For example, a customer cancels their subscription. To cover an amount of a previously generated invoice, a credit transaction is used. After the credit is issued, the customer’s balance is set to zero.
Refund - represents amount that a merchant credits to a customer. Can only be performed after settlement.
Void - represents a transaction that has been reverted. Can only be performed before settlement. No further action can be taken for a voided transaction.
The following bank/processor-initiated transactions are available within the billing API:
Decline - represents a payment or refund that got declined.
Returns - represents a direct debit payment that has not been honored by a bank.
Chargeback - represents a reversal of a prior outbound transfer of funds from a customer's payment card to a merchant.
Chargeback Reversal - represents a reversal of a payment card chargeback, i.e. money is given back to the merchant or customer.
For merchant-initiated transactions you can apply the following actions. See
integration notes for more information.
|
create
|
process
|
reverse
|
Invoice
|
+
|
|
+
|
Credit
|
+
|
|
+
|
Fee
|
+
|
|
+
|
Payment
|
+
|
+
|
+
|
Claim
|
|
|
+
|
Refund
|
+
|
+
|
+
|
Void
|
|
|
|
Transaction-related Actions
There may be cases when some payments are processed outside of the gateway (i.e. paid via cash/check). However, the system needs to keep track of either transactions that were processed through the system (processed transactions) or those that were processed outside of the system (recorded transactions) to align the customer’s balance. For this reason, the recorded transactions need to be posted against customer’s account to keep balance of the customer. Thus, you can use the billing API for both processing of transactions and keeping record of them.
How to process a transaction
To submit a transaction for processing, the following actions are used:
- transactions~process action- submits a transaction to the gateway using data within the ProcessingRequest object. See integration notes for more information about payment data processing priority.
- payment-options/[payment-option-id~process] - submits a transaction to the gateway using data within the ProcessingRequest object and a previously created payment option, which ID is indicated in the request. See integration notes for more information about payment data processing priority.
In both cases, the transaction response returned by the system contain the following data:
- Transaction object with the payment or refund type that contains transaction data;
- ProcessingInfo object that contains data associated with the processed transaction.
These actions can be used to process only payment and refund transactions. See
integration notes for more information about transaction types.
How to create a transaction and store it within the gateway without processing
To add transaction record to the gateway without its processing,
transactions~create create action is used. It creates a transaction using data submitted within the Transaction object and saves the record within the gateway.
This action can be used to create an invoice, credit, fee, payment, refund transactions. See
integration notes for more information about transaction types.
How to cancel processed and stored transactions
In case you need to cancel a transaction that has been either created or processed, use the
reverse action. After the action is applied, the indicate transaction is reversed. Note that the transaction cannot be returned to its initial state after reversal. A list of the transaction types that can be reversed, as well as their final states, are listed below.
Transaction Type
|
Reversal Result
|
Invoice
|
Invoice Reversal
|
Credit
|
Credit Reversal
|
Customer Fee
|
Fee Reversal
|
Payment
|
Void or Refund
|
Claim
|
Refund
|
Refund
|
Refund Reversal
|
API response consists of the header (HTTP status code) and the body.
500 Internal Server Error is returned in the response header if the server encountered an unexpected issue that prevented it from processing and fulfilling the request that you have submitted. In this case, the response is not generated and, thus, the response body is empty.
If the request has been fulfilled on the server, 200 OK is returned in the header, and the API response is generated and returned in the body. The response body may contain an API object - if the request has been processed successfully or a Unipay Exception (response code and error message) - if an application error occurred while processing your request. For example, when processing a sale transaction, 200 OK status code is returned in the header both in the case of approval and decline.
Integration Type
|
Profile Type
|
direct debit processing
|
ach/proxy
|
cards batch processing
|
cards-batch/proxy
|
cards realtime processing
|
cards-realtime/proxy
|
tokenization
|
tokenization/proxy
|