capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

presentPaymentFlow function is returning a card number but should be returning PaymentMethodID

dadoadk opened this issue · comments

commented

Platform

  • Web
  • iOS
  • Android

Describe the bug
I'm working on a Ionic mobile app with Angular, and I've been using Stripe for a while on web apps, so I tried to implement Google Pay and Apple Pay and Payment Sheet.
Here is something I learned. Users will subscribe faster if they don't have to type in the credit card during the process. When signing up using mobile application I'd like the users to have options to select Apple Pay, Google Pay or enter card number.

I need to have payment method ID returned back from either of those 3 options so I can combine Stripe Connect customer with the subscription plan they selected. It's a fairly common scenario.

Can you please advise me if I'm missing something from the capacitor/stripe functionality, or let me know if I need to use Stripe.js for my problem.

To Reproduce
Steps to reproduce the behavior:

  1. run Stripe.createPaymentFlow method with paymentIntent, customerId, customerEphermalKey
  2. run Stripe.presentPaymentFlow method
  3. see the Payment Sheet and enter credit card
  4. catch the result from presentPaymentFlow and get a 4-digit card number.

Expected behavior
presentPaymentFlow method communicates with the Stripe server to securely tokenize the card information and return a payment method identifier. This identifier can be used on the server-side to process the payment or create a subscription.

Additional context
Same workflow should be applied if user selects Apple Pay or Google Pay. My code should be able to get back paymentMethodId.

Usage Product
If you adopt this plugin, please let us know which product you are using.

Product Name:
Product URL :
Using Function:

  • Payment Sheet / Payment Flow
  • Apple Pay
  • Google Pay
  • Identity Verification Sheet
commented

TLDR - when calling presentPaymentFlow method const presentResult = await Stripe.presentPaymentFlow(); I need a paymentMethodID returned back.

Can someone help with this?

My code should be able to get back paymentMethodId.

The Stripe library should not return the methodId at the time of payment, so how about checking it on the backend through the customer token?

commented

Yes, that worked. I'm able to get paymentMethodId through my API by providing customerId.
Thank you. I appreciate your help.