PhoenixKit.Modules.Billing.Transaction (phoenix_kit v1.7.71)

Copy Markdown View Source

Schema for payment transactions.

Transactions record actual payments and refunds for invoices.

  • Positive amount = payment
  • Negative amount = refund

Transactions are created when:

  • Admin marks invoice as paid (creates payment transaction)
  • Admin issues a refund (creates refund transaction)

There are no pending/failed statuses - a transaction is only recorded when the payment/refund has actually occurred.

Summary

Functions

Returns the absolute amount (always positive).

Creates a changeset for a transaction.

Returns true if this transaction is a payment (positive amount).

Returns the list of valid payment methods.

Returns true if this transaction is a refund (negative amount).

Returns the transaction type as a string.

Functions

absolute_amount(transaction)

Returns the absolute amount (always positive).

changeset(transaction, attrs)

Creates a changeset for a transaction.

payment?(transaction)

Returns true if this transaction is a payment (positive amount).

payment_methods()

Returns the list of valid payment methods.

refund?(transaction)

Returns true if this transaction is a refund (negative amount).

type(transaction)

Returns the transaction type as a string.