capacitor-community / stripe

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

Google pay issues #5

Closed JoshuvaGeorge03 closed 4 years ago

JoshuvaGeorge03 commented 4 years ago

Issue 1

@ihadeed I am having below error when I try to do paywithGooglePay in my app.

let me summarized the steps to reproduce the issue.

When I invoke payWithGooglePay, then an action sheet is opened, followed up with the error alert box pops up.

Request failed:

Unexpected developer error, please try again later.

Please advice, what this means? And also please advice, how to do payment with google pay and apple pay?

issue 2

@ihadeed I have found out the reason for the above error. Please see below

03-09 11:54:24.137 13820 13820 W WalletMerchantError: Error in loadPaymentData: PaymentDataRequest.allowedPaymentMethods[0].parameters.allowedCardNetworks[0] = AMERICAN_EXPRESS is not a valid enum value for this field.
03-09 11:54:27.606 13820 13820 W WalletMerchantError: Error in loadPaymentData: PaymentDataRequest.allowedPaymentMethods[0].parameters.allowedCardNetworks[0] = AMERICAN_EXPRESS is not a valid enum value for this field.
03-09 11:54:43.038 13820 13820 W WalletMerchantError: Error in loadPaymentData: PaymentDataRequest.allowedPaymentMethods[0].parameters.allowedCardNetworks[0] = AMERICAN_EXPRESS is not a valid enum value for this field.

03-09 11:55:14.504 13820 13820 W WalletMerchantError: Error in loadPaymentData: PaymentDataRequest.allowedPaymentMethods[0].parameters.allowedCardNetworks[0] = UNKNOWN is not a valid enum value for this field.
03-09 11:56:18.973 13820 13820 W WalletMerchantError: Error in loadPaymentData: PaymentDataRequest.allowedPaymentMethods[0].parameters.allowedCardNetworks[0] = UNKNOWN is not a valid enum value for this field.
03-09 11:56:21.028 13820 13820 W WalletMerchantError: Error in loadPaymentData: PaymentDataRequest.allowedPaymentMethods[0].parameters.allowedCardNetworks[0] = UNKNOWN is not a valid enum value for this field.
03-09 11:56:24.536 13820 13820 W WalletMerchantError: Error in loadPaymentData: PaymentDataRequest.allowedPaymentMethods[0].parameters.allowedCardNetworks[0] = UNKNOWN is not a valid enum value for this field.

and please advise, why UNKNOWN is not valid enum and Why AMERICAN_EXPRESS, not a valid enum. But these values are present in the enum.

If I put a visa or master card in allowed card networks payment sheet opens without any alert box.

issue 3

@ihadeed Please respond to my queries, I am having a lot of issues with this plugin. I need your clarification and guidance for this.

When I do confirm payment Intent with googlePayOptions, I got below error. I create payment intent from the server. and then passing my client secret to stripe plugin confirm payment intent. But I got the error. Please see the below code and advice.

const stripePublishable = await this.
        cinchSrv.fs.doc$<any>('${environment.appConfig.commerceAccount}/meta/stripe-publishable')
        .pipe(take(1)).toPromise();
      await Stripe.setPublishableKey({ key: stripePublishable.publishableKey });
      await Stripe.confirmPaymentIntent({
        clientSecret: cs,
        googlePayOptions: {
          merchantName: 'test',
          totalPrice: 100,
          totalPriceStatus: 'FINAL',
          currencyCode: 'NOK',
          allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
          allowedCardNetworks: [ 'MASTERCARD', 'VISA'],
        }
"unable to complete transaction: You cannot confirm this PaymentIntent because it's missing a payment method. You can either update the PaymentIntent with a payment method and then confirm it again, or confirm it again directly with a payment method."

I can't able to use payWithGooglePay also, because it return void rather than token response. Please advice.

bolekro commented 4 years ago

Same problem here, payWithGooglePay returns empty object instead of a token.

JoshuvaGeorge03 commented 4 years ago

@bolekro is the pull request u mentioned fixes the issue of void being return?

bolekro commented 4 years ago

Yes, now it returns a json token object.

On Wed, Apr 29, 2020, 04:38 Joshuva George notifications@github.com wrote:

@bolekro https://github.com/bolekro is the pull request u mentioned fixes the issue of void being return?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zyra/capacitor-stripe/issues/5#issuecomment-620960083, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3MX32RRAYEB2JI2WVEKODRO6HIVANCNFSM4LT7BKBA .

ihadeed commented 4 years ago

This is a documentation issue.

payWithGooglePay is meant to be called first to ensure the user has authorized the payment via Google Pay. This generates a token which is stored locally in the plugin for later use. You can call confirmPaymentIntent immediately after that and set fromGooglePay: true in the options to consume the saved token.

I might combine the two methods into one, so you can use like the example above. Need to first make sure there isn't any other use for those Google Pay tokens.

JoshuvaGeorge03 commented 4 years ago

@ihadeed I will use it like that. Thanks.

When will the version with both combined be released?

ihadeed commented 4 years ago

Current 1.0.0-beta.0 release has a working Google pay implementation but it requires the 2 step process. (payWithGooglePay, then confirmPaymentIntent)

When I have some time I'll make confirmPaymentIntent take care of the whole process.

JoshuvaGeorge03 commented 4 years ago

@ihadeed Thanks for the reply, I will check it out..