Skip to content

withmukeshjoshi/payumoneySDK

Repository files navigation

Flutter PayUMoney Pro SDK

Build Passing Badge Pub Version Flutter Version Platform Supported

Flutter Plugin to implement PayUMoney Latest CheckoutPro SDK in Android & iOS App.

Screenshots

screenshotscreenshotscreenshotscreenshotscreenshotscreenshot

Note: This Plugin is in initial release. Please test it well before using it in production app.

Step 1: Android Implementation

There are few steps you need to follow to implement PayUMoney SDK:

  • Open file android/app/build.gradle in your flutter project and update minSdkVersion under "defaultConfig" to 21 (if greater than leave)

  • Open AndroidManifest.xml located at android/app/src/main and add following code:

xmlns:tools="http://schemas.android.com/tools"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

xmlns:tools="http://schemas.android.com/tools" <--- paste here

package="yourPackageName">

also add this code:

tools:replace="android:label"
<application

android:name="io.flutter.app.FlutterApplication"

android:label="YourAppName"

tools:replace="android:label" <-- Paste here

android:icon="@mipmap/ic_launcher">

Step 2: iOS Implementation

<-- No additional steps required for iOS -->

Step 3: Flutter Implementation

Run this command in project terminal to add dependency

flutter pub add payumoney_pro_unofficial

or add manually to pubspecs.yaml

payumoney_pro_unofficial: ^0.0.9

Get latest packages

flutter pub get

Import package to by adding this line at the top

import  'package:payumoney_pro_unofficial/payumoney_pro_unofficial.dart';

Copy and paste this code

Future<void> initializePayment() async{

final response= await  PayumoneyProUnofficial.payUParams(

email: '<Customer Email>',

firstName: '<Customer Name>',

merchantName: '<Merchant Name>',

isProduction: true,

merchantKey: '<Merchant Key>',

merchantSalt: '<Merchant Salt Version 1>',

amount: '<Amount in Rs>',

hashUrl:'<Checksum URL to generate dynamic hashes>', //nodejs code is included. Host the code and update its url here.

productInfo: '<Product Name>',

transactionId: '<Unique ID>',

showExitConfirmation:true,

showLogs:false, // true for debugging, false for production

userCredentials:'<Merchant Key>:' + '<Customer Email or User ID>',

userPhoneNumber: phone

);



if (response['status'] == PayUParams.success)

handlePaymentSuccess();

if (response['status'] == PayUParams.failed)

handlePaymentFailure(response['message']);

}



handlePaymentSuccess(){

//Implement Your Success Logic

}



handlePaymentFailure(String errorMessage){

print(errorMessage);

//Implement Your Failed Payment Logic

}


Tested Devices:

Device Name Status
iPhoneX
iPhone 11
iPhone 12
iPhone 12 mini
Google Pixel
Android Emulator(v10)

Pro Tip:

  1. Always make sure you validate Phone number(Must be 10 Digits) else payment page might not appear.

  2. Avoid hardcoded credentials.

  3. Always generate unique transaction id for each transaction.

  4. Store Transaction & Details to database for later analysis or usage.

For any issue please write to contact@orangewp.com

To Connect on Instagram | Youtube | Business Inqury