razorpay / razorpay-flutter

Razorpay Flutter Plugin
MIT License
108 stars 149 forks source link

In release mode, the checkout page is not working. and in console i'm getting this error. Uncaught TypeError: CheckoutBridge.sendAnalyticsData is not a function #411

Open bala-slaylewks opened 2 months ago

bala-slaylewks commented 2 months ago

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

from my app when I click on the checkout button, it navigates to razorpay page where I can see the razorpay logo loads and white screen appears out of nowhere. the app crashes there.

Flutter Version :

3.24.1

Xcode Version :

Version 15.4 (15F31d)

Cocoapod Version :

Go to iOS folder > open podfile.lock > copy the razorpay-pod version and razorpay_fluttera version. razorpay-pod (1.3.10) razorpay_flutter (1.1.10)

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Click on checkout button from my app and it navigates to razorpay UI
  2. The razorpay logo loads and white screen appears.
  3. REMEMBER THIS HAPPENS ONLY IN RELEASE BUILD.

Expected Results

It should go to razorpay checkout page where user can select the different types of payment

Snack, code example, screenshot, or link to a repository:

https://github.com/razorpay/razorpay-flutter/issues/371

vivekshindhe commented 2 months ago

@bala-slaylewks Have you added proguard rules to your project? If not can you please add them. It can be found here

bala-slaylewks commented 2 months ago

Thanks @vivekshindhe
It worked for me. Btw, what is this proguard rules used for?

AbhiAppBuddy commented 1 month ago

facing same issue

razorpay_flutter: ^1.3.7 flutter- 3.24.1

I also tried to add proguard rules but it is not working for me

bala-slaylewks commented 1 month ago

It worked for me.

On Thu, Sep 26, 2024, 10:53 AM AbhiAppBuddy @.***> wrote:

facing same issue

razorpay_flutter: ^1.3.7 flutter- 3.24.1

I also tried to add proguard rules but it is not working for me

— Reply to this email directly, view it on GitHub https://github.com/razorpay/razorpay-flutter/issues/411#issuecomment-2375896510, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6GJIT5CIF77JM2YYMEEEKDZYOK4DAVCNFSM6AAAAABOBF74CCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZVHA4TMNJRGA . You are receiving this because you were mentioned.Message ID: @.***>

bala-slaylewks commented 1 month ago

Add any screenshot

On Thu, Sep 26, 2024, 11:00 AM Balamurugesan Arumugam < @.***> wrote:

It worked for me.

On Thu, Sep 26, 2024, 10:53 AM AbhiAppBuddy @.***> wrote:

facing same issue

razorpay_flutter: ^1.3.7 flutter- 3.24.1

I also tried to add proguard rules but it is not working for me

— Reply to this email directly, view it on GitHub https://github.com/razorpay/razorpay-flutter/issues/411#issuecomment-2375896510, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6GJIT5CIF77JM2YYMEEEKDZYOK4DAVCNFSM6AAAAABOBF74CCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZVHA4TMNJRGA . You are receiving this because you were mentioned.Message ID: @.***>

megha-geobull commented 1 month ago

Flutter 3.16.7 razropay: 1.3.7

"Uncaught TypeError: CheckoutBridge.sendAnalyticsData is not a function" after adding proguard still shows this error and doesnot redirect back after payment suceess

Shiba-Kar commented 1 month ago

app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "xxxxxxx.com"
    compileSdk 34
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "xxxxxxxx.com"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion 21
        targetSdkVersion 34
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
  signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
     buildTypes {
       release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.release
            minifyEnabled true // Enable minification
            shrinkResources true // Optimize resources
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

flutter {
    source '../..'
}

dependencies {}

proguard-rules.pro

-keepattributes *Annotation*
-dontwarn com.razorpay.**
-keep class com.razorpay.** {*;}
-optimizations !method/inlining/
-keepclasseswithmembers class * {
  public void onPayment*(...);
}

#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }

have a live key rzp_live_****************

E/com.razorpay.checkout(32354): Webview JS Error: Uncaught TypeError: CheckoutBridge.sendAnalyticsData is not a function
I/chromium(32354): [INFO:CONSOLE(1)] "Uncaught TypeError: CheckoutBridge.sendAnalyticsData is not a function", source: https://api.razorpay.com/v1/checkout/public?version=1.6.40&library=checkoutjs&platform=android&session_token=B12EE64251D2280C281749AF1B54ABF1A8724F4DFAD13FA08B0A1646A0FAA788DEF588FC828E6E89DB923E4BC27E24B454EE67980F44004FCF83D476E09E0A1B6CBA95572FEE2540A9EA9352C133FC55B61C6DFC0D8BAC1F6D83BC4084A9EB65DCC8665F5E223B0C&traffic_env=canary (1)

using a rzp_test_*********** works perfectly !!!

Shiba-Kar commented 1 week ago

Check with the razorpay about the bank enabled or disabled ! .In our case the bank was disabled