[英]Klarna checkout returning http_status_code 500 Internal Server Error in response
我正在嘗試使用他們在這里提供的代碼實現klarna checkout 。
按照此鏈接的指示實施流程 - > https://docs.klarna.com/en/getting-started
我正在使用docs / examples文件夾中的代碼,我已經將庫(src文件夾)放在正確的路徑中,當我在這里創建一個測試帳戶時,已經提供了klarna提供的商店ID和共享密碼的eid和共享密鑰。
// Merchant ID
$eid = 'eid';
// Shared secret
$sharedSecret = 'sharedsecret';
我已經替換了所有文件中的所有eid和共享scret,並且還正確地更改了文件中的鏈接,
即example.com到mywebsiteurl.com
$create['purchase_country'] = 'SE';
$create['purchase_currency'] = 'SEK';
$create['locale'] = 'sv-se';
$create['merchant']['id'] = $eid;
$create['merchant']['terms_uri'] = 'http://example.com/terms.html';
$create['merchant']['checkout_uri'] = 'http://example.com/checkout.php';
$create['merchant']['confirmation_uri']
= 'http://example.com/confirmation.php' .
'?sid=123&klarna_order={checkout.order.uri}';
// You can not receive push notification on non publicly available uri
$create['merchant']['push_uri'] = 'http://example.com/push.php' .
'?sid=123&klarna_order={checkout.order.uri}';
正確設置所有內容后,當我單擊docs / examples / checkout.php時,我會拋出異常,因為服務器正在響應錯誤代碼。 BasicConnector.php通過下面給出的代碼拋出異常,
* Throw an exception if the server responds with an error code.
*
* @param Klarna_Checkout_HTTP_Response $result HTTP Response object
*
* @throws Klarna_Checkout_HTTP_Status_Exception
* @return void
*/
protected function verifyResponse(Klarna_Checkout_HTTP_Response $result)
{
// Error Status Code recieved. Throw an exception.
if ($result->getStatus() >= 400 && $result->getStatus() <= 599) {
throw new Klarna_Checkout_ConnectorException(
$result->getData(), $result->getStatus()
);
}
}
收到的錯誤是
致命錯誤:未捕獲的異常'Klarna_Checkout_ConnectorException',消息'{“http_status_code”:500,“http_status_message”:“內部服務器錯誤”,“internal_message”:“”}'在klarna / docs / examples / src / Klarna / Checkout / BasicConnector中.PHP:212
所以我的問題是這個,
我沒有發送正確的請求,因為我可以看到請求已創建且沒有給出錯誤?
我可以做任何事情來從服務器獲得正確的響應嗎?
在發出cURL請求時,服務器何時響應錯誤代碼?
感謝您的時間和幫助。 對此,我真的非常感激。
那么,這個大問題的解決方案非常簡單。
設置eid =“200”和sharedsecret =“test”。 哪些是測試帳戶憑據。
就我而言,我使用的是原始商家帳戶憑據。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.