Transactions

In this document, you’ll learn about an order’s transactions and its use.

What is a Transaction?#

A transaction represents any order payment process, such as capturing or refunding an amount. It’s represented by the OrderTransaction data model.

The transaction’s main purpose is to ensure a correct balance between paid and outstanding amounts.

Transactions are also associated with returns, claims, and exchanges if additional payment or refund is required.


Checking Outstanding Amount#

The order’s total amounts are stored in the OrderSummary's totals property, which is a JSON object holding the total details of the order.

Code
1{2  "totals": {3    "total": 30,4    "subtotal": 30,5    // ...6  }7}

To check the outstanding amount of the order, its transaction amounts are summed. Then, the following conditions are checked:

ConditionResult

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.


Transaction Reference#

The Order Module doesn’t provide payment processing functionalities, so it doesn’t store payments that can be processed. Payment functionalities are provided by the Payment Module.

The OrderTransaction data model has two properties 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 from the Payment Module.
  • reference_id: indicates the ID of the record in the table. For example, pay_123.
Was this page helpful?
Edit this page