capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor
MIT License
185 stars 74 forks source link

feat(): update to capacitor3 #74

Closed rdlabo closed 2 years ago

rdlabo commented 3 years ago

We will create breaking changes: https://github.com/capacitor-community/stripe/pull/74#issuecomment-862186364

Android

iOS

Web

danielehrhardt commented 3 years ago

Amazing!

rdlabo commented 3 years ago

https://github.com/capacitor-community/stripe/releases/tag/v3.0.0-0

patrickbussmann commented 3 years ago

Few issues still there on iOS: Android build is fine.

❌  /Users/vagrant/git/node_modules/@capacitor-community/stripe/ios/Plugin/PKAuthViewDelegate.swift:41:102: cannot convert value of type 'Error?' to expected argument type 'String?'
                    callback.reject("unable to create payment method: " + err!.localizedDescription, err)
❌  /Users/vagrant/git/node_modules/@capacitor-community/stripe/ios/Plugin/PKAuthViewDelegate.swift:53:93: cannot convert value of type 'NSError?' to expected argument type 'String?'
                            callback.reject("payment failed: " + err!.localizedDescription, err)
❌  /Users/vagrant/git/node_modules/@capacitor-community/stripe/ios/Plugin/PKAuthViewDelegate.swift:79:93: cannot convert value of type 'Error?' to expected argument type 'String?'
                    callback.reject("unable to create token: " + err!.localizedDescription, err)

and

        call.error("Google Pay is not available on iOS")
             ^~~~~
             reject
/Users/vagrant/git/node_modules/@capacitor-community/stripe/ios/Plugin/StripePlugin.swift:668:33: warning: 'getSavedCall' is deprecated: renamed to 'savedCall(withID:)'
        if let c = self.bridge?.getSavedCall(ctx.callbackId) {
                                ^
/Users/vagrant/git/node_modules/@capacitor-community/stripe/ios/Plugin/StripePlugin.swift:668:33: note: use 'savedCall(withID:)' instead
        if let c = self.bridge?.getSavedCall(ctx.callbackId) {
rdlabo commented 3 years ago

@patrickbussmann Thanks for check working. I fixed and pre-released 3.0.0-1.

rdlabo commented 3 years ago

https://github.com/capacitor-community/stripe/releases/tag/v3.0.0-1

donPuerto commented 3 years ago

@rdlabo do we have documentation to follow or blog post? ie Vue Angular

rdlabo commented 3 years ago

@donPuerto not yet. For the time being, I plan to spend my time on refactoring and feature checking. But Capacitor 3 don't support IE, so this plugin don't support IE too. Thanks.

donPuerto commented 3 years ago

@rdlabo Thanks for the work mate. Yeah dump that IE :)

rdlabo commented 3 years ago

Secret key of Stripe is not public key. This plugin suggest input secret key to code. This is not recommended. It seems that it will need to be remade into a completely new style in v3 support.

patrickbussmann commented 3 years ago

Secret key of Stripe is not public key. This plugin suggest input secret key to code. This is not recommended. It seems that it will need to be remade into a completely new style in v3 support.

You mean removing the secret key?

Can we help you somehow with this new style?

hideokamoto commented 3 years ago

@rdlabo Hi team!

I think we should remove these classes and methods. https://github.com/capacitor-community/stripe/blob/feat/v3/src/web.ts#L376-L430 https://github.com/capacitor-community/stripe/blob/feat/v3/src/web.ts#L319-L373

There using a Stripe secret key, but the key should not use on the frontend.

I think we should recreate it to follow the Stripe JavaScript SDK. If you wanna try this, I can help you.

rdlabo commented 3 years ago

@patrickbussmann @hideokamoto YES. I will remove secret key and method of using this. Currently this plugin can create payment alone. But will be change to have to using backend. The big role of the plugin will be to create a payment UI.

I will do the rough development, so I would appreciate it if you could help me with the tests and reviews.

danielehrhardt commented 3 years ago

I get no response from Google Pay. const { success, token } = (await stripePlugin.payWithGooglePay({ gets never resolved.

patrickbussmann commented 3 years ago

gets never resolved.

Because of missing upgrade: https://capacitorjs.com/docs/updating/plugins/3-0#android-request-codes

Lets give @rdlabo some time. Then we can start writing tests and then all people can start using this with Capv3.

danielehrhardt commented 3 years ago

@patrickbussmann @hideokamoto YES. I will remove secret key and method of using this. Currently this plugin can create payment alone. But will be change to have to using backend. The big role of the plugin will be to create a payment UI.

I will do the rough development, so I would appreciate it if you could help me with the tests and reviews.

Do you have time to take a look into that issue?

rdlabo commented 2 years ago

@hideokamoto I created draft of web implements. https://github.com/capacitor-community/stripe/pull/74/commits/d2b0d2199a0a88b0f988135f29248024b59fccae

Stripe's "Elements" is not useful for Plugin, so we should create Web Components like PaymentSheet UI at OS & Android. Can you create with StencilJS?

スクリーンショット 2021-07-12 22 35 53

rdlabo commented 2 years ago

YES!!!!

danielehrhardt commented 2 years ago

YES!!!!

Really Nice !!

rdlabo commented 2 years ago

This is Android!!

rdlabo commented 2 years ago

Released: https://github.com/capacitor-community/stripe/releases/tag/v3.0.0-2

Support only these method:

ApplePay and GooglePay is included at PaymentSheet. So these method is removed.

danielehrhardt commented 2 years ago

Released: https://github.com/capacitor-community/stripe/releases/tag/v3.0.0-2

Support only these method:

  • initialize
  • createPaymentSheet
  • presentPaymentSheet

ApplePay and GooglePay is included at PaymentSheet. So these method is removed.

image


 Stripe.addListener(PaymentSheetEventsEnum.Completed, (response) => {
      console.log('PaymentSheetEventsEnum.Completed', response);
    });
rdlabo commented 2 years ago

@danielehrhardt Thanks try, and sorry mistake. I fixed type and release at https://github.com/capacitor-community/stripe/releases/tag/v3.0.0-3 If it is possible, please try again. Thanks.

スクリーンショット 2021-07-14 21 40 53

danielehrhardt commented 2 years ago

@danielehrhardt Thanks try, and sorry mistake. I fixed type and release at https://github.com/capacitor-community/stripe/releases/tag/v3.0.0-3 If it is possible, please try again. Thanks.

スクリーンショット 2021-07-14 21 40 53

image

patrickbussmann commented 2 years ago

image

To be on the safe side I added your case to the demo app so that the build process will fail when its an issue.

https://github.com/capacitor-community/stripe/pull/78

rdlabo commented 2 years ago

@danielehrhardt @patrickbussmann Thanks for try🙏

I will merge to master branch. Let's discuss Individual new issues!