PaystackBulkChargeItem class

Represents a single item in a Paystack bulk charge batch.

Pass a list of these to POST /bulkcharge on the Paystack API to charge multiple authorizations in a single request. This model is a data container; the actual API call is your responsibility.

Example

final items = [
  PaystackBulkChargeItem(
    authorizationCode: 'AUTH_xxxxx',
    amount: 50.00,
    reference: PayWithPayStack().generateUuidV4(),
    email: 'user1@example.com',
  ),
  PaystackBulkChargeItem(
    authorizationCode: 'AUTH_yyyyy',
    amount: 20.00,
    reference: PayWithPayStack().generateUuidV4(),
    email: 'user2@example.com',
  ),
];

// Serialise for the Paystack bulk charge API:
final body = jsonEncode(items.map((i) => i.toJson()).toList());

Constructors

PaystackBulkChargeItem({required String authorizationCode, required double amount, required String reference, required String email})
const

Properties

amount double
Amount to charge in the major currency unit (e.g. 50.00 for GHS 50). Converted to the subunit automatically in toJson.
final
authorizationCode String
The authorization code from a previous successful transaction. Obtained from PaymentData.authorization?.authorizationCode.
final
email String
The email address of the customer being charged.
final
hashCode int
The hash code for this object.
no setterinherited
reference String
A unique reference for this charge in the batch.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Serialises this item to the JSON format expected by the Paystack POST /bulkcharge endpoint.
toString() String
A string representation of this object.
override

Operators

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