Login

Page Already Has an Active Payment Session – Why Does this Apple Pay Checkout Error Occur?

Apple Pay checkout error

This is a common issue that affects sites with Apple Pay checkouts. It occurs during the checkout process when an Apple Pay session is started; the issue either prevents the payment sheet from appearing or causes it to disappear before the session ends properly. This results in the user being unable to checkout via Apple Pay, as they cannot complete or end their current payment session or start a new session.

Apple Pay Checkout Error Description

Error Signature:

Apple Pay JS Error Signature

Error Message:

Apple Pay JS Error Message

Why Does this Apple Pay Checkout Error Occur?

To understand this issue, we must examine the steps of the Apple Pay logic flow. Consult Apple’s guide to Requesting an Apple Pay Payment Session for a detailed look.

Merchant validation is the first step when submitting a payment via Apple Pay. This involves the following:

  1. Create an ApplePaySession object.

  2. Call the .begin() function with the new ApplePaySession object to present the payment sheet and initialize the merchant validation process.

  3. Once the merchant validation process is started, the onvalidatemerchant function is called with a ApplePayValidateMerchant object. This function calls your server, which in turn makes a new request to the remote Apple Pay server.

  4. The Apple Pay server responds with a Merchant Session object for your server to pass into the completeMerchantValidation function. This completes the validation process and allows the user to make a payment with Apple Pay.

 

The active payment session error indicates that the onvalidatemerchant function has failed, as it cannot request a new Merchant Session object from the Apple Pay server. This is because of the following rules Apple enforces for the object:

  • You can only use a merchant session object a single time per transaction.

  • The merchant session object expires five minutes after it is created. 

  • The merchant session request must be sent from your server. It cannot be requested from the client.

 

For more details, refer to this Discussion from the Apple support forums from a developer experiencing the same error with their Apple Pay session implementation.

In the discussion above, Apple support suggested potential causes:

  • The code that calls out to your server and receives the Payment Session to pass into completeMerchantValidation. If this is being hit twice then your client side code may have an error.

  • Along with #1, you could also debug your server to see if the same validationURL request is being run twice from the client, prompting two responses.

  • Lastly, the entire process could be running twice starting with new ApplePaySession. Examine the code that runs this path. This is likely when the user clicks or taps the Apple Pay button.

 

Uncovering the specific cause requires further investigation, as it likely depends on your implementation of the Apple Pay merchant validation process. However, in our experience with multiple Noibu clients, we’ve seen the following causes of the error.

Error Cause #1: User clicks Apple Pay multiple times

Since the Apple Pay merchant validation session may take several seconds, the user may not understand that they’ve triggered the start of an Apple Pay session, and may try the Apple Pay button multiple times. Unfortunately, this prevents the Apple Pay form from appearing and triggers the error, blocking the user from using Apple Pay.

There is an interesting discussion of this scenario on the Stripe Github.

From this discussion, developers suggested disabling the Apple Pay button after a user clicks until the merchant validation process completes. It could also help to add a loading indicator or confirmation that the click was effective.

Error Cause #2: Apple Pay triggered without user intervention

The site implementation of Apple Pay may have a bug that causes the site to trigger the merchant validation flow on the checkout page before the user has clicked the Apple Pay button. This summons a payment form that isn’t visible to the user, and when the user does click Apple Pay, they are unable to proceed.

This scenario is less common, but not impossible.

Risks and Mitigation

Once this error occurs, a user cannot checkout using Apple Pay unless they refresh or manually force the Apple Pay session to end. This can cause significant friction for users, especially since the error usually doesn’t usually produce a visible error message. We recommend prioritizing the issue and actioning a fix as soon as possible.

Detect Apple Pay Checkout Error and Other Third-Party Bugs with Noibu

Errors are inevitable on eCommerce websites, especially such third-party ones that you have no control over. Due to the endless third-party scripts and integrations that eCommerce websites have to partner with, it’s impossible to maintain a completely bug-free site at all times.

However, Noibu – an eCommerce error monitoring platform empowers you to stay on top of these bugs by proactively detecting all site errors (including third-party ones) and providing tangible solutions to resolve them without spending hours trying to replicate. The platform also calculates the predicated annual revenue impact of these errors so you can confidently ones with the highest impact and address them efficiently.

Noibu is designed to help development teams reduce error resolution time by 70% so they can focus on more strategic tasks such as feature releases. To explore how Noibu can help you eliminate revenue-impacting bugs on your site, sign up for a demo of the platform today!

Share Post:

Stay Connected

More Updates

Deliver better eCommerce experiences.
Prevent revenue loss.

Get a Free Site Audit!

Contact Sales Specialist
First

Get Your Free Checkout Audit!

Contact Sales Specialist
First

Get a Demo