Chapa class

The Chapa class provides functionality for integrating payments using the Chapa SDK.

This class handles payment initialization, parameter validation, and routing to the appropriate payment method (native or web-based).

Constructors

Chapa.paymentParameters({required BuildContext context, required String publicKey, required String currency, required String amount, required String email, required String phone, required String firstName, required String lastName, required String txRef, required String title, required String desc, required String namedRouteFallBack, bool nativeCheckout = true, Color? buttonColor, bool? showPaymentMethodsOnGridView, List<String>? availablePaymentMethods, dynamic onPaymentFinished(String, String, String)?})
Constructs a Chapa object with the required payment parameters.

Properties

amount String
Payment amount.
getter/setter pair
availablePaymentMethods List<String>?
List of available payment methods. If null, all methods are enabled.
getter/setter pair
buttonColor Color?
Custom button color for the checkout.
final
context BuildContext
The BuildContext for navigation and UI rendering.
getter/setter pair
currency String
Payment currency (e.g., USD, ETB). Ensured to be uppercase.
getter/setter pair
desc String
Payment description
getter/setter pair
email String
Customer's email address.
getter/setter pair
firstName String
Customer's first name.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
lastName String
Customer's last name.
getter/setter pair
namedRouteFallBack String
The fallback named route after the payment is made.
getter/setter pair
nativeCheckout bool
The boolean values which Indicates whether to use the native checkout or web
getter/setter pair
onPaymentFinished ↔ dynamic Function(String, String, String)?
Callback triggered when the payment process finishes.
getter/setter pair
phone String
Customer's phone number.
getter/setter pair
publicKey String
Public API key required for Merchant authentication.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showPaymentMethodsOnGridView bool?
Option to show payment methods in a grid view.
final
title String
Payment title
getter/setter pair
txRef String
Transaction reference, a unique identifier for the payment.
getter/setter pair

Methods

initiatePayment() → void
Initiates the payment process based on the nativeCheckout flag.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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