PayPal error 580001 HTTP Request from iOS -
having difficulties in implementing adaptive payments in ios , unfortunately there little documentation on paypal's website or response. code:
- (void)makepaymentsandbox{ nserror *error; //nsurlsessionconfiguration *configuration = [nsurlsessionconfiguration defaultsessionconfiguration]; //nsurlsession *session = [nsurlsession sessionwithconfiguration:configuration delegate:self delegatequeue:nil]; nsurl *url = [nsurl urlwithstring:@"https://svcs.sandbox.paypal.com/adaptivepayments/pay"]; nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:url cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:30.0]; //setting [request sethttpmethod:@"post"]; //headers [request addvalue:@"alex.rietmann-facilitator_api1.fastwebnet.it" forhttpheaderfield:@"x-paypal-security-userid"]; [request addvalue:@"fw79ezxpfp69ne8x" forhttpheaderfield:@"x-paypal-security-password"]; [request addvalue:@"absua9nnv9nnkon4mwvt15ydgetajhcyzqohjklbum-bgroi7wrs" forhttpheaderfield:@"x-paypal-security-signature"]; //nv [request addvalue:@"json" forhttpheaderfield:@"x-paypal-request-data-format"]; [request addvalue:@"json" forhttpheaderfield:@"x-paypal-response-data-format"]; [request addvalue:@"app-80w284485p519543t" forhttpheaderfield:@"x-paypal-application-id"]; [request addvalue:@"application/json" forhttpheaderfield:@"content-type"]; [request addvalue:@"en_us" forhttpheaderfield:@"accept-language"]; //data /*nsstring *userupdate =[nsstring stringwithformat:@"clientdetails.applicationid=%@&actiontype=%@",@"app-80w284485p519543t", @"pay",nil]; nsdata *data1 = [userupdate datausingencoding:nsutf8stringencoding]; [request sethttpbody:data1]; [request setvalue: [nsstring stringwithformat:@"%lu", (unsigned long)[data1 length]] forhttpheaderfield:@"content-length"];*/ nsdictionary *mapdata = [[nsdictionary alloc] initwithobjectsandkeys: @"pay", @"actiontype", @"usd", @"currencycode", @"http:\\www.cleverlyapp.com", @"cancelurl", @"http:\\www.cleverlyapp.com", @"returnurl", @"returnall", @"requestenvelope.detaillevel", @"en_us", @"requestenvelope.errorlanguage", @"seneder@email.com", @"senderemail", @"0.1", @"receiverlist.receiver(0).amount", @"a-buyer@fastwebnet.it", @"receiverlist.receiver(0).email", @"0.1", @"receiverlist.receiver(1).amount", @"a-facilitator@fastwebnet.it", @"receiverlist.receiver(1).email", @"app-80w284485p519543t", @"clientdetails.applicationid", nil]; nsdata *postdata = [nsjsonserialization datawithjsonobject:mapdata options:0 error:&error]; [request sethttpbody:postdata]; [nsurlconnection connectionwithrequest:request delegate:self]; }
here's response:
string: { error = ( { category = application; domain = platform; errorid = 580001; message = "invalid request: {0}"; severity = error; subdomain = application; } ); responseenvelope = { ack = failure; build = 17325060; correlationid = e82ede718b929; timestamp = "2015-07-14t09:50:06.222-07:00"; }; }
check these please:
some have encoding, set json
, actualy sent url
-encoded, etc, others have currency , currency format used (e.g values sent should not include currency sign etc..)
Comments
Post a Comment