I'm trying to create an Apple Pay session for my website. I'm starting with curl for now, just to get proof of concept.
curl --cert cert.pem --pass {passphrase} --header "Content-Type: application/json" --request POST --data '{"merchantIdentifier":"{merchantIdentifier}","displayName":"testDisplayName", "initiative": "web", "initiativeContext": "{domain}"}' https://apple-pay-gateway.apple.com/paymentservices/paymentSession
This is the response I get back
{
"statusMessage": "Payment Services Exception merchantId={VERY-LONG-ID} not registered for domain={domain}",
"statusCode": "400"
}
I'm not sure why this is happening. {domain} is in the form of sub.site.tld with no protocol, such as https, which matches what I see in the list of the domains in the merchant identity dashboard. The {merchantIdentifier} also matches what I see in the top right, but the merchantId in the response is something I don't recognize. It's a long string of characters that appears to be hexadecimal.
I added the apple-developer-merchantid-domain-association file to my .well-known directory and the dashboard does report that the domain is verified.
I am making the request from the web server that the domain resolves to, if that matters.
I can't think of any reason this would be happening.
I'm not sure where the long merchantId in the response is coming from. Does it matter that it doesn't match what I supplied in the request? As far as I can tell, I am using the correct merchantIdentifier. It matches the dashboard and the CN field of the certificate.
I found this other post that seems to have a similar error: https://forums.developer.apple.com/forums/thread/671227
The main difference is a 417 status code instead of the 400 I got. But the problem here was that there was no payment processing certificate and I do have one of those.
I haven't checked with my processor to verify that the certificate is published, but I will do that soon. I wouldn't expect that to matter. Maybe it does?
What other reason could I be getting this error?
Could it be a problem with my merchant identity certificate? It took a lot of effort to make it work. But I suspect it's fine, otherwise I wouldn't be getting a response from Apple at all. I can't think of any other possible problems.
Post
Replies
Boosts
Views
Activity
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.
I'm working on adding Apple Pay to my web site and I'm getting this error when the element loads.
InvalidAccessError: Trying to start an Apple Pay session from an insecure document.
Do I need HTTPS on my development site? I have it on my production site, but I've never enabled it for dev.
If so, will it work with a self-signed certificate?
If not, what does this error mean? How can I resolve it?