未定义索引:Paytm 支付网关中的 TXN ID

Undefined index: TXNID in Paytm payment getway

这是控制器文件,我在我的控制器和路由中创建了两个函数 web.php 尝试 paytm 支付网关集成显示错误 - 未定义索引:Paytm 支付通道中的 TXNID? public函数支付(){

    $payment = PaytmWallet::with('receive');

    $payment->prepare([
      'order' => 25, // your order id staken from cart
      'user' => 'Cust_id_12', // your user id
      'mobile_number' => 7277407765, // your customer mobile no
      'email' => 'abx@gmail.com', // your user email address
      'amount' => 200.00, // amount will be paid in INR.
      'callback_url' => 'http://172.18.0.4:8006/payment/status' // callback URL
    ]);
    
    return $payment->receive();
}


/**
 * Obtain the payment information.
 *
 * @return Object
 */
public function paymentCallback()
{   
    $transaction = PaytmWallet::with('receive');
    // dd($transaction);
    $response = $transaction->response();
    // dd($response);
    // To get raw response as array
    //Check out response parameters sent by paytm here -> http://paywithpaytm.com/developer/paytm_api_doc?target=interpreting-response-sent-by-paytm
    
    if($transaction->isSuccessful()){

    }else if($transaction->isFailed()){
      //Transaction Failed
    }else if($transaction->isOpen()){
      //Transaction Open/Processing
    }
    $transaction->getResponseMessage(); //Get Response Message If Available
    //get important parameters via public methods
    $transaction->getOrderId(); // Get order id

    $transaction->getTransactionId(); // Get transaction id
}

可能是因为您再次向 paytm 发送相同的订单 ID,请尝试更改一些唯一的订单 ID 系列,这可能会对您有所帮助