1

我在 laravel 中使用“require anandsiddharth/laravel-paytm-wallet”包创建了 paytm 支付网关。我使用了以下演示商家详细信息:

YOUR_MERCHANT_ID=DIY12386817555501617

YOUR_MERCHANT_KEY=bKMfNxPPf_QdZppa

YOUR_WEBSITE=DIYtestingweb

YOUR_CHANNEL=WEB

YOUR_INDUSTRY_TYPE=Retail

下面是我的订单控制器:

<?php


namespace App\Http\Controllers;


use PaytmWallet;
use Illuminate\Http\Request;
use App\EventRegistration;


class OrderController extends Controller
{


    /**
     * Redirect the user to the Payment Gateway.
     *
     * @return Response
     */
    public function register()
    {
        return view('register');
    }


    /**
     * Redirect the user to the Payment Gateway.
     *
     * @return Response
     */
    public function order(Request $request)
    {


        $this->validate($request, [
            'name' => 'required',
            'mobile_no' => 'required',
            'email' => 'required',
        ]);


        $input = $request->all();
        $input['order_id'] = $request->mobile_no.rand(1,100);
        $input['fee'] = 50;


        EventRegistration::create($input);


        $payment = PaytmWallet::with('receive');
        $payment->prepare([
          'order' => $input['order_id'],
          'user' => 'your paytm user',
          'mobile_number' => 'your paytm number',
          'email' => 'your paytm email',
          'amount' => $input['fee'],
          'callback_url' => url('api/payment/status')
        ]);
        return $payment->receive();
    }


    /**
     * Obtain the payment information.
     *
     * @return Object
     */
    public function paymentCallback()
    {
        $transaction = PaytmWallet::with('receive');


        $response = $transaction->response();
        $order_id = $transaction->getOrderId();


        if($transaction->isSuccessful()){
          EventRegistration::where('order_id',$order_id)->update(['status'=>2, 'transaction_id'=>$transaction->getTransactionId()]);


          dd('Payment Successfully Paid.');
        }else if($transaction->isFailed()){
          EventRegistration::where('order_id',$order_id)->update(['status'=>1, 'transaction_id'=>$transaction->getTransactionId()]);
          dd('Payment Failed.');
        }
    }
}

但点击提交按钮后,是否显示“重定向到 paytm 商家页面,请稍候”,但我被带到一个空白页面,网址为http://localhost:8000/api/payment/status 我怎样才能获得商家页面当我点击提交按钮时?

4

0 回答 0