ios – How to get PaymentMethod from Apple Pay in Nativescript Stripe

0
69

[ad_1]

NativeScript + Angular iOS app uses Stripe plugin (the one found at triniwiz/nativescript-plugins), single payments are working as expected, with or without Apple Pay – it shows Apple Pay popup screen when expected.

The subscription/monthly payment feature is currently under development, standard card payment works just fine, recurring payments are created as expected, and can be tested with Stripe’s test clocks, and everything is working exactly as expected.

But – I’m having difficulties when trying to use Apple Pay for monthly subscriptions.

The plugin does not return the payment method when Apple Pay is used, because some Apple Pay magic should happen there. I’ve tried creating SetupIntent, and I get the correct off-session payment method for the other, non-Apple Pay payment method attached to the user. If there are no other cards, I can’t create an active subscription – because I don’t have any payment methods to use. Alternatively, I can create a subscription without a payment method, which will, expectedly, fail as soon as Stripe tries to charge, again, because there is no payment method to charge from.

Using PaymentSheets is currently off the table because there is a bug in the plugin, it’s not exposing PaymentSheets, and even with that fixed, I’m simply not sure how that could help – Apple Pay payment works without Payment sheets in single, non-recurring payments.

Creating PaymentIntents also does not work – because I don’t have a PaymentMethod.

So, it all boils down to a critical question – how do I get PaymentMethod out of Apple Pay?

[ad_2]