Apple pay error "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host"

Hi, I have been trying to integrate Apple Pay in my MVC Web Application. But while generating the token by calling apple's API I am geeting an error "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." Currently I am integrating it in Sandbox environment.



The apple certificate generated for merchantID doesnot contain any keys in it. Is it causing the issue or there is some other cause? Kindly help. Thanks in advance.

Have you solve the issue? i vave the same problem now.
Is there any more information or logs you can provide to help me instruct further here?

The apple certificate generated for merchantID doesnot contain any keys in it.

This sounds like you are wanting to sign the client authentication request and are not able to because you have a Merchant Certificate only instead of a Merchant Identity (Certificate and Key).


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
We are also getting this issue when trying to test integration in our ASP.NET MVC project.

We have generated our certificate and verified the merchant domain and get the Merchant Identifier back from the certificate ok but when making the request to https://apple-pay-gateway-cert.apple.com/paymentservices/startSession we get this error:

"An existing connection was forcibly closed by the remote host" or "The request was aborted: Could not create SSL/TLS secure channel."

Do Apple not have any working examples of successfully integrating with Apple Pay from an ASP.Net website? The only thing I can find is from third parties such as Just Eat.
Regarding:

"An existing connection was forcibly closed by the remote host" or "The request was aborted: Could not create SSL/TLS secure channel."

This typically indicates either an issue with the the initial TLS handshake between your .NET server and the Apple Pay server, or the client authentication response (the two-way TLS) side of the handshake. To determine this, I would make your server side logs as verbose as possible and checkout which part of the handshake is being shut down by the remote.

As an aside; this is typically an issue with communication on the client authentication (two-way TLS) side. This can be due to your servers not using the Merchant Identity Certificates correctly, or having it be malformed.

Do Apple not have any working examples of successfully integrating with Apple Pay from an ASP.Net website?

Due to the vast amount of different server side combinations out there we have an example of the client side, via Apple Pay on the Web Demo, and document Requesting an Apple Pay Payment Session.


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Matt's answer sounds good. But it doesn't help. I went throw required steps, prepared merchant Id, merchant identity cert and so on but it doesn't work. I have an application where Apple Pay works fine. I use it's code to prepare the second application, but it doesn' work with new merchant Id data. I get "Could not create SSL/TLS secure channel."

@daniil-evsienko In this case if you increase the verbosity of your server logs, what does it tell you? You could even go as far as to take a packet trace to see where exactly the handshake breaks down. Somewhere the handshake is failing, you just need to find out exactly where this is through one of these debugging techniques.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Apple pay error "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host"
 
 
Q