mamo_business_sdk 1.0.3 copy "mamo_business_sdk: ^1.0.3" to clipboard
mamo_business_sdk: ^1.0.3 copied to clipboard

Mamo Business SDK for Flutter

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:mamo_business_sdk/mamo_business_sdk.dart';

void main() {
  runApp(const MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late MamoPaymentSessionController controller;

  @override
  void initState() {
    super.initState();

    String link = "https://business.mamopay.com/widget/pay/mostafa-827c56";

    controller = MamoPaymentSessionController(
      sessionLink: link,
      onPaymentSuccess: (session) async {
        print("Payment Success");
        print("session is " + session.status);
        print("session id " + session.transactionId);
        await Future.delayed(const Duration(seconds: 4), () {
          Navigator.pushReplacement(
            context,
            MaterialPageRoute(builder: (context) => const ConfirmationScreen()),
          );
        });
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Mamo SDK Checkout app'),
        ),
        body: Center(
          child: MamoPaymentSessionView(controller: controller),
        ),
      ),
    );
  }
}

class ConfirmationScreen extends StatelessWidget {
  const ConfirmationScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Order Confrimation"),
      ),
      body: Center(
        child: Text("Order confirmed "),
      ),
    );
  }
}
1
likes
130
points
135
downloads

Publisher

unverified uploader

Weekly Downloads

Mamo Business SDK for Flutter

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface, webview_flutter

More

Packages that depend on mamo_business_sdk