smat_pay_payment_plugin 1.0.9 copy "smat_pay_payment_plugin: ^1.0.9" to clipboard
smat_pay_payment_plugin: ^1.0.9 copied to clipboard

A payment plugin form for Smatpay users.

smat_pay_payment_plugin #

A Flutter payment plugin form for Smatpay users.


๐Ÿš€ Getting Started #

Add this package to your pubspec.yaml:

dependencies:
  smat_pay_payment_plugin: ^<latest_version>

Then run:

flutter pub get

โš ๏ธ Prerequisites #

Before using this plugin, ensure you have:

  • A valid payment code from Smatpay.
  • Your base URL and endpoint mode configured.

๐Ÿ’ก Example Usage #

Use it anywhere in your app.

Sandbox

import 'package:flutter/material.dart';
import 'package:smat_pay_payment_plugin/smatpay_payment_plugin.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: PaymentForm(
        paymentCode: "dd59bd5a-175d-4832-b9ea-8de01494c742",
        baseUrl: 'https://dev.smatpay.africa:8443',
        endpointMode: EndpointMode.test,
      ),
    );
  }
}

Production

import 'package:flutter/material.dart';
import 'package:smat_pay_payment_plugin/smatpay_payment_plugin.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: PaymentForm(
        paymentCode: "dd59bd5a-175d-4832-b9ea-8de01494c742",
        baseUrl: 'https://live.smatpay.africa:8443',
        endpointMode: EndpointMode.live,
      ),
    );
  }
}

Optional parent-app branding #

PaymentForm uses SmatPay's bundled colors and logo by default. A parent app can optionally supply its own SmatPayThemeData and remote logoUrl. If the logo URL is absent, blank, or cannot be loaded, the bundled SmatPay logo is shown instead.

Reuse the parent app's Material theme #

class CheckoutApp extends StatelessWidget {
  const CheckoutApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
          seedColor: const Color(0xFF005F73),
        ),
        useMaterial3: true,
      ),
      home: Builder(
        builder: (context) => PaymentForm(
          paymentCode: 'your-payment-code',
          baseUrl: 'https://dev.smatpay.africa:8443',
          endpointMode: EndpointMode.test,
          theme: SmatPayThemeData.fromColorScheme(
            Theme.of(context).colorScheme,
          ),
          logoUrl: 'https://example.com/merchant-logo.png',
        ),
      ),
    );
  }
}

Override only the colors you need #

PaymentForm(
  paymentCode: 'your-payment-code',
  baseUrl: 'https://dev.smatpay.africa:8443',
  endpointMode: EndpointMode.test,
  theme: const SmatPayThemeData(
    primary: Color(0xFF005F73),
    accent: Color(0xFF0A9396),
    accentVariant: Color(0xFF028090),
    background: Color(0xFFF4FFFD),
    border: Color(0xFFB9E7DF),
  ),
)

๐Ÿ“„ License #

MIT ยฉ 2024 Udean Mbano


๐Ÿ™Œ Contributing #

Contributions are welcome. Please fork the repository and submit a pull request for review.


๐Ÿ’ฌ Support #

For any issues or feature requests, please open an issue on GitHub.



Replace:

  • <latest_version> with your current published version (e.g. 0.0.1)
  • GitHub links if using your organizationโ€™s repository.

Let me know if you need an **example **`` for your package publishing pipeline today.