Sale Lifetime
Since the sale is intended to more closely model the payment intent at business level, it's important that the status also reflects this during the whole lifetime of the sale. For most processes, looking only at the status of the sale will be enough to indicate whether or not the sale was paid successfully, but for specific use cases the transaction's status and the open, paid, refunded and reversed amounts of the sale can be checked. To illustrate how these statuses and amounts change during the lifetime of the sale, a short explanation and a few examples are given below.
Sale Amounts
| Name | Description |
|---|---|
| Open Amount | The amount of the sale that is available to create new transactions |
| Paid Amount | The total amount of the sale that has been successfully paid |
| Refunded Amount | The total amount of the sale that has been refunded |
| Reversed Amount | The total amount of the sale that has been reversed |
Sale Statuses
| Status |
|---|
| Open |
| Paid |
| Cancelled |
| Expired |
| Failed |
All sale statuses except for Open are final statuses
Transaction Statuses
| Status |
|---|
| Pending |
| Successful |
| Cancelled |
| Expired |
| Failed |
All transaction statuses except Pending are final statuses
Regular Payment
In the simplest case, a sale is created and the consumer is redirected to the payment page to choose a payment method. After that is done a transaction is started, and then completed.
flowchart LR
subgraph create [Sale Created]
direction LR
s1("`**Sale**
Status = Open
Open Amount = 10
Paid Amount = 0
`")
end
subgraph trx [Transaction Created]
direction LR
s2("`**Sale**
Status = Open
**Open Amount = 0**
Paid Amount = 0
`")
t2("`**Transaction**
**Status = Pending**
`")
end
subgraph complete [Transaction Completed]
direction LR
s3("`**Sale**
**Status = Paid**
Open Amount = 0
**Paid Amount = 10**
`")
t3("`**Transaction**
**Status = Successful**
`")
end
create --> trx
trx --> complete
Cancelled Transaction
When a transaction is cancelled, the open amount is set back so a new transaction can be started.
flowchart LR
subgraph create [Sale Created]
direction LR
s1("`**Sale**
Status = Open
Open Amount = 10
Paid Amount = 0
`")
end
subgraph trx [Transaction Created]
direction LR
s2("`**Sale**
Status = Open
**Open Amount = 0**
Paid Amount = 0
`")
t2("`**Transaction**
**Status = Pending**
`")
end
subgraph cancel [Transaction Cancelled]
direction LR
s3("`**Sale**
Status = Open
**Open Amount = 10**
Paid Amount = 0
`")
t3("`**Transaction**
**Status = Cancelled**
`")
end
create --> trx
trx --> cancel
Partial Transactions
Transactions do not always have to be for the full sale amount. For example, giftcards may be used to pay for a part of the sale amount, after which the remainder can be paid using any other available payment method.
flowchart LR
subgraph create [Sale Created]
direction LR
s1("`**Sale**
Status = Open
Open Amount = 20
Paid Amount = 0
`")
end
subgraph trx1 [Transaction 1 Created]
direction LR
s2("`**Sale**
Status = Open
**Open Amount = 10**
Paid Amount = 0
`")
t2("`**Transaction**
**Status = Pending**
Amount = 10
`")
end
subgraph complete1 [Transaction 1 Completed]
direction LR
s3("`**Sale**
**Status = Open**
Open Amount = 10
**Paid Amount = 10**
`")
t3("`**Transaction**
**Status = Successful**
`")
end
create --> trx1
trx1 --> complete1
flowchart LR
subgraph trx2 [Transaction 2 Created]
direction LR
s4("`**Sale**
Status = Open
**Open Amount = 0**
Paid Amount = 10
`")
t4("`**Transaction**
Status = Successful
Amount = 10
`")
tb4("`**Transaction**
**Status = Pending**
Amount = 10
`")
end
subgraph complete2 [Transaction 2 Completed]
direction LR
s5("`**Sale**
**Status = Paid**
Open Amount = 0
**Paid Amount = 20**
`")
t5("`**Transaction**
**Status = Successful**
Amount = 10
`")
t5b("`**Transaction**
**Status = Successful**
Amount = 10
`")
end
trx2 --> complete2
Retryable Transaction
When a transaction failed, the Sale is not always to Failed. In any situation where the Sale could still be completed by the consumer, which are most situations for Ecom sales and for POS for example the situation where the consumer has exceeded their daily limit and has to enter their pin, the Sale can remain Open with a failed transaction.
flowchart LR
subgraph create [Sale Created]
direction LR
s1("`**Sale**
Status = Open
Open Amount = 10
Paid Amount = 0
`")
end
subgraph trx [Transaction Created]
direction LR
s2("`**Sale**
Status = Open
**Open Amount = 0**
Paid Amount = 0
`")
t2("`**Transaction**
**Status = Pending**
`")
end
subgraph failed [Transaction Failed]
direction LR
s3("`**Sale**
Status = Open
**Open Amount = 10**
Paid Amount = 0
`")
t3("`**Transaction**
**Status = Failed**
`")
end
create --> trx
trx --> failed
If the consumer then correctly enters their PIN, a new transaction can be added to the sale, and the statuses and amounts will be updated.
flowchart LR
subgraph create [New Transaction Created]
direction LR
s3("`**Sale**
Status = Open
**Open Amount = 0**
Paid Amount = 0
`")
ta1("`**Transaction**
Status = Failed
`")
tb1("`**Transaction**
**Status = Pending**
`")
end
subgraph failed [New Transaction Completed]
direction LR
s2("`**Sale**
Status = Paid
Open Amount = 0
**Paid Amount = 10**
`")
ta2("`**Transaction**
Status = Failed
`")
tb2("`**Transaction**
**Status = Successful**
`")
end
create --> failed
Refunded Transaction
When a transaction is refunded, a new refund transaction is added to the sale. The refunded amount of the sale will increase, but the status will not be changed and remain on Paid.
flowchart LR
subgraph create [Paid Sale]
direction LR
s3("`**Sale**
Status = Paid
Open Amount = 0
Paid Amount = 10
Refunded Amount = 0
`")
t3("`**Transaction**
**Status = Successful**
`")
end
subgraph trx [Transaction Refunded]
direction LR
s4("`**Sale**
Status = Paid
Open Amount = 0
Paid Amount = 10
Refunded Amount = 10
`")
t4("`**Transaction**
Status = Successful
Amount = 10
`")
tb4("`**Transaction**
**Status = Successful**
Amount = -10
`")
end
create --> trxUpdated 10 days ago