#shakil-apple-pay-rn
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- shakilkhan496, 1 day ago, 25 messages
- shakilkhan496, 1 day ago, 57 messages
I have already completed payment sheet pop up integration on react native app and working correct.
If I configure the apple pay on payment method setting is there posibility to show the apple pay option on the payment sheet ?
This is my 1st question
Where is that first screenshot from?
AFAIK you need to follow these steps for Apple Pay
https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-apple-pay
And then it will apear on payment sheet ?
yes
if you follow the steps in the docs then it should show up (unless Apple Pay isn't supported in your country)
Okay please review my code
"const fetchPaymentSheetParams = async (price, receiver, sender, time) => {
const response = await fetch(https://75f7-103-25-251-228.ngrok-free.app/payment-sheet, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
price, receiver, sender, time
})
});
console.log(response);
const { paymentIntent, ephemeralKey, customer } = await response.json();
return {
paymentIntent,
ephemeralKey,
customer,
};
};
const initializePaymentSheet = async (price , receiver , sender , time) => {
console.log('Initializing payment sheet');
const {
paymentIntent,
ephemeralKey,
customer,
publishableKey,
} = await fetchPaymentSheetParams(price, receiver, sender, time);
const { error } = await initPaymentSheet({
merchantDisplayName: "Example, Inc.",
customerId: customer,
customerEphemeralKeySecret: ephemeralKey,
paymentIntentClientSecret: paymentIntent,
// Set `allowsDelayedPaymentMethods` to true if your business can handle payment
//methods that complete payment after a delay, like SEPA Debit and Sofort.
allowsDelayedPaymentMethods: true,
defaultBillingDetails: {
name: user.displayName,
}
});
if (!error) {
setLoading(true);
}
await openPaymentSheet();
};
const openPaymentSheet = async () => {
const { error } = await presentPaymentSheet();
if (error) {
Alert.alert(`Error code: ${error.code}`, error.message);
} else {
Alert.alert('Success', 'Your order is confirmed!');
}
};"
This is the code now this is showing the payment sheet correctly.
Do I need to change any code configuration? Or if I only configure the apple pay from the stripe payment method setting that will be done?
shakil-apple-pay-rn
<StripeProvider
publishableKey="pk_test_51M5vv4CLTcmkmHRYbLOL5pjvoNfQe0mptVirDWj3RH2BEY4UcmefgIgys2i8Ax1l5qXILfQyTWeU2ZfUAVOd4ArQ00ZSQnlgsK" // replace with your actual publishable key
// urlScheme="your-url-scheme" // required for 3D Secure and bank redirects
// merchantIdentifier="merchant.com.{{YOUR_APP_NAME}}" // required for Apple Pay
>
Please read the docs I linked, they explain everything
https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-apple-pay
We can't just look at the code and say if it works 100% ๐
You need to test it out and see how it functions
I mean now the payment sheet apearing correct.
I am asking you that is that need any extra configuration on code for apple pay ?
Or do I need only setup the stripe payment method configuration from stripe dashboard
I understand what you're asking. The link I shared above has the answer to it. If you refer to it then it lists all the changes you'd need to make in addition to modifying your code.
Please refer to the docs first: https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-apple-pay
const { error } = await initPaymentSheet({
merchantDisplayName: "Example, Inc.",
customerId: customer,
customerEphemeralKeySecret: ephemeralKey,
paymentIntentClientSecret: paymentIntent,
// Set allowsDelayedPaymentMethods to true if your business can handle payment
//methods that complete payment after a delay, like SEPA Debit and Sofort.
allowsDelayedPaymentMethods: true,
defaultBillingDetails: {
name: user.displayName,
},
applePay: {
merchantCountryCode: 'US',
},
});
I have added "applePay: {
merchantCountryCode: 'US',
}," portion on the code
๐
Okay I need help with the
Configure domains
Configure iOS certificates
What will be the domain and how can I configure IOS certificates?
What docs are you reading?
Yes from the docs I am not understanding so I am asking you.
What docs exactly? Can you share the link?
where does it say you need to configure a domain?
The domains are for Web based integration. You're using React Native which is a mobile platform. The docs for react native does not say anything regarding domain registration. So you can just move on to certificate part.
Okay, this conversation is very helpful for me. Thanks a lot, sir.