capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isApplePayAvailable always undefined, createApplePay works fine

alexcroox opened this issue · comments

commented

Platform

  • Web
  • iOS
  • Android

Describe the bug
I believe I've followed all the setup steps but I'm still getting undefined back from my initial isApplePayAvailable() call.

What exactly does that function check for? Does it check the user is on iOS and they have a card setup in their wallet?

image

image

server: {
  androidScheme: 'https',
  iosScheme: 'ionic'
}
import { Stripe as NativeStripe } from '@capacitor-community/stripe'

const isApplePayAvailable = await NativeStripe.isApplePayAvailable()

console.log({ isApplePayAvailable })

^ always undefined. I'm using NativeStripe because I already have Stripe JS SDK for payments using Stripe elements (that works fine in production on Capacitor iOS and Android)

I've also tried initialising first

 NativeStripe.initialize({
  publishableKey: process.env.STRIPE_PUBLISHABLE_KEY
})

I've tried this on both the iOS simulator, and deployed a proper build through TestFlight on a device that has Apple Pay setup and it still fails. I've also tried a sandbox account on the simulator with Apple pay enabled on the sandbox account.

I've run out of ideas!

commented

If I ignore the result of isApplePayAvailable and just call createApplePay() everything goes through fine, I just want to know why that initial check fails.

commented

Ah ok. Usually functions that start with “is” return booleans. Something to consider to avoid future confusion for others. Thanks.