简体   繁体   English

此路由不支持 GET 方法。 支持的方法:POST on Flutterwave implementation with laravel

[英]The GET method is not supported for this route. Supported methods: POST on Flutterwave implementation with laravel

I am implementing Flutterwave implementation as found on Medium but I am getting the error:我正在实施Medium上的 Flutterwave 实施,但出现错误:

The GET method is not supported for this route.此路由不支持 GET 方法。 Supported methods: POST.支持的方法:POST。 http://localhost:8000/rave/callback?resp=%7B%22name%22%3A%22opop%22%2C%22data%22%3A%7B%22data%22%3A%7B%22responsecode%22%3A%2200%22%2C%22responsetoken%22%3Anull%2C%22responsemessage%22%3A%22successful%22%7D%2C%22tx%22%3A%7B%22id%22%3A2424493%2C%22txRef%22%3A%22rave_611fc5fe12df9%22%2C%22orderRef%22%3A%22URF_1629472286526_3670035%22%2C%22flwRef%22%3A%22FLW-MOCK-44b7ecdb3a2183c971db03d669dc1554%22%2C%22redirectUrl%22%3A%22http%3A%2F%2Flocalhost%3A8000%2Frave%2Fcallback%22%2C%22device_fingerprint%22%3A%22888b449800a5003eaf1eeea02d5d52db%22%2C%22settlement_token%22%3_ http://localhost:8000/rave/callback?resp=%7B%22name%22%3A%22opop%22%2C%22data%22%3A%7B%22data%22%3A%7B%22responsecode%22%3A %2200%22%2C%22responsetoken%22%3Anull%2C%22responsemessage%22%3A%22successful%22%7D%2C%22tx%22%3A%7B%22id%22%3A2424493%2C%22txRef%22%3A %22rave_611fc5fe12df9%22%2C%22orderRef%22%3A%22URF_1629472286526_3670035%22%2C%22flwRef%22%3A%22FLW-MOCK-44b7ecdb3a2183c971db03d669dc1554%22%2C%22redirectUrl%22%3A%22http%3A%2F%2Flocalhost%3A8000 %2Frave%2Fcallback%22%2C%22device_fingerprint%22%3A%22888b449800a5003eaf1eeea02d5d52db%22%2C%22settlement_token%22%3_

I am implementing Post routes as shown in:我正在实施 Post 路线,如下所示:

Route::post('/pay', 'RaveController@initialize')->name('pay');
Route::post('/rave/callback', 'RaveController@callback')->name('callback');

And on my controller, I've got:在我的 controller 上,我有:

public function initialize() {
    //This initializes payment and redirects to the payment gateway
    //The initialize method takes the parameter of the redirect URL
    Rave::initialize(route('callback'));
}

/**
 * Obtain Rave callback information
 * @return void
 */
public function callback() {
    $data = Rave::verifyTransaction(request()->txref);
    dd($data);  // view the data response
    if ($data->status == 'success') {
        //do something to your database
    } else {
        //return invalid payment
    }
}

Please can anyone help me solve this problem?请问谁能帮我解决这个问题? Especially since changing the route to get returns null. Thanks a whole lot!特别是自从更改路线以获取回报 null 以来。非常感谢!

I suppose Route::post('/rave/callback', 'RaveController@callback')->name('callback');我想Route::post('/rave/callback', 'RaveController@callback')->name('callback'); Is your problem.是你的问题。 It should be Route:: get应该是 Route:: get

Hi.你好。 I am sorry for editing this directly as I cant find the reply button.很抱歉直接编辑这个,因为我找不到回复按钮。 Route::get() returns null for this particular implementation. Route::get() 为这个特定的实现返回 null。

that's because of you are calling the route again here that is mean you will go to this direction with get method那是因为你在这里再次调用路由,这意味着你将使用 get 方法将 go 指向这个方向

public function initialize(){
 
  Rave::initialize(route('callback'));
}

the best solution to you you have to call this function without routing it as following最好的解决方案是您必须调用此 function 而无需按以下方式路由

public function initialize(Request $request){
      //here now you will not routing with get you will call the function inside it
      Rave::initialize($this->callback($request->all()));
    }
  /**
     * Obtain Rave callback information
     * @return void
     */public function callback($request){
  $data = Rave::verifyTransaction($request->txref);
  dd($data);  // view the data response
        if ($data->status == 'success') {
            
  //do something to your database
  }
  else {
  //return invalid payment
  }
  }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel: MethodNotAllowedHttpException: 此路由不支持 GET 方法。 支持的方法:POST - Laravel: MethodNotAllowedHttpException: The GET method is not supported for this route. Supported methods: POST Laravel - 此路由不支持 POST 方法。 支持的方法:GET、HEAD - Laravel - The POST method is not supported for this route. Supported methods: GET, HEAD 此路由不支持 GET 方法。 支持的方法:POST。 与 laravel - The GET method is not supported for this route. Supported methods: POST. with laravel Laravel 8:此路由不支持 GET 方法。 支持的方法:POST - Laravel 8: The GET method is not supported for this route. Supported methods: POST 此路由不支持 POST 方法。 支持的方法:GET、HEAD (LARAVEL) - POST method is not supported for this route. Supported methods: GET, HEAD (LARAVEL) 此路由不支持 GET 方法。 支持的方法:POST。 拉拉维尔 8 - The GET method is not supported for this route. Supported methods: POST. laravel 8 Laravel此路由不支持GET方法。 支持的方法:POST - Laravel The GET method is not supported for this route. Supported methods: POST Laravel 6:此路由不支持 GET 方法。 支持的方法:POST 错误 - Laravel 6: The GET method is not supported for this route. Supported methods: POST Error 此路由不支持 POST 方法。 支持的方法:GET、HEAD In Laravel - The POST method is not supported for this route. Supported methods: GET, HEAD In Laravel 此路由不支持 GET 方法。 支持的方法:POST Laravel 8 - The GET method is not supported for this route. Supported methods: POST Laravel 8
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM