#cheelin-apple
1 messages · Page 1 of 1 (latest)
can you share the exact code you wrote?
the popup spinning like that can be due to a common integration error, if you did not call ev.complete in your code.
we did not call ev.complete in our code
paymentRequest = stripe.paymentRequest({
country: 'US',
currency: 'usd',
total: {
label: 'Demo total',
amount: 1099,
},
requestPayerName: true,
requestPayerEmail: true,
});
var elements = stripe.elements();
var prButton = elements.create('paymentRequestButton', {
paymentRequest: paymentRequest,
});
// Check the availability of the Payment Request API first.
paymentRequest.canMakePayment().then(function (result) {
if (result) {
prButton.mount('#stripeapplepay-btn');
} else {
document.getElementById('payment-request-button').style.display = 'none';
}
});
paymentRequest.on('paymentmethod', function (ev) {
// it do not reach here
})
why is your .on('paymentmethod' function empty?
you have to, it's required
if you don't call it then the interface will just spin for 30 seconds and then cancel, exactly as you see in the video
// it do not reach here
I wouldn't be too sure really, but at the very least for testing just replace that comment withev.complete('success');and see what happens the next time you test.
The current code flow is not there yet
paymentRequest.on('paymentmethod', function (ev) {
// it do not reach here
console.log('paymentmethod', ev)
// Confirm the PaymentIntent without handling potential next actions (yet).
console.log('before confirmCardPayment', client_secret, { payment_method: ev.paymentMethod.id }, { handleActions: false })
stripe.confirmCardPayment(client_secret, { payment_method: ev.paymentMethod.id }, { handleActions: false }).then(function (confirmResult) {
console.log('confirmCardPayment', confirmResult)
if (confirmResult.error) {
ev.complete('fail');
console.error('[confirmResult.error]', confirmResult.error);
stripeFail(confirmResult);
} else {
console.log('[confirmResult.success]', confirmResult);
ev.complete('success');
if (confirmResult.paymentIntent.status === 'requires_action') {
// Let Stripe.js handle the rest of the payment flow.
stripe.confirmCardPayment(client_secret).then(function (result) {
if (result.error) {
// The payment failed -- ask your customer for a new payment method.
console.error('[result.error]', result);
stripeFail(result);
} else {
// The payment has succeeded.
stripeSuccess(result);
}
});
} else {
// The payment has succeeded.
stripeSuccess(confirmResult);
}
}
});
});
have you tried it on a different phone?
no
can you?
also, did you register your domain for Apple Pay according to our instructions?
Below is my website url
feature-stripeapple---yezitao.dev.myshoplaza.com
I've successfully regsitered accordingly in the stripe portal( feature-stripeapple---yezitao.dev.myshoplaza.com)
and also upload file in below url. https://feature-stripeapple---yezitao.dev.myshoplaza.com/.well-known/apple-developer-merchantid-domain-association
Do i still need to register for myshoplaza.com and dev.myshoplaza.com?
Do i still need to register for myshoplaza.com and dev.myshoplaza.com?
it depends what page your Apple Pay button is on, but generally yes
like if the button is on dev.myshoplaza.com and that's the page in your video, that domain needs to be registered as well
whatever domain is shown in the browser when you're on your page with the Apple Pay button needs to be registered
the apple pay button only on this page
https://feature-stripeapple---yezitao.dev.myshoplaza.com/checkout/7182-Qq800001631?step=payment_method
checking something.
I tried your page and it worked fine actually and the popup closed as expected
so it's something wrong with your phone or your Apple account unfortunately, I'd try some other devices. Your code and domain registration seems correct enough.
Yeah, that's what happened on my end, too,popup closed as expected.
But after confirming the payment, it informed Apple Pay that it was not available on the site.
probably because the actual payment failed and you call into ev.complete('fail'); for example
you'd just debug it some more.
for me it completes normally and your code in on('paymentmethod') all executes
so like I said it's probably something about your phone or Apple account, I'd try some other devices
Confirming that Apple Pay is also functioning fine me on that URL
Which of the url
This page
Code execution flow has not reached EV.com plete('fail')
Thank you, karllekko. I'll try other devices on my end as well
yes, apple pay can use this URL normally , i sure