Losing ZF2 Session after Paypal redirection

2020-05-06 08:09发布

问题:

I have a serious problem with managing session in zf2 and PayPal payment. Once I get in the page of the payment, I lose the zf2 session. How to solve it?

$mySession = new Container('mySession');
$mySession->login = "name";
$mySession->droit=  "admin";

Thanks.

Update : the redirect page :

<?php
  session_start();
 extract($_GET);
if($action == "paypal")
  header("Location: ./paymentgetway.php?action=$action&invoiceId=$invoiceId&L_NAME0=$L_NAME0&L_AMT0=$L_AMT0&L_DESC0=$L_DESC0&L_QTY0=$L_QTY0");
?>

the payment page :

<?php
    session_start();
    require_once ("payment/paypal/paypalfunctions.php");
    extract($_GET);
    extract($_SESSION);
    switch ($action) {
        case "paypal":
            if (isset($L_NAME0) && isset($L_AMT0) && isset($L_DESC0) && isset($L_QTY0)) {
                include("payment/paypal/expresscheckout.php");
            } else {
                header("Location:index.php");
            }
            break;
        case "paymentcanceled":
            $file = "payment/paypal/paymentcanceled.php";
            break;
        case "paymentcompleted":
            if ($paymentapi == "paypal") {
                include("payment/saveTransactionDetails.php");
            }
            $file = "payment/paypal/paymentcompleted.php";
            break;
        case "paymentpending":
            $file = "payment/paypal/paymentpending.php";
            break;
        case "apierror":
            $file = "payment/paypal/apierror.php";
            break;
        default:
            header("Location: index.php");
    }
    ?>

    <!DOCTYPE html>
    <html lang="fr">      
        <body>  
            <div class="corps">
                <?php include($file); ?>   
            </div>
        </body>
    </html>

回答1:

the solution is to use the modul realised for zf2 which is speckPaypal , here is the tuto i followed to make it work :

http://phpcantho24h.blogspot.com/2014/04/paypal-express-checkout-creating-simple.html

Hope it helps.