hyper_pay_payment 1.0.20 copy "hyper_pay_payment: ^1.0.20" to clipboard
hyper_pay_payment: ^1.0.20 copied to clipboard

HYPER PAY FLUTTER PLUGIN , Payment method : VISA, MASTER, MADA, APPLE PAY

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:hyper_pay_payment/hyper_pay_payment.dart';
import 'package:hyper_pay_payment/hyper_pay_payment_platform_interface.dart';



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

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

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

class _MyAppState extends State<MyApp> {
  bool? isPaymentSuccess = null;

  String result = "";

  String checkOutID = "F30799FD40277E972B9261E4195051C9.prod01-vm-tx14";

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(

        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body:  SafeArea(
            child: Center(
              child: Column(
                children: [
                  ///--------------------------- check connection

                  SizedBox(
                    height: 20,
                  ),
                  GestureDetector(
                    child: Container(
                      color: Colors.grey,
                      padding: EdgeInsets.all(10),
                      child: Text("Check Connection Between Dart And Native"),
                    ),
                    onTap: () async {
                      result = await HyperPayPayment.getPlatformVersion();
                      setState(() {});
                    },
                  ),

                  ///--------------------------- Auto detect
                  SizedBox(
                    height: 20,
                  ),
                  GestureDetector(
                    child: Container(
                      color: Colors.grey,
                      padding: EdgeInsets.all(10),
                      child: Text("Ready Use UI Auto Detect Brand Type"),
                    ),
                    onTap: () async {
                      await autoDetectBrandType();
                    },
                  ),

                  ///--------------------------- single Brand visa

                  SizedBox(
                    height: 20,
                  ),
                  GestureDetector(
                    child: Container(
                      color: Colors.grey,
                      padding: EdgeInsets.all(10),
                      child: Text("Single Payment Button Visa Only"),
                    ),
                    onTap: () async {
                      await singleBrandTypeVisa();
                    },
                  ),

                  ///--------------------------- single Brand Apple Pay

                  SizedBox(
                    height: 20,
                  ),
                  GestureDetector(
                    child: Container(
                      color: Colors.grey,
                      padding: EdgeInsets.all(10),
                      child: Text("Single Payment Button Apple Pay"),
                    ),
                    onTap: () async {
                      await singleBrandTypeApplePay();
                    },
                  ),

                  ///----------------------------- result

                  SizedBox(
                    height: 20,
                  ),

                  /// result
                  if (result != "")
                    Text(
                      result,
                      style: TextStyle(color: Colors.blue),
                    ),

                  /// status
                  if (isPaymentSuccess != null && isPaymentSuccess == true)
                    Text(
                      "Payment success, need to check status in your server side",
                      style: TextStyle(color: Colors.green),
                    ),
                  if (isPaymentSuccess != null && isPaymentSuccess == false)
                    Text(
                      "Payment failed",
                      style: TextStyle(color: Colors.red),
                    )
                ],
              ),
            )
        ),
      ),
    );
  }

  singleBrandTypeVisa() async {
    /// init request channel
    var channelRequest = HyperpayChannelRequest();
    channelRequest.shopperResultUrl =
        "com.tuxedo.dafa.payment"; //contact hyperpay support to get merchantId
    channelRequest.merchantId =
        "merchant.com.tuxedo.dafa"; //contact hyperpay support to get merchantId
    channelRequest.brandName = "VISA";
    channelRequest.checkoutId =
        checkOutID; //"B6C5B5F146CE4C32086E55EA69D7E8B5.prod02-vm-tx05"; //get from your server side
    channelRequest.amount = 1;
    channelRequest.isTest = false; //false means it's live

    await HyperPayPayment.newPayment(
        channelRequest: channelRequest,
        onComplete: (bool isSuccess) {
          setState(() {
            isPaymentSuccess = isSuccess;
          });
        });
  }

  singleBrandTypeApplePay() async {
    /// init request channel
    var channelRequest = HyperpayChannelRequest();
    channelRequest.shopperResultUrl =
        "com.tuxedo.dafa.payment"; //contact hyperpay support to get merchantId
    channelRequest.merchantId =
        "merchant.com.tuxedo.dafa"; //contact hyperpay support to get merchantId
    channelRequest.brandName = "APPLEPAY";
    channelRequest.checkoutId =
        checkOutID; //"62C2A2C3FA0B7640F27E2E006654B2F7.prod01-vm-tx04"; //get from your server side
    channelRequest.amount = 1;
    channelRequest.isTest = false; //false means it's live
    channelRequest.itemName = "Tuxedo";

    /// message about merchant product name

    await HyperPayPayment.newPayment(
        channelRequest: channelRequest,
        onComplete: (bool isSuccess) {
          setState(() {
            isPaymentSuccess = isSuccess;
          });
        });
  }

  autoDetectBrandType() async {
    /// init request channel
    var channelRequest = HyperpayChannelRequest();
    channelRequest.shopperResultUrl =
        "com.tuxedo.dafa.payment"; //contact hyperpay support to get merchantId
    channelRequest.merchantId =
        "merchant.com.tuxedo.dafa"; //contact hyperpay support to get merchantId
    channelRequest.checkoutId =
        checkOutID; // "857123F6D25C1C5BE1D3811259A82D23.prod01-vm-tx12"; //get from your server side
    channelRequest.amount = 1;
    channelRequest.isTest = false; //false means it's live
    channelRequest.itemName = "Tuxedo";
    await HyperPayPayment.newPayment(
        channelRequest: channelRequest,
        onComplete: (bool isSuccess) {
          setState(() {
            isPaymentSuccess = isSuccess;
          });
        });
  }
}
1
likes
130
points
32
downloads

Publisher

unverified uploader

Weekly Downloads

HYPER PAY FLUTTER PLUGIN , Payment method : VISA, MASTER, MADA, APPLE PAY

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on hyper_pay_payment

Packages that implement hyper_pay_payment