#shakil-apple-pay-rn

1 messages ยท Page 1 of 1 (latest)

somber wingBOT
#

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.

red grail
#

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

slow sigil
red grail
#

And then it will apear on payment sheet ?

slow sigil
#

yes

#

if you follow the steps in the docs then it should show up (unless Apple Pay isn't supported in your country)

red grail
#

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.

somber wingBOT
red grail
#

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?

somber wingBOT
#

shakil-apple-pay-rn

red grail
#

<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
>

slow sigil
red grail
#

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

slow sigil
red grail
#

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

slow sigil
#

๐Ÿ‘

red grail
#

Okay I need help with the
Configure domains
Configure iOS certificates

#

What will be the domain and how can I configure IOS certificates?

slow sigil
#

What docs are you reading?

red grail
#

Yes from the docs I am not understanding so I am asking you.

slow sigil
#

What docs exactly? Can you share the link?

slow sigil
#

where does it say you need to configure a domain?

red grail
slow sigil
#

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.

red grail
#

Okay, this conversation is very helpful for me. Thanks a lot, sir.