PaymentResponse class

Response from a payment operation.

This class encapsulates the result of any payment-related operation, including payment initiation, verification, and status checks. It provides a unified interface for handling payment responses across all payment methods.

Properties

Example

final response = await AllPaystackPayments.initializeCardPayment(...);

if (response.isSuccessful) {
  print('Payment successful: ${response.reference}');
  print('Amount: ₦${response.amount / 100}');
} else {
  print('Payment failed: ${response.gatewayResponse}');
}

Constructors

PaymentResponse.new({required String reference, required PaymentStatus status, required int amount, required Currency currency, required PaymentMethod paymentMethod, String? gatewayResponse, Map<String, dynamic>? rawResponse, DateTime? createdAt})
PaymentResponse.fromApiResponse(Map<String, dynamic> response)
Factory method to create response from API data.
factory

Properties

amount int
Transaction amount in kobo (smallest currency unit)
final
createdAt DateTime?
Timestamp of the transaction
final
currency Currency
Currency used for the transaction
final
gatewayResponse String?
Gateway response message
final
hashCode int
The hash code for this object.
no setterinherited
isFailed bool
Check if payment failed.
no setter
isPending bool
Check if payment is pending.
no setter
isSuccessful bool
Check if payment was successful.
no setter
paymentMethod PaymentMethod
Payment method used
final
rawResponse Map<String, dynamic>?
Raw response data from Paystack API
final
reference String
Unique transaction reference
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status PaymentStatus
Payment status
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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