CardPaymentRequest class

Payment request for card payments.

This class represents a debit/credit card payment request with secure tokenization. All sensitive card data is automatically sanitized and validated before processing.

Properties

  • cardNumber: Card number (13-19 digits, automatically sanitized and validated)
  • expiryMonth: Expiry month (MM format)
  • expiryYear: Expiry year (YY or YYYY format)
  • cvv: Card verification value (3-4 digits)
  • cardHolderName: Name on the card (automatically sanitized)
  • pin: Optional PIN for debit cards (4 digits)

Security

Card details are never stored locally and are immediately tokenized by Paystack's PCI DSS compliant infrastructure.

Example

final request = CardPaymentRequest(
  amount: 50000, // ₦500.00
  currency: Currency.ngn,
  email: 'customer@example.com',
  cardNumber: '4084084084084081',
  expiryMonth: '12',
  expiryYear: '25',
  cvv: '408',
  cardHolderName: 'John Doe',
  pin: '1234', // Optional for debit cards
  reference: 'card_payment_123',
);

final response = await AllPaystackPayments.initializePayment(request);
Inheritance

Constructors

CardPaymentRequest({required int amount, required Currency currency, required String email, String? reference, Map<String, dynamic>? metadata, String? callbackUrl, required String cardNumber, required String expiryMonth, required String expiryYear, required String cvv, required String cardHolderName, String? pin})

Properties

amount → int
Amount to be charged in kobo (smallest currency unit)
finalinherited
callbackUrl → String?
Callback URL for web payments
finalinherited
cardHolderName → String
Card holder's name
final
cardNumber → String
Card number (will be tokenized by Paystack)
final
currency → Currency
Currency for the transaction
finalinherited
cvv → String
Card CVV
final
email → String
Email address of the customer
finalinherited
expiryMonth → String
Card expiry month (MM)
final
expiryYear → String
Card expiry year (YY or YYYY)
final
hashCode → int
The hash code for this object.
no setterinherited
metadata → Map<String, dynamic>?
Additional metadata for the transaction
finalinherited
paymentMethod → PaymentMethod
Payment method type
finalinherited
pin → String?
PIN for debit cards (optional)
final
reference → String?
Unique reference for the transaction (optional, will be generated if not provided)
finalinherited
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.
override
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.
inherited
toString() → String
A string representation of this object.
inherited
validate() → void
Validate the request data.
override

Operators

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