gq_payment_flutter_sdk 1.0.1 copy "gq_payment_flutter_sdk: ^1.0.1" to clipboard
gq_payment_flutter_sdk: ^1.0.1 copied to clipboard

GrayQuest Payment Flutter SDK will have a support for ERP Flutter Apps with all the payment modes and make easy fee payment collection.

example/main.dart

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:gq_payment_flutter_sdk/gq_payment_flutter_sdk.dart';

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

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

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

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

  @override
  State<PaymentScreen> createState() => _PaymentScreenState();
}

class _PaymentScreenState extends State<PaymentScreen> {
  final GQPaymentSDK gqPaymentSDK = GQPaymentSDK();

  handleSuccess(value) {
    debugPrint("Success data: $value ");
  }

  handleFailure(value) {
    debugPrint("Failed data: $value ");
  }

  handleCancel(value) {
    debugPrint("'Cancel data: $value ");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: const Text("GrayQuest Payment Example"),
        centerTitle: true,
      ),
      body: Center(
        child: ElevatedButton(
            onPressed: () {
              Map<String, dynamic> clientObject = {
                // REQUIRED FIELD
                "auth": {
                  "client_id": "<YOUR_CLIENT_ID>",
                  "client_secret_key": "<YOUR_SECREY_KEY>",
                  "gq_api_key": "<YOUR_GQ_API_KEY>"
                },
                "student_id": "<student_id>", // REQUIRED FIELD
                "env": "test", // REQUIRED FIELD
                "customer_number": "<customer_number>", //Optional field
                "pp_config": {"slug": "<slug>"}, //Optional field
                //Optional field
                "customization": {
                  "logo_url": "<logo_url>",
                  " theme_color":
                      "<theme_color>" // Must be 6 digit hex color code. ex.#2C3E50
                },
                //Optional field
                "fee_headers": {
                  "fee_type_1": "<fee_type_1>",
                  "fee_type_2": "<fee_type_2>",
                  "fee_type_n": "<fee_type_n>",
                },
              };

              final configData = jsonEncode(clientObject);

              gqPaymentSDK.checkout(
                context,
                onCancel: handleCancel,
                onFailed: handleFailure,
                onSuccess: handleSuccess,
                configData: configData,
              );
            },
            child: const Text("Open GQ SDK")),
      ),
    );
  }
}
4
likes
150
points
61
downloads

Publisher

verified publishergrayquest.com

Weekly Downloads

GrayQuest Payment Flutter SDK will have a support for ERP Flutter Apps with all the payment modes and make easy fee payment collection.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_cashfree_pg_sdk, flutter_inappwebview, http, razorpay_flutter

More

Packages that depend on gq_payment_flutter_sdk