php - 无法从laravel 4中的paypal express checkout获取会话数据

php - 无法从laravel 4中的paypal express checkout获取会话数据,第1张

在快速结账后快速结账退回后,我无法在omnipay laravel 4中获取会话信息。

我确实让Tokens和PayerID注意到了其他问题。该网站的会话数据变空。

请告诉我如何完成购买流程。有没有办法从paypal获取采购订单ID。我正在使用omnipay。

public function doSaveAndProcessedToPayPal( $purchaseOrder)
    {

        $purchaseOrderId =  $purchaseOrder->id;

        Session::put('currentUserEmail', $email);
        Session::put('purchaseOrderId', $purchaseOrderId);
        Session::put('amount', $amount);


        $gateway = $this->getPayPalGateway();

        $items = new Omnipay\Common\ItemBag();

        $items->add(array(
            'name' => $productName,
            'quantity' => '1',
            'price' => (float)$amount,
        ));

        $response = $gateway->purchase(
            array(
                'cancelUrl' => CANCEL_URL,
                'returnUrl' => RETURN_URL,
                'amount' =>  (float)$amount,
                'currency' => $currency
            )
        )->setItems($items)->send();

        $response->redirect();
    }

    public function doPerformPostPaymentOperation()
    {


        $gateway = $this->getPayPalGateway();

        $purchaseOrderId = Session::get('purchaseOrderId');
        $amount = Session::get('amount');
        $currency = Session::get('currency');

        $data = Session::all();
        echo "<pre>";
        print_r( $data );
        echo "</pre>";
        echo $purchaseOrderId;
        die();

        $response = $gateway->completePurchase(array(
            'transactionId' => "ORD-".$purchaseOrderId,
            'transactionReference' => "REF-".$purchaseOrderId,
            'amount' => (float)$amount,
            'currency' => $currency,
        ))->send();

        if ( ! $response->isSuccessful())
        {
            throw new Exception($response->getMessage());
        }
    }


Output
Array
(
    [_token] => lnvG1S3eU2JsHJSciOTjixEEHiSwZVX47daRLDXE
    [flash] => Array
        (
            [old] => Array
                (
                )

            [new] => Array
                (
                )

        )

)

最佳答案:

0 个答案:

没有答案
本文经用户投稿或网站收集转载,如有侵权请联系本站。

发表评论

0条回复