PaymentRequest class abstract
Base class for all payment requests.
This abstract class provides the foundation for all payment request types. It handles common validation, sanitization, and JSON serialization for payment data.
Subclasses
- CardPaymentRequest - For debit/credit card payments
- BankTransferRequest - For bank transfer payments
- MobileMoneyRequest - For mobile money payments
Properties
- amount: Transaction amount in kobo (smallest currency unit)
- currency: Transaction currency
- email: Customer's email (automatically sanitized)
- reference: Optional transaction reference
- paymentMethod: Type of payment method
- metadata: Optional custom metadata
- callbackUrl: Optional callback URL for web payments
Example
// Create a custom payment request
class CustomPaymentRequest extends PaymentRequest {
CustomPaymentRequest({
required super.amount,
required super.currency,
required super.email,
required super.paymentMethod,
});
@override
Map<String, dynamic> getSpecificJson() => {};
}
- Implementers
Constructors
-
PaymentRequest.new({required int amount, required Currency currency, required String email, String? reference, required PaymentMethod paymentMethod, Map<
String, dynamic> ? metadata, String? callbackUrl})
Properties
- amount → int
-
Amount to be charged in kobo (smallest currency unit)
final
- callbackUrl → String?
-
Callback URL for web payments
final
- currency → Currency
-
Currency for the transaction
final
- email → String
-
Email address of the customer
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
metadata
→ Map<
String, dynamic> ? -
Additional metadata for the transaction
final
- paymentMethod → PaymentMethod
-
Payment method type
final
- reference → String?
-
Unique reference for the transaction (optional, will be generated if not provided)
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getSpecificJson(
) → Map< String, dynamic> - Method to be implemented by subclasses for payment-method-specific data.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Convert request to JSON for API call.
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
) → void - Validate the request data.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited