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

outdated

This is the plugin for supporting payumoney payment gateway directly by flutter apps. Note Currently supported for only Android Platform. Not for iOS right now but wait for some more days it will be h [...]

example/lib/main.dart

import 'dart:convert';

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

import 'package:flutter/services.dart';
import 'package:http/http.dart';
import 'package:payu_money_flutter/payu_money_flutter.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  // Creating PayuMoneyFlutter Instance
  PayuMoneyFlutter payuMoneyFlutter = PayuMoneyFlutter();

  // Payment Details
  String phone = "8318045008";
  String email = "gmail@gmail.com";
  String productName = "My Product Name";
  String firstName = "Vaibhav";
  String txnID = "223428947";
  String amount = "10.00";

  @override
  void initState() {
    super.initState();
    // Setting up the payment details
    setupPayment();
  }
  // Function for setting up the payment details
  setupPayment() async {
    bool response = await payuMoneyFlutter.setupPaymentKeys(
        merchantKey: "KSXB9Z3J", merchantID: "AwuZ5FVG4c", isProduction: false, activityTitle: "App Title", disableExitConfirmation: false);
  }
  // Function for start payment with given merchant id and merchant key
  Future<Map<String, dynamic>> startPayment() async {
    // Generating hash from php server
    Response res =
    await post("http://server_url.com", body: {
      "txnid": txnID,
      "phone": phone,
      "email": email,
      "amount": amount,
      "productinfo": productName,
      "firstname": firstName,
    });
    var data = jsonDecode(res.body);
    print(data);
    String hash = data['params']['hash'];
    print(hash);
    Map<String, dynamic> response = await payuMoneyFlutter.startPayment(
        txnid: txnID,
        amount: amount,
        name: firstName,
        email: email,
        phone: phone,
        productName: productName,
        hash: hash);
    print("EROROWROIWEURIWUERIUWRIOEU : $response");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Payu Money Flutter'),
        ),
        body: Center(
          child: Text("Pay Us 10"),
        ),
        floatingActionButton: FloatingActionButton(
          // Starting up the payment
          onPressed: () => startPayment(),
          child: Icon(Icons.money),
        ),
      ),
    );
  }
}
14
likes
0
pub points
51%
popularity

Publisher

verified publishervaibhavpathakofficial.tk

This is the plugin for supporting payumoney payment gateway directly by flutter apps. Note Currently supported for only Android Platform. Not for iOS right now but wait for some more days it will be here with new update. And one more thing if you want to make it more better or want to add more platforms support then feel free to contribute.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on payu_money_flutter