micropaysdk library

Micropay Flutter SDK

Official SDK for accepting M-Pesa payments in Flutter apps.

Quick Start

import 'package:micropaysdk/micropaysdk.dart';

// Initialize
final micropay = Micropay(publicKey: 'pk_test_...');

// Create and confirm payment
final intent = await micropay.createPaymentIntent(
  amount: 500,
  phoneNumber: '254712345678',
  description: 'Premium Upgrade',
);

await micropay.confirmPaymentIntent(intent.id, intent.clientSecret);

Classes

Micropay
The main Micropay client for Flutter applications.
MicropayButton
A styled button for initiating Micropay payments.
MicropayConfig
Configuration options for the Micropay client.
MpesaPhoneField
A phone number input field with country code selector for M-Pesa payments.
PaymentIntent
Represents a Payment Intent from the Micropay API.
PaymentSheet
A pre-built bottom sheet UI for handling M-Pesa payments.
PaymentSheetTheme
Theme customization for the payment sheet.

Enums

MicropayButtonSize
Button size variants.
MicropayButtonStyle
Button style variants.
MpesaCountry
Supported M-Pesa countries.
PaymentIntentStatus
Status of a Payment Intent.

Exceptions / Errors

MicropayError
Represents an error from the Micropay API.