Apple Pay Fails in Chrome

I'm implementing Apple Pay for our application via the Apple Pay JS API, and everything works as expected when initiating a session from a Safari browser. However, when attempting to start a session in a non-Safari browser (Chrome in this case), I see the following behavior:

  1. The "Scan Code with iPhone" popup appears
  2. I scan the code with my device (9th gen iPad running iPadOS 18.5 if that matters)
  3. The Apple Pay view does not appear on the device, and the "Scan Code" popup closes on the browser without any further information given.

I can see the messages being passed in the network tab, with the final message being a "getPaymentRequestResponse" message appearing at the time the code is scanned. I suspect merchant validation is failing since that should be the next step, but that's just an educated guess at this point. I would appreciate any help getting this issue resolved.

Answered by pfrith87 in 850551022

Looks like it was failing because the "label" field under the total was null instead of an empty string. I appreciate your help!

Hey!

Sorry to hear that this isn’t working, let’s see what we can do.

Behaviour between Safari and third party browsers should generally be the same, but there may be instances of failure where the types used for values differ slightly from the specification (some browsers can be more lenient, or more strict, with unexpected types). Considering it’s failing around the payment request stage, I suspect a value within the payment request you’re providing isn’t the correct type per the specification. An example could be using a number of 0/1, instead of the expected Boolean false/true. If you’re able to replicate your payment request at https://applepaydemo.apple.com/apple-pay-js-api, the built in schema checker may pick up the fault.

If logging from Chrome isn’t providing much information, it may be worth checking to see if the iPad is logging anything as well, which may provide some insight as to why it's failing. You can do this using Console on macOS with the device connected, and selecting it in the side menu. In particular, filtering on PassbookUIService should reduce most of the unnecessary noise in this situation. Installing the profile described below should provide some extra detail in the logs as well.

If this doesn't help, then we would need a sysdiagnose to investigate further, and we can follow up directly. I would recommend the following:

  • Install the "Apple Pay for iOS/iPadOS" logging profile on the iPad. This is available from https://developer.apple.com/bug-reporting/profiles-and-logs
  • Restart the iPad after installing the profile, and reproduce the issue a few times.
  • File Feedback through Feedback Assistant on the iPad, with as much information as possible. This should automatically provide a sysdiagnose that we can look at.

Please do not attempt to upload the sysdiagnose to this thread, but you can post the feedback number you’re provided with here. Information about Feedback Assistant and bug reporting can be found at https://developer.apple.com/bug-reporting.

I hope that helps!

Thanks, I'll give it a try and report back.

Accepted Answer

Looks like it was failing because the "label" field under the total was null instead of an empty string. I appreciate your help!

Apple Pay Fails in Chrome
 
 
Q