Transactions
The Transaction entity represents a real financial movement between a Customer and the Portal.
A transaction can go in either direction:
- The customer pays the business (in this case,
amount
is positive) - The business refunds the customer (in this case,
amount
is negative)
Data Format
Common fields
The Transaction object includes all common-fields.
Specific fields
You can find the detailed format for output in the reference.
-
customerId
: The id of the associated Customer. -
amount
: The amount of the transaction. It can be either positive if the customer is paying the business, or negative if it's a refund from the business to the customer. -
usedAmount
: The portion of the transaction used for accounting purposes, which is essentially the sum of all the associatedTransactionUsages
. -
refundedAmount
: The portion of the transaction used to refund the Customer.
Transaction and TransactionUsage
It's important not to confuse Transaction and TransactionUsage. The Transaction solely represents the actual financial flow (such as a bank transfer, a card payment, a check, etc.) while the TransactionUsage refers to how this financial flow is applied to settle the customer's account status.
Example
Lets say that Customer X
has two invoices to pay:
- Invoice
F202404-102
for 300€ - Invoice
F202404-113
for 700€
He settles these two invoices with a single bank transfer of 1000€. This would result in:
- 1
Transaction
with anamount = 1000
. - 1
TransactionUsage
of 300€ linked toF202404-102
. - 1
TransactionUsage
of 700€ linked toF202404-113
.
We can retrieve the details of this transaction :
curl -L -X POST 'https://api.infast.fr/api/v2/transactions/665989215878ad5050f421cc' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer [access_token]'
{
"data": {
"id": "665989215878ad5050f421cc",
"customerId": "66598912d075d5afd39603e9",
"amount": 1000,
"usedAmount": 1000,
"refundedAmount": 0,
"date": "2024-04-29T19:56:04.311Z",
"method": "TRANSFER",
"details": {
"additionalInformations": "VIR Intia SAS FAC 102 ET 113"
},
"usages": [
{
"id": "63e3c82675de4f6978054579",
"customerId": "66598912d075d5afd39603e9",
"date": "2024-04-29T19:56:04.311Z",
"documentId": "6659898ab2b723fe46007c1e", // this is F202404-102
"amount": 300
},
{
"id": "665989ad7c67d7e710e7a752",
"customerId": "66598912d075d5afd39603e9",
"date": "2024-04-29T19:56:04.311Z",
"documentId": "665989b9a27c09b67be74f0d", // this is F202404-113
"amount": 700
}
]
}
}