Reputation: 1
On Web, To accept payment details from customer, I am using stripe setupIntent clientsecret key to show payment method popup.
Here is the code that I have used.
<script>
async function createSetupIntent(customerId)
{
let setupIntentSecret = "";
try
{
const setupIntent = await stripe.setupIntents.create({
customer: customerId,
automatic_payment_methods: {
enabled: true,
allow_redirects: 'always'
},
});
setupIntentSecret = setupIntent.client_secret
}
catch(error)
{
throw error;
}
return setupIntentSecret;
}
let setupIntentSecret = createSetupIntent(custId)
const appearance = {
theme: 'stripe',
};
const options = {
clientSecret: setupIntentSecret,
appearance,
};
elements = stripe.elements(options);
paymentElement = elements.create("payment");
paymentElement.mount("#payment-element");
</script>
<html>
<div style="width:100%;height:100%;;padding:10px;overflow:auto">
<form id="payment-form">
<div id="payment-element" ></div>
</form>
</div>
</html>
The Setup element popup still does not show me the option for Apple Pay. What should I do to see the Apple Pay option on the setupIntent popup? I have already configured and verified the domain in Stripe settings.
Upvotes: 0
Views: 399
Reputation: 1354
Apple Pay should show up in the Payment element as long as:
If you have checked both of those things and Apple Pay is still not showing up on your page, you can reach out to Stripe's support[3]. It will be helpful for debugging if you provide URL of the domain that you are trying to get Apple Pay to show up on. If you have a public test page with the Payment Element, that can be helpful for debugging as well.
[1] https://docs.stripe.com/payments/payment-methods/pmd-registration
[2] https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements
Upvotes: 0