I'm using smart payment buttons on a WordPress site I manage. Instead of integrating with an e-commerce plugin, I've opted to write the JS myself as it didn't seem that difficult. I'm creating an order successfully and all the payments are processing as expected in the sandbox and live environments as expected. My problem is that there seems to be a delay of 3-5 seconds between when the paypal modal and scrim disappear and when anything in the onApprove method actually fires. Even a simple console.log() has a long delay. I'm updating inventory locally in the onApprove. As it stands, if there is any activity on the page during that delay, it prevents the inventory update. Navigating away from the page, or simply refreshing means the inventory is not updated locally and the customer is not redirected to a success page. Is this behavior expected? If not, is there a workaround?
... View more