#cheelin-apple

1 messages · Page 1 of 1 (latest)

hollow meteor
#

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.

errant ermine
#

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

hollow meteor
#

why is your .on('paymentmethod' function empty?

hollow meteor
#

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 with ev.complete('success'); and see what happens the next time you test.

errant ermine
errant ermine
# hollow meteor you have to, it's required

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);
}
}
});
});

hollow meteor
#

have you tried it on a different phone?

errant ermine
hollow meteor
#

can you?

#

also, did you register your domain for Apple Pay according to our instructions?

hollow meteor
#

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

hollow meteor
#

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.

errant ermine
hollow meteor
#

probably because the actual payment failed and you call into ev.complete('fail'); for example

#

you'd just debug it some more.

errant ermine
hollow meteor
#

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

modest flicker
#

Confirming that Apple Pay is also functioning fine me on that URL

errant ermine
errant ermine
errant ermine