GithubHelp home page GithubHelp logo

xamelon / flutter_pay Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 36.0 559 KB

Apple/Google/Samsung Pay plugin for flutter

License: MIT License

Kotlin 37.07% Ruby 5.46% Swift 20.97% Objective-C 1.69% Dart 34.81%

flutter_pay's People

Contributors

michael-gobbers avatar mit-73 avatar tumist76 avatar xamelon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flutter_pay's Issues

IPhone error: could not set up apple pay an error occurred

Thanks for the awesome plugin, I truly appreciate it.

While trying to test run the example/lib/main.dart on my iPhone, when I click on Try to pay button, it pops up this error message "Could not set up apple pay an error occurred ".

Please I will need your guidance on how to fix this error, Thank you.

Crash after completing payment

Copypasted code from example app, from makePayment() method. Google Pay sheet sucessfully shows, but after payment confirming the app force closes.

Debug console output:

D/AndroidRuntime( 8517): Shutting down VM
E/AndroidRuntime( 8517): FATAL EXCEPTION: main
E/AndroidRuntime( 8517): Process: ru.mygeizer.mygeizer, PID: 8517
E/AndroidRuntime( 8517): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=991, result=-1, data=Intent { (has extras) }} to activity {ru.mygeizer.mygeizer/ru.mygeizer.mygeizer.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference
E/AndroidRuntime( 8517): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4845)
E/AndroidRuntime( 8517): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886)
E/AndroidRuntime( 8517): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
E/AndroidRuntime( 8517): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime( 8517): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime( 8517): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
E/AndroidRuntime( 8517): 	at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime( 8517): 	at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 8517): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 8517): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8517): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 8517): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/AndroidRuntime( 8517): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.MethodChannel$Result.success(java.lang.Object)' on a null object reference
E/AndroidRuntime( 8517): 	at snail.app.flutter.google.pay.FlutterGooglePayPlugin.callToDartOnPaymentSuccess(FlutterGooglePayPlugin.java:126)
E/AndroidRuntime( 8517): 	at snail.app.flutter.google.pay.FlutterGooglePayPlugin.onActivityResult(FlutterGooglePayPlugin.java:291)
E/AndroidRuntime( 8517): 	at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEnginePluginRegistry.java:691)
E/AndroidRuntime( 8517): 	at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onActivityResult(FlutterEnginePluginRegistry.java:378)
E/AndroidRuntime( 8517): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:597)
E/AndroidRuntime( 8517): 	at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:582)
E/AndroidRuntime( 8517): 	at android.app.Activity.dispatchActivityResult(Activity.java:8135)
E/AndroidRuntime( 8517): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4838)
E/AndroidRuntime( 8517): 	... 11 more
I/Process ( 8517): Sending signal. PID: 8517 SIG: 9
Lost connection to device.
Exited (sigterm)

Code snippet:

    FlutterPay flutterPay = FlutterPay();

    PaymentItem item = PaymentItem(name: "Оплата услуг автомойки", price: _sum);
    flutterPay.setEnvironment(environment: PaymentEnvironment.Test);
    List<PaymentItem> items = [
      PaymentItem(name: "Услуги автомойки GEIZER", price: _sum)
    ];

    flutterPay.setEnvironment(environment: PaymentEnvironment.Test);

    var token = await flutterPay.requestPayment(
      googleParameters: GoogleParameters(
        gatewayName: "example",
        gatewayMerchantId: "example_id",
      ),
      appleParameters:
          AppleParameters(merchantIdentifier: "merchant.flutterpay.example"),
      currencyCode: "RUB",
      countryCode: "RU",
      paymentItems: items,
    );

[URGENT] I have generated a token, how do I pass it to stripe gateway

Hello how are you, I have installed flutter pay. I have also made use of the example code given and I have generated a token successfully.

Now my question is how do I pass this token to stripe in order to complete the transaction:

I am using the following libraries:

flutter_pay: ^1.0.2
pay: ^1.0.5

Flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19042.985], locale
    en-ZW)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web  
[√] Android Studio (version 4.0)  
[√] VS Code (version 1.57.0)      
[√] Connected device (3 available)

• No issues found!

Cant make payments

I'm getting the error below when i try to initaite payment, cant really tell where I'm missing it

getBaseCardPaymentMethod, authMethods: ["PAN_ONLY","CRYPTOGRAM_3DS"]

Android check pay

Hello.
When I run

flutterPay.canMakePayments()

I get error:

I/System.out(20086): getBaseCardPaymentMethod, authMethods: ["PAN_ONLY","CRYPTOGRAM_3DS"]
W/System.err(20086): com.google.android.gms.common.api.ApiException: 10:
W/System.err(20086): at com.google.android.gms.common.api.internal.TaskUtil.setResultOrApiException(com.google.android.gms:play-services-base@@17.1.0:6)
W/System.err(20086): at com.google.android.gms.internal.wallet.zzw.zza(com.google.android.gms:play-services-wallet@@18.0.0:8)
W/System.err(20086): at com.google.android.gms.internal.wallet.zzt.dispatchTransaction(com.google.android.gms:play-services-wallet@@18.0.0:40)
W/System.err(20086): at com.google.android.gms.internal.wallet.zza.onTransact(com.google.android.gms:play-services-wallet@@18.0.0:13)
W/System.err(20086): at android.os.Binder.execTransactInternal(Binder.java:1021)
W/System.err(20086): at android.os.Binder.execTransact(Binder.java:994)

