Transactions
In this document, you’ll learn about an order’s transactions and usefulness.
What is a Transaction?
A transaction represents any order payment process, such as capturing or refunding an amount. It’s represented by the Transaction
data model.
The transaction’s main purpose is to ensure a correct balance between paid and outstanding amounts.
Transaction Reference
The Order Module doesn’t provide payment processing functionalities, so it doesn’t store payments that can be processed. For that, use the Payment Module or custom logic.
The Transaction
data model has two attributes that determine which data model and record holds the actual payment’s details:
reference
: indicates the table’s name in the database. For example,payment
if you’re using the Payment Module.reference_id
: indicates the ID of the record in the table. For example,pay_123
.
Checking Outstanding Amount
The order’s total is stored in the OrderSummary
's total
attribute. To check the outstanding amount of the order, the transaction amounts of an order are summed. Then:
Condition | Result |
---|---|
summary’s total - transaction amounts total = 0 | There’s no outstanding amount. |
summary’s total - transaction amounts total > 0 | The customer owes additional payment to the merchant. |
summary’s total - transaction amounts total < 0 | The merchant owes the customer a refund. |