2014-02-08 58 views
0

我需要將sagepay底框方法集成到我的項目中。我可以將sagepay表單抓到我的頁面。雖然我不知道我在哪裏設置了返回網址。所以有顯示錯誤,如爲sagepay設置ReturnURL

HTTP Status Code:500, 
HTTP Status Message:The request was unsuccessful due to an unexpected condition encountered by the server 
Error Code:5006, 
Error Description:Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL. 

這是我的代碼。我在哪裏可以在這個代碼中設置returnurl?

if($_POST['submit']=="submit") 
{ 
//Test authorize url 
//$url="https://live.sagepay.com/gateway/service/authorise.vsp"; 

//Test purchase url 
$url = 'https://test.sagepay.com/gateway/service/vspserver-register.vsp'; 
//Live 
//$url = 'https://live.sagepay.com/gateway/service/vspserver-register.vsp'; 
$params = array(); 
    $params['VPSProtocol'] = '2.23'; 
    $params['TxType'] = 'PAYMENT'; 
    $params['Vendor'] = 'vendorname'; 
    $params['VendorTxCode'] = 'Txn-ab34qcd1'; 
    $params['Currency'] = 'GBP'; 
    $params['Amount'] = 50; 
    $params['description'] = 'hello test'; 
    $params['NotificationURL'] = 'http://exapmle.co.uk/payment-return.php'; 
    $params['BillingSurname'] = 'Bobby'; 
    $params['BillingFirstnames'] = 'Bobbysfsf'; 
    $params['BillingAddress1'] = '14 Tottenham Court Road'; 
    $params['BillingCity'] = 'London'; 
    $params['BillingPostCode'] = 'W1T 1JY'; 
    $params['BillingCountry'] = 'GB'; 
    $params['billingPhone'] = '555 123-4567'; 
    $params['DeliverySurname'] = '123 Shipping St'; 
    $params['DeliveryFirstnames'] = 'Shipsville'; 
    $params['DeliveryAddress1'] = 'London'; 
    $params['DeliveryCity'] = 'London'; 
    $params['DeliveryPostCode'] = '54321'; 
    $params['DeliveryCountry'] = 'GB'; 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_HEADER, 0); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params)); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, $curlTimeout); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
$response = explode(chr(10), curl_exec($ch)); 
echo "<pre>"; 
print_r($response); 
echo "</pre>"; 

echo $posturl = $response[5]; 

$posturlex=explode("L=",$posturl); 
print_r($posturlex); 
$nexturl = $posturlex[1]; 
} 
?> 

<html> 
    <head> 
    </head> 
    <body> 
     <iframe src="<?=$nexturl?>" id="sageFrame" style="width:100%;height:500px;border:none"></iframe> 
    </body> 
</html> 

回答

0

的承認的redirectUrl通過您NotificationURL賢者收費反應時提供。

Sage Pay Server期待「Status =」成爲響應中的第一個字符。如果您之前有任何HTML,註釋或標題代碼,請將其刪除,否則Sage Pay Server會將響應視爲錯誤並使交易失敗。

您是否在您的確認中將以下內容發送至您的通知網址的Sage Pays帖子,您是否瞭解了這一點?狀態=,RedirectURL =,StatusDetail =

+0

現在我得到了良好的流動與您的答案..測試環境工作正常...現在我的問題是現場環境...只有顯示付款信息,沒有卡選擇選項該頁面將客戶信息發送到sagepay.if您可以請參閱此圖像http://www.sendspace.com/file/2dyt7p。我該如何解決這個問題...? – kalyan

+0

如果您的TEST賬戶上的商戶號碼是Ecom和MOTO(郵購電話訂單),但您的LIVE賬戶中的MID僅爲MOTO,您將收到錯誤信息,確認通過您的網站不可用的卡類型。如果想處理電子商務交易,請聯繫Sage Pay支持部門0845 111 44​​55,以便向供應商帳戶添加電子商務商家編號。 –

+0

嗨@kalyan&sage支付支持我無法完全理解notificationURL的概念。它是否包含另一組代碼,並設置了重定向規則? –