Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code Error SCSX014

Here is the code I have used:

precode
var info = '"headers": [{"Authorization": "'+newauth+'", "Content-Type" : "application/json"}], "parameters": [{"payer_id": "'+pid+'"}]';

console.log(info);

execute = XHR.send('POST', 'https://api.sandbox.paypal.com/v1/payments/payment/' + ppid[0].paymentid + '/execute', info );/code/pre

And this is the trace:

pre
Script urv_paypalPayments: Error: {"message":"Invalid object: 'headers': [{'Authorization': 'Bearer A015Oy84mklsdrdcwRC07MpRcbuEZoLWY7tl4d7BmNj1G5Q', 'Content-Type' : 'application/json'}], 'parameters': [{'payer_id': 'BH7ZNU3NU7Z6W'}]","code":"SCXH218"} ( @ 8 : 45 ) - var innerResult = GlobalXHRInner.send(method, url, GlobalJSON.stri
/pre

It says its a invalid object, but I copied it from Paypal and json validated it ?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Server Code Error SCSX014

Hi Addy.

You have wrong "info" JS object.

Please use following code:

pre

var info = {
"headers": {"Authorization": newauth, "Content-Type" : "application/json"},

Code: Select all

 "parameters": {"payer_id": pid} 

};

console.log(info);

execute = XHR.send('POST', 'https://api.sandbox.paypal.com/v1/payments/payment/' + ppid[0].paymentid + '/execute', info );

/pre

Regards.

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code Error SCSX014

Thank you for that. I have now removed that error, but now i get a 401 error, here is the full error:

pre
{"body":"","headers":{"Content-Type":"application/json","Content-Length":"0","Date":"Tue, 01 Jul 2014 08:29:10 GMT","PROXY_SERVER_INFO":"host=slcsbjava3.slc.paypal.com;threadId=152362","Paypal-Debug-Id":"2662ffba91e72","Server":"Apache-Coyote/1.1"},"status":401}
/pre

I get no server code error and using console log, i can see all the variables are in in place, but the 401 is associated with the auth code ?

This is what is sent via the code:

prePOST https://api.sandbox.paypal.com/v1/payments/payment/PAY-9WR64408R3638134MKOYYRVY/execute { headers: { Authorization: 'Bearer A*y84mklsdrdcwpRcbuEZoLtl4d7BmNj1G5Q', 'Content-Type': 'application/json' }, parameters: { payer_id: 'BH7ZN***7Z6W' } }/pre

Seems okay to me ?

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code Error SCSX014

Any ideas ?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Server Code Error SCSX014

Hi Addy,

How and when did you get an Authorization value? It could be outdated at the time of sending the request...

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code Error SCSX014

It gets it about 15 - 30 seconds before

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Server Code Error SCSX014

Hi Addy.

In accordance with this document https://developer.paypal.com/docs/int...

you should send json parameters in request body.

So please try this code:

pre

var body = {"payer_id": pid};

var info = {
"headers": {"Authorization": newauth, "Content-Type" : "application/json"},
"body": JSON.stringify(body)
};
console.log(info);
execute = XHR.send('POST', 'https://api.sandbox.paypal.com/v1/payments/payment/' + ppid[0].paymentid + '/execute', info );

/pre

Regards.

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code Error SCSX014

Seems the server code takes too long and times out now... its like a never ending issue to get Paypal working... :(

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Server Code Error SCSX014

Looking at it, the script only runs for 400ms, and my plan has 2s, which is 2000ms, so why is it running out of time ?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Server Code Error SCSX014

Hello,

Sorry for delay, please share your script with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a, tell us its name and how should we correctly call it.

Return to “Issues”