Laravel付款回调无法在本地主机

时间:2016-11-09 10:59:13

标签: php laravel gateway

我对支付网关的概念非常陌生,特别是在Laravel。我正在以离线模式开发商店(localhost:8000)。虽然我已经声明了来自银行的回调链接,但回调是localhost/而不是localhost:8000。 以下是我的路线文件中的代码:web.php

Route::get('/buy',function(){
    try {

        $gateway = \Gateway::zarinpal();
        $gateway->setCallback(url('http://localhost:8000/PaymentSuccessfulController'));
        $gateway->price(1000)->ready(); //Rials
        $refId =  $gateway->refId();
        $transID = $gateway->transactionId();

        // Your code here

        return $gateway->redirect();

    } catch (Exception $e) {
        echo $e->getMessage();
    }
});

Route::any('PaymentSuccessfulController',function(){
    try {

        $gateway = \Gateway::verify();
        $trackingCode = $gateway->trackingCode();
        $refId = $gateway->refId();
        $cardNumber = $gateway->cardNumber();

        // Your code here
        echo 'Card Number: ' . $cardNumber . '<br />';
        echo 'Tracking Code: ' . $trackingCode . '<br />';

        }
         catch (RetryException $e)
        {
            echo $e->getMessage();
        }
         catch (PortNotFoundException $e) 
        {
            echo $e->getMessage();
        }
         catch (InvalidRequestException $e)
        {
            echo $e->getMessage();
        }
         catch (NotFoundTransactionException $e)
        {
            echo $e->getMessage();
        }
         catch (Exception $e) 
        {
            echo $e->getMessage();
        }
});

交易成功完成,但当它们完成并且浏览器重定向到它应该的位置时,我会收到404 Not Found,地址栏值将是:

  

http://localhost/PaymentSuccessfulController?transaction_id=xxxxxxxxx

是否可以从localhost成功进行银行交易?如果是这样,我怎么可能解决这个问题呢?

0 个答案:

没有答案
相关问题