Transaction class

Represents a Paystack transaction with comprehensive details about the payment.

This model contains all the information returned by Paystack's transaction APIs, including payment status, customer information, authorization details, and metadata.

Example usage:

final transaction = Transaction(
  id: 123456789,
  domain: 'test',
  status: 'success',
  reference: 'tx_abc123',
  amount: 50000, // ₦500.00 in kobo
  createdAt: DateTime.now(),
  channel: 'card',
  currency: 'NGN',
);
Mixed-in types
Annotations
  • @MappableClass.new()

Constructors

Transaction({required int id, required String domain, required String status, required String reference, required int amount, required DateTime createdAt, required String channel, required String currency, String? receiptNumber, String? gatewayResponse, DateTime? paidAt, String? ipAddress, dynamic metadata, TimelineLog? log, int? fees, Map<String, dynamic>? feesSplit, AuthorizationData? authorization, Customer? customer, String? plan, Map<String, dynamic>? split, String? orderId, int? requestedAmount, Map<String, dynamic>? posTransactionData, dynamic source, dynamic feesBreakdown, dynamic connect, DateTime? transactionDate, Map<String, dynamic>? planObject, Map<String, dynamic>? subaccount})
Creates a new Transaction instance.
const

Properties

amount int
Transaction amount in the smallest currency unit. (kobo for NGN, pesewas for GHS).
final
authorization → AuthorizationData?
Authorization details for card transactions.
final
channel String
Payment channel used for this transaction.
final
connect → dynamic
Information about connected accounts or marketplace transactions.
final
copyWith TransactionCopyWith<Transaction, Transaction, Transaction>
no setterinherited
createdAt DateTime
Timestamp when the transaction was created.
final
currency String
Currency code for this transaction.
final
customer → Customer?
Customer information associated with this transaction.
final
domain String
The domain environment where the transaction was created.
final
fees int?
Transaction fees charged by Paystack (in smallest currency unit).
final
feesBreakdown → dynamic
Detailed breakdown of all fees charged for this transaction.
final
feesSplit Map<String, dynamic>?
Breakdown of how transaction fees are split among different parties.
final
gatewayResponse String?
Response message from the payment gateway.
final
hashCode int
The hash code for this object.
no setterinherited
id int
Unique identifier for the transaction.
final
ipAddress String?
IP address of the customer when the transaction was initiated.
final
log TimelineLog?
Timeline log containing the transaction's processing history.
final
metadata → dynamic
Custom metadata attached to the transaction.
final
orderId String?
Merchant's order ID for internal tracking.
final
paidAt DateTime?
Timestamp when the payment was completed (if successful).
final
plan String?
Plan code if this transaction is part of a subscription plan.
final
planObject Map<String, dynamic>?
Full plan object details if this transaction is associated with a subscription.
final
posTransactionData Map<String, dynamic>?
Additional data for Point of Sale transactions.
final
receiptNumber String?
Receipt number generated for this transaction (if available).
final
reference String
Unique reference code for this transaction.
final
requestedAmount int?
Original amount requested before any modifications.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source → dynamic
Source information about how this transaction was initiated.
final
split Map<String, dynamic>?
Split payment configuration for this transaction.
final
status String
Current status of the transaction.
final
subaccount Map<String, dynamic>?
Subaccount details if this transaction involves a subaccount.
final
transactionDate DateTime?
Alternative timestamp for the transaction (may differ from createdAt).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
inherited
toMap() Map<String, dynamic>
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited