vendredi 22 septembre 2023

The POST method is not supported for this route Laravel

Payment success redirect working but if the payment has been cancelled, it does not redirect. How can i fix this? Payment success redirect working but if the payment has been cancelled, it does not redirect. How can i fix this? Error: The POST method is not supported for this route. Supported methods: GET, HEAD. Error İmage: enter image description here

Paymax:

else if($payment_method == "paymax"){
        $sid = 1;

        $settings = Settings::editGeneral($sid);

        $paymaxHelper = new Paymax(
                                    $settings->paymax_username,
                                    $settings->paymax_password,
                                    $settings->paymax_shopcode,
                                    $settings->paymax_hash
                                );

        $site_currency = ( $site_currency == "USD" ? "USD" : $site_currency);
        $order_data = array(
            'productName' => $item_names_data,
            'productData' => array(
                array(
                    'productName'=>$item_names_data,
                    'productPrice'=>$final_amount,
                    'productType'=>'DIJITAL_URUN',
                ),
            ),
            'productType' => 'DIJITAL_URUN',
            'productsTotalPrice' => $final_amount,
            'orderPrice' => $final_amount,
            'currency' => $site_currency,
            'orderId' => $purchase_token,
            'locale' => 'tr',
            'conversationId' => '',
            'buyerName' => $order_firstname,
            'buyerSurName' => $order_firstname,
            'buyerGsmNo' => '05xxXXXxxXX',
            'buyerIp' => $_SERVER['REMOTE_ADDR'],
            'buyerMail' => $order_email,
            'buyerAdress' => '',
            'buyerCountry' => '',
            'buyerCity' => '',
            'buyerDistrict' => '',
            'callbackOkUrl' => $website_url.'/paymax-success/'.$purchase_token,
            'callbackFailUrl' => $website_url.'/paymax-failure/'.$purchase_token
        );
        /*Sipariş Bilgilerinizi link oluşturmak için sınıfa gönderin*/
        $request = $paymaxHelper->create_payment_link($order_data);
                                
        if($request['status']=='success' && isset($request['payment_page_url']))
        {
            $odeme_link = $request['payment_page_url'];
            return redirect($odeme_link);
        }
        
      

   return view('deposit')->with($totaldata);


}

    public function paymax_callback(Request $request){
    $ord_token = $request->orderId;
        
    $itemOrder = DB::table('item_order')->where('purchase_token', $ord_token)->first();
    if($itemOrder){
        $response = $this->paymax_order_success($ord_token, $request);
    }else{
        $response = $this->deposit_paymax_success($ord_token, $request);
    }
    if($response["status"]){
        echo 'OK';
        exit();
    }
    echo $response["message"];
    exit();
}

Failure:

    public function paymax_failure($ord_token, Request $request){
    return view('cancel');
}

Routes:

Route::get('/paymax-success/{ord_token}', ['as' => 'paymax-success','uses'=>'ItemController@paymax_success']);

Route::get('/paymax-failure/{ord_token}', ['as' => 'paymax-failure','uses'=>'ItemController@paymax_failure']);

Route::post('/paymax-callback', ['as' => 'paymax-callback','uses'=>'ItemController@paymax_callback']);


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire