qattapay_flutter 1.0.4 copy "qattapay_flutter: ^1.0.4" to clipboard
qattapay_flutter: ^1.0.4 copied to clipboard

Official QattaPay Flutter SDK — group contribution checkout for Flutter apps.

example/lib/main.dart

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

void main() => runApp(const ExampleApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'QattaPay Flutter Example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF454C80)),
        useMaterial3: true,
      ),
      home: const CheckoutPage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('QattaPay button')),
      body: Padding(
        padding: const EdgeInsets.all(24),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            const Text(
              'In production, getIntentId must call YOUR backend. '
              'Never embed the merchant API key in the app.',
              style: TextStyle(height: 1.4),
            ),
            const SizedBox(height: 24),
            QattaPayButton(
              mode: QattaPayMode.dev,
              variant: QattaPayButtonVariant.primary,
              label: QattaPayButtonLabel.split,
              getIntentId: () async {
                // Replace with: POST https://your-api/qattapay/intent → intentId
                throw StateError(
                  'Wire getIntentId to your backend before opening checkout.',
                );
              },
              onError: (err) {
                ScaffoldMessenger.of(context).showSnackBar(
                  SnackBar(content: Text('$err')),
                );
              },
            ),
            const SizedBox(height: 16),
            QattaPayButton(
              mode: QattaPayMode.dev,
              variant: QattaPayButtonVariant.outline,
              label: QattaPayButtonLabel.pay,
              locale: QattaPayLocale.ar,
              getIntentId: () async => 'intent_demo',
              onError: (err) {
                ScaffoldMessenger.of(context).showSnackBar(
                  SnackBar(content: Text('$err')),
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
150
points
182
downloads

Documentation

Documentation
API reference

Publisher

verified publisherqatta.sa

Weekly Downloads

Official QattaPay Flutter SDK — group contribution checkout for Flutter apps.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

crypto, flutter, http, url_launcher, webview_flutter

More

Packages that depend on qattapay_flutter