PaymentIntent class

Represents a Payment Intent from the Micropay API.

Constructors

PaymentIntent({required String id, required int amount, required String currency, required PaymentIntentStatus status, String? clientSecret, String? phoneNumber, String? description, Map<String, dynamic>? metadata, DateTime? createdAt, DateTime? updatedAt, String? errorMessage, String? providerReference})
PaymentIntent.fromJson(Map<String, dynamic> json)
Creates a PaymentIntent from a JSON response.
factory

Properties

amount → int
Amount in the smallest currency unit (e.g., cents for KES).
final
clientSecret → String?
Client secret for confirming the payment.
final
createdAt → DateTime?
Timestamp when the intent was created.
final
currency → String
Three-letter ISO currency code (e.g., 'KES').
final
description → String?
Description of the payment.
final
errorMessage → String?
Error message if the payment failed.
final
formattedAmount → String
Formatted amount string (e.g., "KES 500.00").
no setter
hashCode → int
The hash code for this object.
no setterinherited
id → String
Unique identifier for the payment intent.
final
isFailed → bool
Whether the payment has failed.
no setter
isProcessing → bool
Whether the payment is still processing.
no setter
isSucceeded → bool
Whether the payment has succeeded.
no setter
metadata → Map<String, dynamic>?
Additional metadata attached to the payment.
final
phoneNumber → String?
Phone number for M-Pesa payment.
final
providerReference → String?
Provider-specific reference (e.g., M-Pesa receipt number).
final
requiresConfirmation → bool
Whether the payment requires confirmation.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → PaymentIntentStatus
Current status of the payment intent.
final
updatedAt → DateTime?
Timestamp when the intent was last updated.
final

Methods

copyWith({String? id, int? amount, String? currency, PaymentIntentStatus? status, String? clientSecret, String? phoneNumber, String? description, Map<String, dynamic>? metadata, DateTime? createdAt, DateTime? updatedAt, String? errorMessage, String? providerReference}) → PaymentIntent
Creates a copy of this PaymentIntent with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts the PaymentIntent to a JSON map.
toString() → String
A string representation of this object.
override

Operators

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