#voraciocommerce_78703
1 messages ยท Page 1 of 1 (latest)
I don't know if we have specific docs on this but you'd need to listen for shippingaddresschange event on the element
https://stripe.com/docs/js/elements_object/express_checkout_element_shippingaddresschange_event
Once you receive the event with the address, you can calculate the delivery option and respond with the details when you call resolve
the API ref I shared above has an example
Thanks, taking a look...
Not sure this helps in our case. We need to obtain the address from ApplePay.
I know, the event handler should give you the address returned by ApplePay
Apple may not return the full address due to security reasons, but whatever is returned should be enough to calculate shipping
OK, so at the point the user selects to pay by ApplePay, will shippingaddresschange contain some adress details ?
when the user selects the address from the Apple Pay sheet, yes it should be reflected in the event handler
Cool, we then use that to calculate our delivery options/prices... how do we pass those back?
Here is an example from a website I used recently where the delivery options have been passed over to ApplePay
Appreciating the help here btw
NP! ๐ Happy to help
Assume first is considered as default
I'd think so but would recommend testing it out to be 100% certain
Ok se we then look for the address change and rate change (presume with some ID) so we store on the website side...
IE map it back to store against the order record
We there is a confirm even, with extra details we can store
OK great, this is how we expected it would work, but couldn't find the place in the docs...
OK it would be within ApplePay that they add the shipping cost to the total amount (or any other such payment like GPay etc) ?
Yup
Great
OK, I'm new to Discord. I have a couple of minor bugs with our current integration (not Express). Should I create a separte chat for that?
Many thanks for the help, we shall continue with our integration
You can continue asking questions here if you have any immediate ones.
If you need to come back later with more questions then feel free to post a new message in #dev-help
Great thanks, ok.....
One issue which seems intermittent...
When I select to pay with ApplePay, I'm getting message back saying 'Unable to show ApplePay. Please choose a different method and try again"
Then when I try again, it works, almost like a session time-out
You'd want to check your web console for any logs/errors
My senior developer Jakub is now on this chat
Hi guys ๐
I suspect you have some API operation happening when user clicks on "pay now" button and before apple pay modal gets shown
I don;t think you saw anything there di you Jakub? Lets take a look now
Apple has strict requirements around when the button gets clicked, the sheet should be shown in ~seconds/immediately
if you don't, then the call fails
The intermittent nature might be due to that API operation just completing faster in some cases
Hmm, ok.. could you tell me please, the way we have it now.... is that normal? Or should clicking Apple Pay automatically trigger the payment (rather than having to then click our "Pay now" button ?
no, customer needs to click "Pay now" to initiate payment process with Apple Pay
I'm assuming since you're using PaymentElement, you're calling confirmPayment on the button click correct?
Jakub is just checking...
๐ if you have any other functions/logic being called/invoked on button click then you'd likely want to take that out
Apple is quite sensitive about all that. You'd want to restructure your code to handle that logic after confirmPayment does its thing
Hi, just checked that and after click on Pay now we call our method by Ajax and then we call confirmPayment which might be issue as you mentioned
yup, ajax request might randomly finish faster/slower which makes it intermittent
yeh, that makes sense, we will re-order calling of those methods ๐
hanzo, thanks for your answers and advices, very useful ๐
Ok fantastic thanks Hanzo, one more issue please...
When I choose Pay Now with ApplePay and then click to go back to the payment choice screen, its showing a message to "Please fill in your card details"
HI ๐
I"m stepping in as @rain umbra had to go
Selecting Apple Pay should launch the apple pay modal window where you confirm the payment. Are you completing that step?
Hi
The model appears, but then when I click to close the modal (lets say I want to choose card instead), as soon as I click to close, we're getting the message to enter card details
"Please fill in your card details"
Okay, and what about that is unexpected?
So here, if I click the close X it then shows an error at the top of the screen saying "Please fill in your card details"
Like I have chosen to pay by card and clicked to pay without entering the card details, weird
The Payment Sheet is expecting you to have selected a payment method at that point, since you clicked on the Apple Pay button. But since you aborted the flow before you could complete it that is logged as an error. The intent is to make it clear to the user they have not completed their purchase.
OK, so I choose a Payment Method (ApplePay) and then decide I don't want to use that payment method, so I click the X. Seems odd that would be reported as an Error.
That errror appears to be showing up in a toast. Is this something your UI is doing?
When I click the X, ApplePay is still selected
Yes, you haven't selected anything else
Yes thats where we're showing any warnings back from Stripe, but this one isn't really relevant for the UX
In that case I would recommend you listen to the events and supress the error if it isn't relevant.