foundrex_flutter_mobile_sdk 0.0.20 copy "foundrex_flutter_mobile_sdk: ^0.0.20" to clipboard
foundrex_flutter_mobile_sdk: ^0.0.20 copied to clipboard

Foundrex Payments and KYC Flutter SDK.

example/lib/main.dart

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: PaymentDemo());
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Foundrex Payments')),
      body: Center(
        child: ElevatedButton(
          onPressed: () async {
            try {
              await Foundrex.payments.checkoutAndPay(
                userId: '0ecbc3ef-4dbc-401a-b45d-506537738838',
                amount: 25000,
                referenceId: 'booking_123',
              );
            } catch (e) {
              debugPrint('Payment failed: $e');
            }
          },
          child: const Text('Pay RM250'),
        ),
      ),
    );
  }
}