payu_web_checkout 1.0.3 copy "payu_web_checkout: ^1.0.3" to clipboard
payu_web_checkout: ^1.0.3 copied to clipboard

discontinued
PlatformAndroidiOS

Unofficial PayU Money Flutter Plugin supports Android & iOS.

PayU Web Checkout Flutter #

Flutter plugin for PayU Web Checkout SDK.

pub package

alt text alt text alt text alt text alt text alt text

Getting Started #

This flutter plugin is a wrapper on PayU Hosted.

Prerequisites #

  • Learn about the PayU Payment Flow.
  • Sign up for a PayU Account and generate the API Keys from the PayU Dashboard. Using the Test keys helps simulate a sandbox environment. No actual monetary transaction happens when using the Test keys. Use Live keys once you have thoroughly tested the application and are ready to go live.

Installation #

This plugin is available on Pub: https://pub.dev/packages/payu_web_checkout

Add this to dependencies in your app's pubspec.yaml

payu_web_checkout: ^1.0.2

Usage #

Sample code to integrate can be found in example/lib/main.dart.

Import package

import 'package:payu_web_checkout/payu_web_checkout.dart';

Create PayUWebCheckout instance

_payUWebCheckout = PayUWebCheckout();

Attach event listeners

The plugin uses event-based communication, and emits events when payment fails or succeeds.

The event names are exposed via the constants EVENT_PAYMENT_SUCCESS and EVENT_PAYMENT_ERROR from the PayUWebCheckout class.

Use the on(String event, Function handler) method on the PayUWebCheckout instance to attach event listeners.

_payUWebCheckout.on(PayUWebCheckout.EVENT_PAYMENT_SUCCESS, _handlePaymentSuccess);
_payUWebCheckout.on(PayUWebCheckout.EVENT_PAYMENT_ERROR, _handlePaymentError);

The handlers would be defined somewhere as


void _handlePaymentSuccess(PaymentSuccessResponse response) {
  // Do something when payment succeeds
}

void _handlePaymentError(PaymentFailureResponse response) {
  // Do something when payment fails
}

To clear event listeners, use the clear method on the PayUWebCheckout instance.

_payUWebCheckout.clear(); // Removes all listeners

Setup options

  var payuWebCheckoutModel = PayuWebCheckoutModel(
    key: "<YOUR_KEY_HERE>",
    salt: "<YOUR_SALT_HERE>",
    txnId: DateTime.now().millisecondsSinceEpoch.toString(),
    phone: '9979999799',
    amount: "10.00",
    productName: "iPhone",
    firstName: "PayU User",
    email: "test@gmail.com",
    udf1: "",
    udf2: "",
    udf3: "",
    udf4: "",
    udf5: "",
    successUrl: "<YOUR_SUCCESS_SERVER_URL_HERE>",
    failedUrl: "<YOUR_FAILED_SERVER_URL_HERE>",
    baseUrl: "https://test.payu.in"
  ); // Here PayU Production or Test BASE URL

A detailed list of options can be found here.

Open Checkout

_payUWebCheckout.doPayment(BuildContext context,PayuWebCheckoutModel payuWebCheckoutModel);

API #

PayUWebCheckout #

doPayment(BuildContext context,PayuWebCheckoutModel payuWebCheckoutModel)

DoPayment Funcation Open Payment Screen.

The BuildContext and PayuWebCheckoutModel has a required property.

on(String eventName, Function listener)

Register event listeners for payment events.

  • eventName: The name of the event.
  • listener: The function to be called. The listener should accept a single argument of the following type:

clear()

Clear all event listeners.

Event names

The event names have also been exposed as Strings by the PayUWebCheckout class.

Event Name Description
EVENT_PAYMENT_SUCCESS The payment was successful.
EVENT_PAYMENT_ERROR The payment was not successful.

PaymentSuccessResponse #

Type Description
Map It was the return map value.

PaymentFailureResponse #

Type Description
Map It was the return map value.
8
likes
100
pub points
85%
popularity

Publisher

verified publishermayurpitroda.com

Unofficial PayU Money Flutter Plugin supports Android & iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

crypto, eventify, flutter, webview_flutter

More

Packages that depend on payu_web_checkout