The Future of the PaymentRequest API

I am adding Apple Pay to my eCommerce site and I am having a lot of difficulty with the PaymentsRequest API in Microsoft Edge browser.

I have a partial implementation that displays the Apple Pay button and creates a PaymentRequest when the button is clicked. That's all.

On Safari, this is enough to display the Apple Pay dialog. The process doesn't proceed further because I haven't implemented a handler for the merchantvalidation event. With Chrome on a Mac, the behavior is the same, I can scan the code and see the Apple Pay dialog.

On Microsoft Edge, I never see the code to scan. In my web console, I'm seeing errors like

InvalidStateError: Failed to execute 'canMakePayment' on 'PaymentRequest': Cannot query payment request

and

NotSupportedError: The payment method "https://apple.com/apple-pay" is not supported. No "Link: rel=payment-method-manifest" HTTP header found at "https://www.apple.com/apple-pay/"

Is Apple Pay not supported on Windows?

I see the demo site here, which gets farther than I have gotten. It does display the scan code, but payment still never completes. I see the same payment-method-manifest error in the console.

If Apple Pay is not supported on any PCs other than Macs, is there any reason to use the PaymentRequest API instead of Apple Pay JS?

I started digging into the W3C standards and it turns out that merchantvalidation event is deprecated. Chrome on Mac does catch it, so it seems like it's supported there. But I have concerns about the long term future. Is it going to remain supported? If so, I would imagine that the interface could change.

It seems like the only benefit of the W3C PaymentRequest API is that Mac users with non-Safari browsers may still be able to use Apple Pay. In theory, that's something I'd still like to support, even if it's only a small number of users, but I only have time for one integration right now, and I need to pick the best one.

How much faith should I have in the W3C PaymentRequest API?

Is it reasonable to pursue it with the goal of including all Mac users regardless of browser? Or is it likely a dead API and I should stick to Apple Pay JS instead to provide a better experience to Safari users?

It also looks like the PaymentRequest API isn't fully finalized yet, so maybe that's the source of my issues. Maybe I should just use Apple Pay JS for now with an eye to supporting PaymentRequest when the spec is finalized.

I greatly appreciate your input.

If you include the Apple Pay JS SDK then Apple Pay will work on any browser or platform, including Windows.

It sounds like you might have an issue with your implementation. I am not able to reproduce this with Microsoft Edge 131.0.2903. Make sure you're importing the SDK correctly, since this is required to support Apple Pay on non-Apple platforms. You import it like so:

<script crossorigin src="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js">
</script>

You don't need to use Payment Request to support Windows - you can use either, because the SDK includes support for both.

If you're still having problems please file a bug report, ideally with as much context and code as you can, and we can take a look.

How much faith should I have in the W3C PaymentRequest API? [...] It seems like the only benefit of the W3C PaymentRequest API is that Mac users with non-Safari browsers may still be able to use Apple Pay

Apple actively participates in the development of Payment Request, and we recommend using it for Apple Pay on the web. However, there are many existing merchants who have adopted the original ApplePaySession API, and it remains fully supported.

As discussed, you can use either API and still get support for Apple Pay on Windows.

It should be noted that some new features are only supported on Payment Request. For example, disbursement requests - a special type of Apple Pay payment that sends money from a merchant to a user.

Thank you for the information! I think I fixed my incorrect implementation. I was creating the PaymentRequest prior to the user clicking the button. I waited until they clicked it to call show, but that's clearly not correct (at least for Windows, it did work before on Mac). Now that I wait to construct the object after the click, I see the graphic that can be scanned, and scanning it does show a payment sheet on my iPad. This works both with Edge on Windows and Chrome on Mac.

I really appreciate your help!

The No "Link: rel=payment-method-manifest" HTTP header found at "https://www.apple.com/apple-pay/". error is still present, but I see that on the demo site as well. I don't believe it's affecting functionality at this time.


I am glad to see that the merchant validation event is triggered in Edge, so I suspect I will be able to complete my implementation with the PaymentRequest API.

However, I am still concerned that W3C has marked it as deprecated.

https://www.w3.org/TR/merchant-validation/

W3C actually goes so far as to say it was removed from the spec, they only even have a document on it because some browser engine (at least Chrome, I suppose) already implemented it.

This is my primary concern about the stability of the API. If I deploy this solution to my eCommerce platform, am I going to be surprised one day to find that the merchant validation event no longer fires on the latest version of Chrome? Or am I going to find the Apple SDK has changed to a different event or setup?

I don't have much experience with W3C, so I don't really know what the warning means, but it looks severe. Can you speak to this specific feature and your expectations of its availability in the future?

Thanks again!

The Future of the PaymentRequest API
 
 
Q