isApplePayAvailable always undefined, createApplePay works fine
alexcroox opened this issue · comments
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?
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!
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.
Yes. This method return void
.
Please check how to use: https://github.com/capacitor-community/stripe/blob/main/demo/angular/src/app/demo/demo.page.ts#L151
Ah ok. Usually functions that start with “is” return booleans. Something to consider to avoid future confusion for others. Thanks.