#IvonneVargas
1 messages ยท Page 1 of 1 (latest)
Hello! Can you show me what your code looks like?
Hi, I'm using it in the componentDidMount:
async componentDidMount() {
let isApplePaySupported = await isPlatformPaySupported();
console.log("isApplePaySupported: " + isApplePaySupported);
this.setState({isApplePaySupported: isApplePaySupported})
}
i am following this example https://stripe.com/docs/apple-pay#setup but i don't use hooks, my app is class component
And you're getting no logs from that at all? Did you also put a long line before calling isPlatformPaySupported() just to make sure that code is being hit?
Yes, I put a console before calling isPlatformPaySupported and if it appears...
like this
async componentDidMount() {
console.log("componentDidMount");
let isApplePaySupported = await isPlatformPaySupported();
console.log("isApplePaySupported: " + isApplePaySupported);
this.setState({isApplePaySupported: isApplePaySupported})
}
๐ okay good, just wanted to be sure
so I assume you're seeing the "componentDidMount" log but nothing for "isApplePaySupported: "?
Are you seeing anything in your ios logs?
nothing... only the console
and other things...
I'm importing it like this ... import { StripeProvider, CardField, confirmPayment, PlatformPayButton, isPlatformPaySupported } from '@stripe/stripe-react-native';
Hmmm... are you testing with a real device, or the emulator?
and do you konw which version of our react native sdk you're using?
and what happens if you use isApplePaySupported() instead of isPlatformPaySupported() ? Does that one resolve?
try on a real device and it gave me this
Possible Unhandled Promise Rejection (id: 0):
TypeError: (0, _stripeReactNative.isPlatformPaySupported) is not a function. (In '(0, _stripeReactNative.isPlatformPaySupported)()', '(0, _stripeReactNative.isPlatformPaySupported)' is undefined)
phew that confirms what I thought - it's a versioning issue
isPlatformPaySupported wasn't added until version 0.22.0 (https://github.com/stripe/stripe-react-native/blob/master/CHANGELOG.md#0220---2022-12-02)
So it should work once you upgrade to a newer version
Ah, then that does matter
It's fine if you stay on that older version, you just shouldn't use isPlatformPaySupported() then
You'll want to use isApplePaySupported() and isGooglePaySupported() instead
you have doc for react-native-stripe 0.19.0?
Unfortunately not - all/most of our docs are usually updated to reflect the most recent version but we do provide an example App with the ReactNative SDK and you can go back and see what that example looked like with version 0.19.0 (https://github.com/stripe/stripe-react-native/tree/v0.19.0/example)
but in this version the hooks are also optional?
You mean the useApplePay and useGooglePay hooks?
any hook my app is class component
Yeah as far as I know the hooks should be optional, but definitely try it out
Thank you very much, I will check the example ๐