There's one weirdness that I'm not sure how to solve, though. Clicking "buy" used to work like this: do some AJAX to turn the CC into a token, when that comes back, actually submit the form; on the back end, do some database junk; do some payment junk; and finally emit HTML saying "thank you" or "error".
With Apple Pay it's basically the same but with different JS junk -- however, said JS junk seems to want me to invoke its "completePayment" method after I've done my backend payment junk and determined whether it succeeded or failed. And calling that method on is, you know, tough to do after I've submitted a form and loaded a new page and the ApplePaySession object no longer exists.
If I don't call that method, it seems to work anyway -- the order goes through, the card is charged -- but the Apple Pay popup on the phone times out and says the order didn't complete, which is less than ideal.
So, short of rewriting everything to work completely differently... any brilliant suggestions?
Anyway, take a look at checkout.js and let me know if you see anything stupid in there.