1
votes

I have the PayPal mobile SDK installed and in use on my iOS app. I process a single payment via the app and then pass on the post-sale PayPal confirmation dictionary to my server for confirmation (as instructed by PayPal)

However when I attempt to confirm the sale on the server I receive 'An internal service error has occurred'.

Here is the PayPal confirmation JSON:

"paypalConfirmation" : {
"response" : {
  "id" : "APAYPALSALECONFIRMATIONID",
  "state" : "approved",
  "create_time" : "2016-03-21T15:18:36Z",
  "intent" : "sale"
},
"client" : {
  "environment" : "mock",
  "product_name" : "PayPal iOS SDK",
  "paypal_sdk_version" : "2.14.0",
  "platform" : "iOS"
},
"response_type" : "payment"
}

This is the node.js code on my server:

//I am using the PayPal Node.js SDK
paypal.sale.get("APAYPALSALECONFIRMATIONID", function (error, sale) {


    if (error) {

        console.log(error);
        context.fail('There was an error confirming the payment');

    } else {


        console.log('Verifying sale...');
        compareSaleWithPost(order, sale, context); 


    }


});

Here is the error:

{ [Error: Response Status : 500]
response: 
 { name: 'INTERNAL_SERVICE_ERROR',
 message: 'An internal service error has occurred',
 information_link: 'https://developer.paypal.com/docs/a/#INTERNAL_SERVICE_ERROR',
 debug_id: '***********',
 httpStatusCode: 500 },
httpStatusCode: 500 }

I am aware that there are other questions regarding this error but they refer to credit card payments and issues with their numbers or negative testing settings.

I have negative testing turned off and this is for a PayPal account transaction not a credit card one. I am using SANDBOX mode

1
Perhaps it's indeed an internal error on their end, which will be resolved later? - Pekka
There is nothing mentioned on the paypal status page regarding sandbox being down. I'm leaning towards the error being on my side just not sure what - Zigglzworth

1 Answers

0
votes

It turns out I was using the wrong request. I should have been using paypal.payment.get instead of paypal.sale.get. Like so:

paypal.payment.get("APAYPALSALECONFIRMATIONID", function (error, payment) {


    if (error) {

        console.log(error);
        context.fail('There was an error confirming the payment');

    } else {


        console.log('Verifying payment...');
        compareSaleWithPost(order, payment, context); 


    }
}