Push expense transactions into an active sync session.
Transactions represent individual expense events (card purchases, ATM withdrawals, refunds) that will be reconciled into the customer's accounting software.
Transaction Types
"payment"— a purchase/expense"refund"— a refund of a previous expense"reward"— a loyalty/cashback reward"chargeback"— a disputed transaction"transferIn"/"transferOut"— fund transfers"adjustmentIn"/"adjustmentOut"— accounting adjustments
Example
{:ok, _} = Codat.Expenses.Transactions.create(
client, company_id, sync_id,
[
%{
id: "txn-001",
type: "payment",
issueDate: "2024-01-15T00:00:00Z",
currency: "USD",
currencyRate: 1.0,
contactRef: %{id: "supplier-id", type: "Supplier"},
lineItems: [
%{
accountRef: %{id: "account-id"},
description: "Office supplies",
netAmount: 99.99,
taxAmount: 8.00,
taxRateRef: %{id: "tax-rate-id"},
trackingRefs: [%{id: "tracking-id", dataType: "trackingCategories"}]
}
]
}
]
)
Summary
Functions
Creates (pushes) expense transactions into a sync session.
Updates an existing transaction in a sync session.
Functions
@spec create( Codat.Client.t() | String.t(), String.t(), String.t() | list(), list() | keyword() ) :: {:ok, map()} | {:error, Codat.Error.t()}
Creates (pushes) expense transactions into a sync session.
Accepts a list of transaction objects.
Example
{:ok, result} = Codat.Expenses.Transactions.create(
client, company_id, sync_id, [transaction1, transaction2]
)
@spec update( Codat.Client.t() | String.t(), String.t(), String.t(), String.t() | map(), map() | keyword() ) :: {:ok, map()} | {:error, Codat.Error.t()}
Updates an existing transaction in a sync session.