grootpay_sdk 0.0.1 copy "grootpay_sdk: ^0.0.1" to clipboard
grootpay_sdk: ^0.0.1 copied to clipboard

Flutter SDK for integrating GrootPay payments.

example/lib/main.dart

import 'dart:async';

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

Future<void> main() async {
  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Sdk example app'),
        ),
        body: Center(
          child: TextButton(
            child: Text("Pay With GrootPay"),
            onPressed: () {
              GrootpaySdk().initPayment(
                context: context,
                paymentConfig: PaymentConfig(
                  environment: Environment.development,
                  clientId: "first-epg1", // replace with your client id
                  clientSecret:
                      "test-secret", // replace with your client secret
                ),
                paymentCheckout: PaymentCheckout(
                  totalAmount: 100,
                  serviceType: "Online Payment",
                ),
                onPayment: (PaymentResponse success) {},
              );
            },
          ),
        ),
      ),
    );
  }
}