Can You help with this error? Earlier I tried with other packet and it was ok, but now I has error with both packets...

Version update coming?

I noticed the 0.9.1 version on pub.dev/packages/flutter_pay seems to not be up to date with the latest code here. For example the makePayment method seems to be renamed requestPayment. Do you plan to update the pub.dev package soon?

For Android the package is giving error

when we run and check flutterPay.canMakePayments() this method is giving false in return despite we have google pay on physical device
Error on debug:
I/System.out(12880): Is test Environment: true
I/System.out(12880): getBaseCardPaymentMethod, authMethods: ["PAN_ONLY","CRYPTOGRAM_3DS"]
W/System.err(12880): com.google.android.gms.common.api.ApiException: 10:
W/System.err(12880): at com.google.android.gms.common.api.internal.TaskUtil.setResultOrApiException(com.google.android.gms:play-services-base@@17.5.0:6)
W/System.err(12880): at com.google.android.gms.internal.wallet.zzab.zza(com.google.android.gms:play-services-wallet@@18.1.2:8)
W/System.err(12880): at com.google.android.gms.internal.wallet.zzy.dispatchTransaction(com.google.android.gms:play-services-wallet@@18.1.2:40)
W/System.err(12880): at com.google.android.gms.internal.wallet.zza.onTransact(com.google.android.gms:play-services-wallet@@18.1.2:13)
W/System.err(12880): at android.os.Binder.execTransact(Binder.java:731)
I/System.out(12880): getBaseCardPaymentMethod, authMethods: ["PAN_ONLY","CRYPTOGRAM_3DS"]
W/System.err(12880): com.google.android.gms.common.api.ApiException: 10:
W/System.err(12880): at com.google.android.gms.common.api.internal.TaskUtil.setResultOrApiException(com.google.android.gms:play-services-base@@17.5.0:6)
W/System.err(12880): at com.google.android.gms.internal.wallet.zzab.zza(com.google.android.gms:play-services-wallet@@18.1.2:8)
W/System.err(12880): at com.google.android.gms.internal.wallet.zzy.dispatchTransaction(com.google.android.gms:play-services-wallet@@18.1.2:40)
W/System.err(12880): at com.google.android.gms.internal.wallet.zza.onTransact(com.google.android.gms:play-services-wallet@@18.1.2:13)
W/System.err(12880): at android.os.Binder.execTransact(Binder.java:731)
I/flutter (12880): payment kar ne de ga kya false
I/flutter (12880): card se payment kar ne de ga kya false
E/MethodChannel#flutter_pay(12880): Failed to handle method call
E/MethodChannel#flutter_pay(12880): kotlin.TypeCastException: null cannot be cast to non-null type kotlin.collections.List<kotlin.String>
E/MethodChannel#flutter_pay(12880): at com.xamelon.flutter_pay.FlutterPayPlugin.requestPayment(FlutterPayPlugin.kt:164)
E/MethodChannel#flutter_pay(12880): at com.xamelon.flutter_pay.FlutterPayPlugin.onMethodCall(FlutterPayPlugin.kt:70)
E/MethodChannel#flutter_pay(12880): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter_pay(12880): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter_pay(12880): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#flutter_pay(12880): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter_pay(12880): at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#flutter_pay(12880): at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#flutter_pay(12880): at android.app.ActivityThread.main(ActivityThread.java:6692)
E/MethodChannel#flutter_pay(12880): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_pay(12880): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#flutter_pay(12880): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter (12880): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception:
E/flutter (12880):
E/flutter (12880): Error: error.
E/flutter (12880): Description: null cannot be cast to non-null type kotlin.collections.List<kotlin.String>
E/flutter (12880): #0 FlutterPay.requestPayment
E/flutter (12880):
E/flutter (12880): #1 AllTemplatesPageController.makePayment
E/flutter (12880):
E/flutter (12880):

Flutter doctor details :
flutter doctor -v
[√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19041.985], locale en-IN)
• Flutter version 2.0.2 at C:\flutter
• Framework revision 8962f6dc68 (3 months ago), 2021-03-11 13:22:20 -0800
• Engine revision 5d8bf811b3
• Dart version 2.12.1

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\jk\AppData\Local\Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = C:\Users\jk\AppData\Local\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 51.0.1
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code, 64-bit edition (version 1.56.2)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.23.0

[√] Connected device (3 available)
• ASUS X00TD (mobile) • 192.168.0.101:5555 • android-arm64 • Android 9 (API 28)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.77
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.62

• No issues found!

No result is returned on some GPay errors

