alatpay_sdk 2.0.0 copy "alatpay_sdk: ^2.0.0" to clipboard
alatpay_sdk: ^2.0.0 copied to clipboard

A Flutter SDK for seamless Alat Pay integration, enabling secure, fast, and reliable in-app payments using the official ALATPay checkout popup.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'ALATPay Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(title: 'ALATPay Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  void _startPayment() {
    final customer = Customer(
      email: "jane.doe@email.com",
      phone: "09038818841",
      firstName: "Jane",
      lastName: "Doe",
    );

    final request = PaymentRequest(
      businessId: "your-business-id",
      amount: 100,
      currency: "NGN",
      customer: customer,
    );

    AlatPaySdk.startPayment(
      context,
      request: request,
      apiKey: "your-alatpay-api-key",
     // color: "#01070e", // Optional: customize popup color
      onPaymentComplete: (result) {
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(
            backgroundColor: result.success ? Colors.green : Colors.red,
            content: Text(
              result.success
                  ? "Payment successful: ${result.message}"
                  : "Payment failed: ${result.message}",
            ),
          ),
        );
      },
      onClose: () {
        ScaffoldMessenger.of(context).showSnackBar(
          const SnackBar(
            content: Text("Payment cancelled"),
          ),
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          onPressed: _startPayment,
          child: const Text('Pay with ALATPay'),
        ),
      ),
    );
  }
}
1
likes
160
points
133
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Flutter SDK for seamless Alat Pay integration, enabling secure, fast, and reliable in-app payments using the official ALATPay checkout popup.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, webview_flutter

More

Packages that depend on alatpay_sdk