#dhoang - Apple Pay
1 messages · Page 1 of 1 (latest)
Hello! Are you able to reproduce this error at will, or does it only happen sometimes?
If you're table to reproduce can you look in the web developer console and see if any errors or warnings related to this are shown there?
Also, can you share the Stripe Payment Request code you're using? I'm particularly interested in your paymentRequest event listening code: https://stripe.com/docs/js/payment_request/events
I am able to reproduce this at will on our demo environment
Ah, in test mode? Is that exposed publicly? If so can you provide a link so I can reproduce/debug on my end?
paymentRequest.on("paymentmethod", async ev => {
try {
const { streetAddress1, streetAddress2, city, zipCode, state, phoneNumber } = form.getState().values
const updatedUserInfo = await updateUser({
variables: {
params: {
addressAttributes: { streetAddress1, streetAddress2, city, zipCode, state },
phoneAttributes: {
phoneAreaCode: phoneNumber!.slice(0, 3),
phoneNumber: phoneNumber!.slice(3, 10)
}
}
}
})
const createSetupIntentResult = await createSetupIntent({
stripe,
paymentMethodId: ev.paymentMethod.id,
setupIntentMutation
})
if (createSetupIntentResult.error) {
ev.complete("fail")
} else {
const checkoutResult = await handleCheckout({
nameOnCard: ev.paymentMethod.billing_details.name,
updatedUserInfo,
paymentMethodId: ev.paymentMethod.id
})
if (checkoutResult.errors) {
Sentry.captureException(checkoutResult.errors)
ev.complete("fail")
setCheckoutErrors(checkoutResult.errors)
} else {
flagsClient?.track(Events.CheckoutWithPaymentRequest, { type: ev.walletName })
flagsClient?.track(
ev.walletName === "applePay" ? Events.CheckoutWithApplePay : Events.CheckoutWithGooglePay
)
ev.complete("success")
checkoutResult.goToCheckoutConfirmationPage()
}
}
} catch (e) {
Sentry.captureException(e)
ev.complete("fail")
}
})
however, I don't think it ever hits our APIs as the network tab doesn't show any requests being made to updateUser (the first api call in the code above)
the last API call made in the network tab before it polls on the payment request form for a while before erroring is this call from q.stripe.com:
The q.stripe.com requests aren't critical to/directly involved with the payment process. That error can be safely ignored.
Can you share your paymentRequest.canMakePayment() code?
useEffect(() => {
let mounted = true
if (stripe) {
try {
const pr = stripe.paymentRequest({
country: "US",
currency: "usd",
total: {
label,
amount: amountInCents
},
requestPayerName: true,
requestPayerEmail: true,
requestPayerPhone: true
})
pr.canMakePayment().then(result => {
if (result) {
if (mounted) {
setPaymentRequest(pr)
setWallets(result)
}
}
})
} catch (e) {
/**
* if stripe API fails for whatever reason for google/apple pay,
* record the exception and hide the button
* */
Sentry.captureException(e, { extra: { amountInCents, pricedProducts: JSON.stringify(pricedProducts) } })
setPaymentRequest(null)
}
}
return () => {
mounted = false
}
}, [stripe])
just want to also note, we have no issues with google chrome payment request form. just safari/apply pay
Is this happening on multiple Apple devices or just one?
multiple apple devices. i've also tested this on my iphone and another engineer on his iphone
Does the Apple Pay button at the top of this page work normally for you? https://stripe.com/docs/stripe-js/elements/payment-request-button
yes it does
just to note, we've had this apple pay button working and had previous users on it. it does show on our website.
Can you give me your Stripe account ID? You can find it in your Dashboard at the bottom of this page: https://dashboard.stripe.com/settings/user
acct_1H5LGqB2H6yYUNlL
You have several Apple Pay domains on this account, is this issue happening on all of them?
can you send me a link to view them?
it is failing on our production + demo domains.
so yes
You can view your Apple Pay domains here: https://dashboard.stripe.com/settings/payments/apple_pay
I can't see anything wrong on our end. I think the next step would be for me to reproduce and debug this myself. Can you provide access to a page in test mode that reproduces the issue and provide a link here?
unfortunately, I don't have a public test link i can share
I was just curious if you've seen something like this before / what are some best practices on logging errors around the payment request form?
I was thinking, how often do I need to renew the certificate for the apple pay domain?
Hello! @junior girder had to step away, but give me a few minutes and I can catch up
yeah it looks like I'm seeing this in google pay (chrome browser console)
pay.js:127 DEVELOPER_ERROR in loadPaymentData: An error occurred in call back, please try to avoid this by setting structured error in callback response
Oh interesting - I thought you said google pay was working fine?
yeah I misspoke, I just tried it now
it seems like we do have a buggy payment request form. Sorry about that
no worries! Do you need any help looking into it?
ah yes, I'm not sure where to even begin looking as this developer error above doesn't make sense to me.
👍 Let me take a look then!