code-Shabbir / paypal_payment_example

An example for paypal_payment (dart package).
0 stars 1 forks source link

It crashes #3

Open Saad-Alareqi opened 1 month ago

Saad-Alareqi commented 1 month ago

Hi, tried to use your widget but it crashes. here where i call it like the example:

Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => PaypalOrderPayment( sandboxMode: true, returnURL: '', cancelURL: '', clientId: controller.clientId, secretKey: controller.secretKey, currencyCode: 'USD', amount: controller.finalprice.toString(), onSuccess: () { Get.snackbar( '', 'payement successfull'); }, onError: () {}, onCancel: () {}))

Error: I/flutter (30956): Response I/flutter (30956): uri: https://api-m.sandbox.paypal.com/v2/checkout/orders I/flutter (30956): statusCode: 201 I/flutter (30956): headers: I/flutter (30956): x-timer: S1726339641.415390,VS0,VE1091 I/flutter (30956): connection: keep-alive I/flutter (30956): cache-control: max-age=0, no-cache, no-store, must-revalidate I/flutter (30956): date: Sat, 14 Sep 2024 18:47:22 GMT I/flutter (30956): vary: Accept-Encoding I/flutter (30956): strict-transport-security: max-age=31536000; includeSubDomains I/flutter (30956): access-control-expose-headers: Server-Timing I/flutter (30956): server-timing: traceparent;desc="00-0000000000000000000f982834fccb16-7a81fd06a0d0d155-01" I/flutter (30956): content-type: application/json I/flutter (30956): server: nginx I/flutter (30956): x-served-by: cache-lhr-egll1980064-LHR, cache-lhr-egll1980024-LHR, cache-mrs1050115-MRS I/flutter (30956): paypal-debug-id: f982834fccb16 I/flutter (30956): x-backend-info: v=1;name=2k1u3gOGb2cebCyZJujTUN--F_ccg18_wju_origin_api_m_2_sandbox_paypal_com;ip=34.106.111.220;port=443;ssl=1;max=200;ka_ns=0;tka_s=300;tki_s=10;tkp=3;host=api-m.sandbox.paypal.com;min_tls=;max_tls=;sni=edge.sandbox.paypal.com;cert_host=edge.sandbox.paypal.com;ciphers=;check_cert=1;no_reneg=1;to_ns=1000000000;fbto_ns=59000000000;bbto_ns=10000000000 I/flutter (30956): accept-ranges: bytes I/flutter (30956): edge-control: max-age=0 I/flutter (30956): traceparent: 00-0000000000000000000f982834fccb16-58005815b1802707-01 I/flutter (30956): content-length: 501 I/flutter (30956): via: 1.1 varnish, 1.1 varnish I/flutter (30956): x-cache-hits: 0, 0, 0 I/flutter (30956): x-cache: MISS, MISS, MISS I/flutter (30956): http_x_pp_az_locator: ccg18.slc I/flutter (30956): Response Text: I/flutter (30956): {"id":"0S012356TN1920324","status":"CREATED","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/0S012356TN1920324","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=0S012356TN1920324","rel":"approve","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/0S012356TN1920324","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/0S012356TN1920324/capture","rel":"capture","method":"POST"}]} I/flutter (30956): D/ConnectivityManager(30956): StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4511)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:5089)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:5056)] [WV.cD.e(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:44)] [WV.cD.b(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:1)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onFirstWebViewCreated(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:19)] [J.N.MFiR_zHY(Native Method)] [org.chromium.android_webview.AwContents.(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:442)] [com.android.webview.chromium.k.run(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:148)] [WV.fX.b(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:20)] [WV.eX.run(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:3)] [org.chromium.base.task.PostTask.e(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:11)] [WV.fX.a(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:23)] [com.android.webview.chromium.WebViewChromiumFactoryProvider.a(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:3)] [com.android.webview.chromium.WebViewChromium.init(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:326)] [android.webkit.WebView.(WebView.java:448)] [android.webkit.WebView.(WebView.java:368)] [android.webkit.WebView.(WebView.java:350)] [android.webkit.WebView.(WebView.java:337)] [android.webkit.WebView.(WebView.java:327)] [com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InputAwareWebView.(InputAwareWebView.java:34)] [com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.(InAppWebView.java:196)] [com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.(FlutterWebView.java:67)] [com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(FlutterWebViewFactory.java:67)] [io.flutter.plugin.platform.PlatformViewsController.createPlatformView(PlatformViewsController.java:527)] [io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(PlatformViewsController.java:169)] [io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:105)] [io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:55)] [io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)] [io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)] [io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)] [io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)] D/ConnectivityManager(30956): StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4511)] [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4567)] [android.net.ConnectivityManager.registerNetworkCallback(ConnectivityManager.java:4949)] [WV.cD.e(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:93)] [WV.cD.b(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:1)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onFirstWebViewCreated(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:19)] [J.N.MFiR_zHY(Native Method)] [org.chromium.android_webview.AwContents.(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:442)] [com.android.webview.chromium.k.run(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:148)] [WV.fX.b(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:20)] [WV.eX.run(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:3)] [org.chromium.base.task.PostTask.e(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:11)] [WV.fX.a(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:23)] [com.android.webview.chromium.WebViewChromiumFactoryProvider.a(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:3)] [com.android.webview.chromium.WebViewChromium.init(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:326)] [android.webkit.WebView.(WebView.java:448)] [android.webkit.WebView.(WebView.java:368)] [android.webkit.WebView.(WebView.java:350)] [android.webkit.WebView.(WebView.java:337)] [android.webkit.WebView.(WebView.java:327)] [com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InputAwareWebView.(InputAwareWebView.java:34)] [com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.(InAppWebView.java:196)] [com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.(FlutterWebView.java:67)] [com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(FlutterWebViewFactory.java:67)] [io.flutter.plugin.platform.PlatformViewsController.createPlatformView(PlatformViewsController.java:527)] [io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(PlatformViewsController.java:169)] [io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:105)] [io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:55)] [io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)] [io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)] [io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)] [io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)] I/cr_DWTrigger(30956): updateDWServiceStatus() : isEnabled = true I/cr_DWTrigger(30956): updateDWServiceStatus() : isEnabled = true D/InAppWebView(30956): Using InAppWebViewClientCompat implementation W/cr_WebSettings(30956): setForceDark() is a no-op in an app with targetSdkVersion>=T W/cr_SupportWebSettings(30956): setForceDarkBehavior() is a no-op in an app with targetSdkVersion>=T I/PlatformViewsController(30956): Using hybrid composition for platform view: 1 [AndroidInAppWebViewWidget] (android) AndroidInAppWebViewWidget ID 1 calling "onWebViewCreated" using [] [AndroidInAppWebViewController] (android) WebView ID 1 calling "onProgressChanged" using {progress: 10} [AndroidInAppWebViewController] (android) WebView ID 1 calling "onLoadStart" using {url: https://www.sandbox.paypal.com/checkoutnow?token=0S012356TN1920324} [AndroidInAppWebViewController] (android) WebView ID 1 calling "onProgressChanged" using {progress: 22} [AndroidInAppWebViewController] (android) WebView ID 1 calling "onTitleChanged" using {title: سجّل الدخول إلى حسابك على PayPal} [AndroidInAppWebViewController] (android) WebView ID 1 calling "onUpdateVisitedHistory" using {isReload: false, url: https://www.sandbox.paypal.com/checkoutnow?token=0S012356TN1920324} [AndroidInAppWebViewController] (android) WebView ID 1 calling "onPageCommitVisible" using {url: https://www.sandbox.paypal.com/checkoutnow?token=0S012356TN1920324} I/DecorView(30956): notifyKeepScreenOnChanged: keepScreenOn=false D/ViewRootImpl@d147ab3MainActivity: performTraversals params={(0,0)(fillxfill) sim={adjust=resize} ty=BASE_APPLICATION fmt=TRANSLUCENT wanim=0x1030001 D/ViewRootImpl@d147ab3MainActivity: fl=81810100 D/ViewRootImpl@d147ab3MainActivity: pfl=16020040 D/ViewRootImpl@d147ab3MainActivity: vsysui=2500 D/ViewRootImpl@d147ab3MainActivity: apr=LIGHT_STATUS_BARS D/ViewRootImpl@d147ab3MainActivity: bhv=DEFAULT D/ViewRootImpl@d147ab3MainActivity: fitSides= naviIconColor=0} D/ViewRootImpl@d147ab3MainActivity: performTraversals mFirst=false windowShouldResize=false viewVisibilityChanged=false mForceNextWindowRelayout=false params={(0,0)(fillxfill) sim={adjust=resize} ty=BASE_APPLICATION fmt=TRANSLUCENT wanim=0x1030001 D/ViewRootImpl@d147ab3MainActivity: fl=81810100 D/ViewRootImpl@d147ab3MainActivity: pfl=16020040 D/ViewRootImpl@d147ab3MainActivity: vsysui=2500 D/ViewRootImpl@d147ab3MainActivity: apr=LIGHT_STATUS_BARS D/ViewRootImpl@d147ab3MainActivity: bhv=DEFAULT D/ViewRootImpl@d147ab3MainActivity: fitSides= naviIconColor=0} I/BLASTBufferQueue(30956): update, w= 1768 h= 2208 mName = ViewRootImpl@d147ab3[MainActivity] mNativeObject= 0x6f4356c530 sc.mNativeObject= 0x6ed35c59f0 format= -3 caller= android.view.ViewRootImpl.updateBlastSurfaceIfNeeded:2804 android.view.ViewRootImpl.relayoutWindow:9661 android.view.ViewRootImpl.performTraversals:3785 android.view.ViewRootImpl.doTraversal:3017 android.view.ViewRootImpl$TraversalRunnable.run:10699 android.view.Choreographer$CallbackRecord.run:1301 I/ViewRootImpl@d147ab3MainActivity: Relayout returned: old=(0,0,1768,2208) new=(0,0,1768,2208) req=(1768,2208)0 dur=5 res=0x0 s={true 0x6fd355eae0} ch=false seqId=0 I/ViewRootImpl@d147ab3MainActivity: mWNT: t=0x6f0356a9b0 mBlastBufferQueue=0x6f4356c530 fn= 93 caller= android.view.ViewRootImpl.prepareSurfaces:2891 android.view.ViewRootImpl.performTraversals:4134 android.view.ViewRootImpl.doTraversal:3017 [AndroidInAppWebViewController] (android) WebView ID 1 calling "onProgressChanged" using {progress: 70} D/SurfaceView@10f9e79(30956): setAlpha: mUseAlpha = false alpha=1.0 D/SurfaceView@10f9e79(30956): updateSurfaceAlpha: setUseAlpha() is not called, ignored. [AndroidInAppWebViewWidget] (android) AndroidInAppWebViewWidget calling "dispose" using [] D/ConnectivityManager(30956): StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:5199)] [org.chromium.net.a.h(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:17)] [WV.K7.a(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:3)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onLastWebViewDestroyed(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:19)] [J.N.MQGusfGb(Native Method)] [WV.k6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:3)] [WV.Zc.handleMessage(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:55)] [WV.bd.a(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:25)] [org.chromium.android_webview.AwContents.k(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:33)] [WV.U5.run(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:20)] D/ConnectivityManager(30956): StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:5199)] [org.chromium.net.a.h(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:26)] [WV.K7.a(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:3)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onLastWebViewDestroyed(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:19)] [J.N.MQGusfGb(Native Method)] [WV.k6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:3)] [WV.Zc.handleMessage(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:55)] [WV.bd.a(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:25)] [org.chromium.android_webview.AwContents.k(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:33)] [WV.U5.run(chromium-TrichromeWebViewGoogle6432.aab-stable-653314333:20)] E/chromium(30956): [ERROR:aw_browser_terminator.cc(166)] Renderer process (32213) crash detected (code -1).

Saad-Alareqi commented 1 month ago

ok i figured it out. it crashes if i don't use a return or cancel url. you should specify a way to return to main page of mobile app if i don't want to use url for return or cancel. just return to parent widget. you could change it to return to parent widget if i dont specify url

Saad-Alareqi commented 1 month ago

also if i click on return arrow on upper left or click back on widget, it won't trigger the cancel event.