Reputation: 3553
currently I can't seem to find how to use Google Pay or Apple Pay with CardField component, is it currently possible?
I'm using this Stripe's official reaft-native sdk:
https://github.com/stripe/stripe-react-native
Upvotes: 0
Views: 670
Reputation: 115
you can use initPaymentSheet
. This is from what I can see and know the only solution that we have right now (used by me) for Apple or Google Pay...
I don't know why the docs (https://github.com/stripe/stripe-react-native) do not talk on their front page about this option, but for me worked just fine.
Also, make sure you check the stipe official docs also for more info because they also help with examples and explain the logic for why/how/what to do certain things (stripe docs).
A small example that can help you and others is below:
import {
useStripe,
} from '@stripe/stripe-react-native';
const {initPaymentSheet, presentPaymentSheet} = useStripe();
IMPORTANT:
In order to show ('work') the bottom sheet (initPaymentSheet) you need either paymentIntentClientSecret
OR setupIntentClientSecret
.
Make sure that you have one of these 2 if not you will get an error :).
await initPaymentSheet({
applePay: true,
googlePay: true,
customerId: customerId,
merchantCountryCode: merchantCountryCode,
merchantDisplayName: merchantDisplayName,
paymentIntentClientSecret: paymentIntentClientSecret,
setupIntentClientSecret: setupIntentClientSecret,
customerEphemeralKeySecret:ephemeralKeySecret,
style: 'alwaysLight',
primaryButtonColor: 'red',
allowsDelayedPaymentMethods: true,
testEnv: 'development',
customFlow: false,
defaultBillingDetails: {
address: {
city: city,
country: country,
line1: line1,
line2: line2,
postalCode: postalCode,
state: state,
},
name: name,
email: email,
phone: phone,
},
returnURL: returnURL,
});
Upvotes: 1