java - Paypal API Seamless checkout refreshed access token not working -
i integrating paypal's seamless checkout , i've managed create work have problem when access token expires (after 15 minutes). utilize refresh_token i'm provived login inquire new access token so:
map<string, string> configurationmap = new hashmap<string, string>(); map<string, string> configurationmap = new hashmap<string, string>(); configurationmap.put("clientid","xxxxxxx"); configurationmap.put("clientsecret", "yyyyyy"); configurationmap.put("service.endpoint", "https://api.sandbox.paypal.com"); configurationmap.put("mode", "sandbox"); apicontext apicontext = new apicontext(); apicontext.setconfigurationmap(configurationmap); createfromrefreshtokenparameters param = new createfromrefreshtokenparameters(); param.setgranttype("refresh_token"); param.setscope("openid"); // optional param.setclientid("xxxx"); // these not needed param.setclientsecret("yyyy"); // these not needed tokeninfo info = new tokeninfo(); // create token info object; setting refresh token info.setrefreshtoken(refreshtoken); info = info.createfromrefreshtoken(apicontext, param);
and obtain new, apparently correct, access token
{ "access_token": "a015vitdabshwd.dfewyfkdcbzdc.suqxkfubpnhazlpchg", "token_type": "bearer", "expires_in": 900 }
however, when create setexpresscheckout request using paypal nvp request this:
pwd=xxxxxx& signature=yyyyyy& user=zzzzzz& itemamt=123.00& cancelurl=https%3a%2f%2fwww.google.com& amt=123.00& desc=price& l_desc0=price& returnurl=http%3a%2f%2flocalhost%3a8080%2fpaypal%2fdopayment%3frateid%3d1901& l_amt0=123.00& identityaccesstoken=a015vitdabshwd.dfewyfkdcbzdc.suqxkfubpnhazlpchg& method=setexpresscheckout& l_qty0=1& currencycode=eur& version=106.0
i right express checkout token, paypal user session not kept , screen this. if log in can finish payment defeats purpose of seamless checkout. should able extend session 1 hr using refreshed access tokens.
note don't have problem when utilize first access token returned alongside refresh token , seamless checkout works fine during 15 minutes access token lasts.
java paypal
No comments:
Post a Comment