Transactions & reversals
Every movement of money is a transaction made of balanced journal entries. Each transfer, payout and service charge returns a transactionId you can look up here.
Get a transaction
GET/ledger/transaction/{transactionId}
Returns the transaction and the debit and credit entries that make it up.
Response
{
"message": "Transaction retrieved",
"status": "OK",
"transaction": {
"_id": "665f2a0b9a3b4c0012ab3501",
"type": "transfer",
"status": "posted",
"mode": "test"
},
"entries": [
{
"accountId": "665f1c2e9a3b4c0012ab34cd",
"drCr": "debit",
"amount": 150050,
"currency": "NGN"
},
{
"accountId": "665f1c2e9a3b4c0012ab34ce",
"drCr": "credit",
"amount": 150050,
"currency": "NGN"
}
]
}Transaction types include collection, payout, transfer, fee, serviceCharge and reversal. Entry amounts are in minor units.
| Status | Meaning |
|---|---|
200 | Transaction returned. |
404 | No such transaction in this mode. |
curl -X GET "https://usetreasurywire.com/api/v1/ledger/transaction/665f2a0b9a3b4c0012ab3501" \
-H "Authorization: Bearer $TREASURYWIRE_KEY"Reverse a transaction
POST/ledger/transaction/{transactionId}/reverse
Undoes a posted transaction by posting mirrored entries. The original is never edited or deleted, so your audit trail stays intact.
201 Created
{
"message": "Transaction reversed",
"status": "OK",
"transaction": {
"_id": "665f2b119a3b4c0012ab3510",
"type": "reversal",
"status": "posted"
},
"entries": []
}| Status | Meaning |
|---|---|
201 | Reversal posted. |
404 | No such transaction in this mode. |
422 | The transaction isn't posted, so it can't be reversed. |
curl -X POST "https://usetreasurywire.com/api/v1/ledger/transaction/665f2a0b9a3b4c0012ab3501/reverse" \
-H "Authorization: Bearer $TREASURYWIRE_KEY"