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.
đź”— Links
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.
Libraries
- common/api_config
- common/build_text_field
- common/custom_app_bar
- common/smatpay_colors
- common/smatpay_theme
- common/validators
- models/payment_model
- services/payment_service
- smatpay_payment_plugin
- util/crypto_util
- util/models/request/encrypt_card_request
- util/models/request/track_payment_request
- util/models/response/generic_response
- util/models/response/track_payment_response
- util/models/response/transaction_info_response
- view_models/payment_viewmodel
- views/payment_failed
- views/payment_form
- views/payment_form.form
- views/payment_success