dongqiao6730 2013-12-16 16:03
浏览 43

Sagepay服务器集成(NextURL问题)

I have to integrate Sagepay iframe payment system to a Prestashop eCommerce.

First of all, i'm doing all the code outside of Prestashop files to work cleanly and integrate the code without any trouble.

I create a Form with all the params that Sagepay need and I recieve. The action of that form was pointed to "Server Sagepay web". I loaded its POST returned value on a "target" iframe and i read the NextURL param.

But I can't load $nextURL param into "src" of the iframe because i don't reload or move into another page.

The solutions i tried are "cUrl" connection, Ajax connections but i don't know if i'm going right in that way...

If someone could help me explaining how to load nextURL on src attr of iframe or explain his solution/example it will help me a lot!

this is my form structure:

<form action="credit-cards.php" method="POST" id="SagePayForm" name="SagePayForm">
    <input type="hidden" name="VPSProtocol" value="2.23" />
    <input type="hidden" name="TxType" value="PAYMENT" />
<input type="hidden" name="Vendor" value="<?= $Vendor ?>" />
<input type="hidden" name="VendorTxCode" value="<?= $VendorTxCode ?>" />
<input type="hidden" name="Currency" value="EUR" />
<input type="hidden" name="Amount" value="<?= $Amount ?>" />
<input type="hidden" name="NotificationURL" value="<?= $SuccessURL ?>" />
<input type="hidden" name="Description" value="<?= $Description ?>" />
<input type="hidden" name="BillingSurname" value="<?= $BillingSurname ?>" />
<input type="hidden" name="BillingFirstnames" value="<?= $BillingFirstnames ?>" />
<input type="hidden" name="BillingAddress1" value="<?= $BillingAddress1 ?>" />
<input type="hidden" name="BillingCity" value="<?= $BillingCity ?>" />
<input type="hidden" name="BillingPostCode" value="<?= $BillingPostCode ?>" />
<input type="hidden" name="BillingCountry" value="<?= $BillingCountry ?>" />
<input type="hidden" name="DeliverySurname" value="<?= $BillingSurname ?>" />
<input type="hidden" name="DeliveryFirstnames" value="<?= $BillingFirstnames ?>" />
<input type="hidden" name="DeliveryAddress1" value="<?= $BillingAddress1 ?>" />
<input type="hidden" name="DeliveryCity" value="<?= $BillingCity ?>" />
<input type="hidden" name="DeliveryPostCode" value="<?= $BillingPostCode ?>" />
<input type="hidden" name="DeliveryCountry" value="<?= $BillingCountry ?>" />
<input type="hidden" name="Crypt" value="<?= $PAYMENT_CRYPT ?>" />    
<input type="image" src="images/buynow-sagepay.png" />
<input type="submit" value="PAGAR" />
</form>

and this is my "credit-cards.php":

<?php
if(isset($_POST)){$data = $_POST;}

$url = curl_init("http://test.sagepay.com/gateway/service/vspserver-register.vsp");

$curlSession = curl_init();        
curl_setopt ($curlSession, CURLOPT_URL, $url);
curl_setopt ($curlSession, CURLOPT_HEADER, 0);
curl_setopt ($curlSession, CURLOPT_POST, 1);
curl_setopt ($curlSession, CURLOPT_POSTFIELDS, $data);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curlSession, CURLOPT_TIMEOUT, 30);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 2);        
$result = explode(chr(10), curl_exec($curlSession));
?>

<html>
    <head>
    </head>
    <body>
        <br/>Escoje método de pago: <br/>
        <iframe src="<?= $_POST['NextURL'] ?>" id="sageFrame" style="width:100%;height:500px;border:none"></iframe>
    </body>
</html>
  • 写回答

2条回答 默认 最新

  • dongshi2836 2014-01-07 11:39
    关注

    I finally use explode() in $result and I "cooked" my $nextURL correctly.

    doing this, the iframe charges what i needed.

    Thank you

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号