#death hand
1 messages · Page 1 of 1 (latest)
hi! do you have more context like some exact code you're using? if we take it one at a time, are you testing on Android(Google Pay) or iOS(Apple Pay)? which one do you want to look into trying to get working first?
I tried to follow the first video course, where the functions they call was initPaymentSheet, presentPaymentSheet. Im currently testing on android
In initPaymentSheet I added googlePay:{
merchantCountryCode: ,
testEnv: ,
currencyCode:
}
Yes I didn’t included what the values are here but in my code they exist
and you're running the app on a phone that has Google Pay working in general, logged in your Google account with cards in your Google Pay wallet?
yes. I don't think that is the problem because the option does not show at all
are you in India?
no
could you perhaps share the code you're using?
yes, wait a little so i can make it using the bare minimum
<StripeProvider publishableKey='pk_test_51NBeM4GijvpKRItrry0QbRYNk6xyoPeofTCnH2roG4Xei425NVnVE2PJqJBvk22ZGr1cctPvE4nJ9vB2EUkxgGPg006WOI1CGv'
>
<View style={{
flexDirection: 'row',
justifyContent: 'space-between',
alignSelf: 'center',
marginHorizontal: 15,
}}>
<View style={styles.buttonContainer}>
<Button
title={'Buy'}
onPress={() => handleSelectMethod()}
/>
</View>
</View>
</StripeProvider>
</View>```
initPaymentSheet,
presentPaymentSheet,
confirmPaymentSheetPayment,
} = usePaymentSheet();
// Initialize stripe values upon mounting the screen
React.useEffect(() => {
(async () => {
await initializePaymentSheet();
})();
}, []);
const initializePaymentSheet = async () => {
const URL = 'http://192.168.2.32:3000/payment-sheet'
const response = await fetch(URL, {
method: 'POST',
headers: {
'Content-Type': 'application-json'
},
})
/* Await the response */
const {
paymentIntent,
ephemeralKey,
customer
} = await response.json();
const { error, paymentOption } = await initPaymentSheet({
customerId:customer,
customerEphemeralKeySecret:ephemeralKey,
paymentIntentClientSecret: paymentIntent,
merchantDisplayName: 'nick',
style: 'alwaysDark', // If darkMode
googlePay: {
merchantCountryCode: 'GR',
testEnv:true,
currencyCode:'eur'
}, // If implementing googlePay
// applePay: {
// merchantCountryCode:'GR'
// }, // If implementing applePay
merchantCountryCode: 'GR', // Countrycode of the merchant
testEnv: __DEV__, // Set this flag if it's a test environment
});
if (error) {
console.log(error)
} else {
setReady(true)
}
};
const handleSelectMethod = async () => {
const { error, paymentOption } = await presentPaymentSheet();
if (error) {
console.log(paymentOption)
alert(`Error code: ${error.code}`, error.message);
}
else{
alert('success');
setReady(false);
}
}```
and this is the post request on the server side
const email = `test${Math.floor(Math.random() * 9999) + 1}@domain.com`
const stripe = new Stripe(SECRET_KEY, {
apiVersion: '2020-08-27',
typescript: true,
});
const customer = await stripe.customers.create({email});
const ephemeralKey = await stripe.ephemeralKeys.create(
{customer: customer.id},
{apiVersion: '2020-08-27'},
);
const paymentIntent = await stripe.paymentIntents.create({
amount: 5099,
currency: 'usd',
automatic_payment_methods: {
enabled: true,
},
});
return res.json({
paymentIntent: paymentIntent.client_secret,
ephemeralKey: ephemeralKey.secret,
customer: customer.id,
});
});```
Hey! Taking over for my colleague. You are testing your website from https of from your localhost ?
localhost
You need to serve your website over https in order to see Google and Apple Pay
it is not a website, I'm developing an app using react native Expo. Or do you mean the server I'm using to create the paymentIntent ?
Ah sorry I though you are developping a reactjs app.
Do you have a valid card in the device you are testing with ?
The option google pay or apple pay does not exist in the payment sheet
i am seeing this
It won't exist if you don't set Apple wallet on the ios device with or Google Wallet/Account set on the Android device you are testing
in react native Expo, even tho the docs says it won't work with stripe on the Expo go app, will the option still be visible in the payment sheet?
in react native Expo, even tho the docs says it won't work with stripe on the Expo go app,
Where are you seeing this, can you please share the reference ?
But in all cases you should see Google/Apple Pay in PaymentSheet if your device has Apple/Google wallet set,
then its still a problem
For example, on Ios, using expo react native integration
What is the problem exactly ?
i am seeing this
the option for platform pay is not visible in my case
what about this? did you set up cards on your Google/Apple wallet ?
yes I have in apple wallet
Can you test this reactnative screen in your expo app?
https://github.com/stripe/stripe-react-native/blob/master/example/src/screens/PaymentsUICompleteScreen.tsx
I know this is wrapped in a ReactNative app but you can easialy integrate it in your expo app .
ok I'm testing it and I will tell you how it goes, thank you in advance