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.


  • 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.


This plugin is available on Pub:

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

payu_web_checkout: ^1.0.2


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>",
    phone: '9979999799',
    amount: "10.00",
    productName: "iPhone",
    firstName: "PayU User",
    email: "",
    udf1: "",
    udf2: "",
    udf3: "",
    udf4: "",
    udf5: "",
    baseUrl: ""
  ); // Here PayU Production or Test BASE URL

A detailed list of options can be found here.

Open Checkout

_payUWebCheckout.doPayment(BuildContext context,PayuWebCheckoutModel payuWebCheckoutModel);



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 all event listeners.

Event names

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

Event NameDescription
EVENT_PAYMENT_SUCCESSThe payment was successful.
EVENT_PAYMENT_ERRORThe payment was not successful.


MapIt was the return map value.


MapIt was the return map value.