In some cases GPay throws an error in the UI. For example, that happens if use has no available card or merchant isn't registered.

This issue is easy to reproduce. Just change PaymentEnvironment.Test to PaymentEnvironment.Production in example app and try to pay.
The awaited function neither will return anything, nor will throw an exception.

Error handling

Hi there,

I noticed that the error handling this plugin could be improved a bit... Currently there is no way to detect if a user cancelled a payment or if an error occurred.

I would love to change that behaviour by forking and making a PR. But unfortunately, I believe this might be a breaking change...

The way I'd tackle this is by making the plugin throw a flutter pay error when there is a paymentError. However, this will required developers to be aware of this and handle this exception appropriately.

I can't use AMEX on Android

In PaymentNetwork, amex is "American Express", but in fun decodePaymentNetwork, it is ' " AMEX "-> return" AMEX " ', so it becomes null and amex cannot be used.

Please correct it.

While trying a payment: null cannot be cast to non-null type kotlin.collections.List<kotlin.String>

I tried to clone your project and proceed to test payment.
After checking if i am able to pay && payments with verified card (both are true) i tried to pay, but got error:

Error: error.
Description: null cannot be cast to non-null type kotlin.collections.List<kotlin.String>

Nothing was changed in your code, not even a char.

Log:

Running "flutter pub get" in example...
Launching lib/main.dart on STF L09 in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Debug service listening on ws://127.0.0.1:37319/UDma2qSBCVs=/ws
Syncing files to device STF L09...
I/ViewRootImpl(15280): jank_removeInvalidNode jank list is null
D/AwareBitmapCacher(15280): handleInit switch not opened pid=15280
I/ter_pay_exampl(15280): Starting profile saver IsSaveProfileNow end.
V/AudioManager(15280): playSoundEffect   effectType: 0
V/AudioManager(15280): querySoundEffectsEnabled...
I/System.out(15280): getBaseCardPaymentMethod, authMethods: ["PAN_ONLY","CRYPTOGRAM_3DS"]
V/AudioManager(15280): playSoundEffect   effectType: 0
V/AudioManager(15280): querySoundEffectsEnabled...
I/System.out(15280): getBaseCardPaymentMethod, authMethods: ["PAN_ONLY","CRYPTOGRAM_3DS"]
V/AudioManager(15280): playSoundEffect   effectType: 0
V/AudioManager(15280): querySoundEffectsEnabled...
I/System.out(15280): Is test Environment: true
E/MethodChannel#flutter_pay(15280): Failed to handle method call
E/MethodChannel#flutter_pay(15280): kotlin.TypeCastException: null cannot be cast to non-null type kotlin.collections.List<kotlin.String>
E/MethodChannel#flutter_pay(15280): 	at com.xamelon.flutter_pay.FlutterPayPlugin.requestPayment(FlutterPayPlugin.kt:164)
E/MethodChannel#flutter_pay(15280): 	at com.xamelon.flutter_pay.FlutterPayPlugin.onMethodCall(FlutterPayPlugin.kt:70)
E/MethodChannel#flutter_pay(15280): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter_pay(15280): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter_pay(15280): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#flutter_pay(15280): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter_pay(15280): 	at android.os.MessageQueue.next(MessageQueue.java:386)
E/MethodChannel#flutter_pay(15280): 	at android.os.Looper.loop(Looper.java:175)
E/MethodChannel#flutter_pay(15280): 	at android.app.ActivityThread.main(ActivityThread.java:7625)
E/MethodChannel#flutter_pay(15280): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter_pay(15280): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/MethodChannel#flutter_pay(15280): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
E/flutter (15280): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 
E/flutter (15280): 
E/flutter (15280):     Error: error.
E/flutter (15280):     Description: null cannot be cast to non-null type kotlin.collections.List<kotlin.String>
E/flutter (15280): #0      FlutterPay.requestPayment (package:flutter_pay/src/flutter_pay.dart:102:7)
E/flutter (15280): <asynchronous suspension>
E/flutter (15280): 

Flutter Doctor:

[✓] Flutter (Channel master, 2.1.0-13.0.pre.104, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✗] Chrome - develop for the web (Cannot find Chrome executable at
    google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 4.1)
[✓] Android Studio
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

Transaction <> Debit Error

Hello @xamelon many thanks for this plugin. It works pretty well and the payments are successful. However, I noticed that the card linked to the ApplePay is never debited despite the successful payment. More so, there are no logs on the Payment and Financial Reports on Apple Dev. Page.
What could be responsible for this behavior? Does the app have to be release to public to see the logs?

N.B: The payment is tested on the dev. app and TestFlight build.

adding bank card

Can I add a bank card from the app? Or maybe I can at least invoke the native interface to add a map?

Вопрос по коду

Станислав, доброго дня!

Заинтересовал ваш опыт flutter разработки.
Если вы рассматриваете вакансии для себя, пожалуйста, напишите мне в телеграм или вотсап +7 950 171 35 30 Татьяна)

gateway ...

is this package can integrate with any payment gateway? like: HyperPay or PayTabs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.