paypal - Sandbox server access denied in Java app (works fine with cURL) -
i'm attempting simple pay call using adaptive payments api. receiving following exception:
java.security.accesscontrolexception: access denied (java.net.socketpermission svcs.sandbox.paypal.com resolve)
here's bit of java code give idea of i'm doing.
httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("https://svcs.sandbox.paypal.com/adaptivepayments/pay"); httppost.setheader("x-paypal-security-userid", user_id); httppost.setheader("x-paypal-security-password", password); httppost.setheader("x-paypal-security-signature", signature); httppost.setheader("x-paypal-application-id", application_id); httppost.setheader("x-paypal-request-data-format", "json"); httppost.setheader("x-paypal-response-data-format", "json"); /* bunch of stuff build json , put in entity */ httppost.setentity(entity); httpresponse httpresponse = httpclient.execute(httppost);
this throws exception. when try suggested curl command though, works fine:
curl -s --insecure -h "x-paypal-security-userid: my_userid" -h "x-paypal-security-password: my_password" -h "x-paypal-security-signature: my_signature" -h "x-paypal-request-data-format: json" -h "x-paypal-response-data-format: json" -h "x-paypal-application-id: app-80w284485p519543t" https://svcs.sandbox.paypal.com/adaptivepayments/pay -d "{\"actiontype\":\"pay\", \"currencycode\":\"usd\", \"receiverlist\":{\"receiver\":[{\"amount\":\"1.00\",\"email\":\"rec1_1312486368_biz@gmail.com\"}]}, \"returnurl\":\"http://www.example.com/success.html\", \"cancelurl\":\"http://www.example.com/failure.html\", \"requestenvelope\":{\"errorlanguage\":\"en_us\", \"detaillevel\":\"returnall\"}}" {"responseenvelope":{"timestamp":"2013-08-07t13:00:11.846-07:00","ack":"success","correlationid":"0f33d4304a29b","build":"6941298"},"paykey":"ap-5ga81571bx790024k","paymentexecstatus":"created"}
any ideas why i'm receiving exception?
google has controversially blocked paypal. new system called paypalx acts paypal api, , has been released 2 years after block. can read more on this post , links. namely, requires less url manipulation, instead using higher-level actions regarding transaction.
Comments
Post a Comment