Вопрос

I'm stuck and need someone to point me in the right direction.

Works great on localhost, but fails when I push to the test version of the site in our datacenter (with sandbox settings). I'm using the SDK Version 2.1.96 for c#. Any ideas?

Thanks

The endpoint is: https://api-3t.sandbox.paypal.com/2.0/

When I try to test on the datacenter server, I'm getting:

System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 
A connection attempt failed because the connected party did not properly respond after a period of time, 
or established connection failed because connected host has failed to respond 173.0.82.83:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, 
IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at PayPal.APIService.MakeRequestUsing(IAPICallPreHandler apiCallHandler)
   at PayPal.BasePayPalService.Call(IAPICallPreHandler apiCallHandler)
   at PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService.SetExpressCheckout(SetExpressCheckoutReq setExpressCheckoutReq, String apiUserName)
   at PayPalSetCheckoutModel.SetExpressCheckoutPP() in PayPal\PayPalCheckoutModel.cs:line 301

The pertinant related code is (straight from the sample in the SDK): // Invoke the API

SetExpressCheckoutReq wrapper = new SetExpressCheckoutReq();
wrapper.SetExpressCheckoutRequest = checkoutRequest;
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
SetExpressCheckoutResponseType setECResponse = service.SetExpressCheckout(wrapper);

The request to be sent (from my localhost) looks like:

<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"urn:ebay:api:PayPalAPI\" xmlns:ebl=\"urn:ebay:apis:eBLBaseComponents\" xmlns:cc=\"urn:ebay:apis:CoreComponentTypes\" xmlns:ed=\"urn:ebay:apis:EnhancedDataTypes\">
  <soapenv:Header>
    <ns:RequesterCredentials>
     <ebl:Credentials>
       <ebl:Username>sandboxseller_1358951631_biz_api1.domain.com</ebl:Username>
       <ebl:Password>0000000000</ebl:Password>
       <ebl:Signature>xxxx</ebl:Signature>
     </ebl:Credentials>
   </ns:RequesterCredentials>
 </soapenv:Header>
 <soapenv:Body>
   <ns:SetExpressCheckoutReq>
     <ns:SetExpressCheckoutRequest>
       <ebl:Version>94.0</ebl:Version>
        <ebl:SetExpressCheckoutRequestDetails>
          <ebl:ReturnURL>https://localhost/Checkout/PayPalComplete</ebl:ReturnURL>
          <ebl:CancelURL>https://localhost/Checkout/PayPalCancel</ebl:CancelURL>
          <ebl:ReqConfirmShipping>0</ebl:ReqConfirmShipping>
          <ebl:NoShipping>1</ebl:NoShipping>
          <ebl:AddressOverride>0</ebl:AddressOverride>
      <ebl:cpp-header-image>https://www.cloudfront.net/logo.jpg</ebl:cpp-header-image>
      <ebl:SolutionType>Sole</ebl:SolutionType>
      <ebl:BuyerEmail>mrbill@test.com</ebl:BuyerEmail>
      <ebl:AllowNote>0</ebl:AllowNote>
      <ebl:BrandName>Domain.com</ebl:BrandName>
      <ebl:PaymentDetails>
        <ebl:OrderTotal currencyID=\"USD\">27</ebl:OrderTotal>
        <ebl:ItemTotal currencyID=\"USD\">27</ebl:ItemTotal>
        <ebl:Custom>42289</ebl:Custom>
        <ebl:InvoiceID>100029</ebl:InvoiceID>
        <ebl:PaymentDetailsItem>
          <ebl:Name>Item Name</ebl:Name>
          <ebl:Amount currencyID=\"USD\">27</ebl:Amount>
          <ebl:ItemCategory>Digital</ebl:ItemCategory>
        </ebl:PaymentDetailsItem>
        <ebl:PaymentAction>Sale</ebl:PaymentAction>
      </ebl:PaymentDetails>
    </ebl:SetExpressCheckoutRequestDetails>
  </ns:SetExpressCheckoutRequest>
</ns:SetExpressCheckoutReq>

Это было полезно?

Решение

Looks like that could be a firewall issue.

I would check to see if you could view https://api-3t.sandbox.paypal.com/2.0/ in a browser from the datacenter machine and get the same output as you would from, say, your laptop. The next thing to check is whether port 443 is available as a route out of the datacenter machine.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top