2016-03-21 59 views
1

我已經安裝了PayPal移動SDK並在我的iOS應用程序中使用。 我處理通過應用單付款,然後在售後的PayPal確認字典傳遞到我的服務器進行確認(通過PayPal作爲指示)PayPal REST API - '發生了內部服務錯誤'

然而,當我試圖確認服務器上出售我收到「發生內部服務錯誤'。

這裏是貝寶確認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" 
} 

這是我的服務器上的node.js代碼:

//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); 


    } 


}); 

以下是錯誤:

{ [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 } 

我知道有關於此錯誤的其他問題,但它們指的是信用卡付款及其數量或負面測試設置的問題。

我有負面測試關閉,這是一個PayPal帳戶交易不是信用卡一。我正在使用SANDBOX模式

+0

也許這確實是一個內部錯誤,他們的結局,這將在稍後解決? –

+1

在貝寶狀態頁面上沒有提到有關沙箱被關閉的信息。我傾向於在我身邊的錯誤只是不知道什麼 – Zigglzworth

回答

0

原來我使用了錯誤的請求。我應該使用paypal.payment.get而不是paypal.sale.get。像這樣:

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); 


    } 
} 
相關問題