The Flutterwave Developer Documentation

We have put together comprehensive guidelines and documentation to help you get right into integrating any of our products quickly. You can also get support when you need help!

API Documentation    API Reference


Ask A Question

Implementing flutter in laravel

Hi, I'm trying to implement this "" api in laravel. what i want is to send some data to this api and get a url in response so I can send that url back to the ajax request on client side. client side opens that url in a new tab and pays whatever amount was set in controller now how can i implement that. This is my code so far. ``` $amount = some amount; $referenceno = some ref number; $currency = "NGN"; $redirect_url = some url; $authorization = 'Bearer'." ".$this->fsk; $data = [ 'amount' => $amount, 'email' => email, 'metadata' => json_encode($array = [ 'contest_id'=>contest_id , 'contestent_id'=>contestant_id, 'no_of_votes'=>no_of_votes ]), 'reference' => $referenceno, ]; $client = new \GuzzleHttp\Client(); $url = ""; $request = $client->post($url, [ 'headers' => [ 'Content-Type' => 'application/json', 'Authorization' => $authorization, ], 'form_params' => [ 'public_key'=>$this->fpk, "tx_ref"=>$referenceno, "amount"=>$amount, "currency"=>$currency, "redirect_url"=>$redirect_url, 'customer'=>[ 'email' => email, 'phone_number'=>some number, 'name'=>'voter', ], "meta"=>$data, 'customizations' =>[ 'title' => title, 'description' => 'Pay to vote', ] ] ]); $response = $request->send(); dd($response); ``` this returns me the error ``` Server error: `POST` resulted in a `500 Internal Server Error` response:↵{"error_id":"ERRNO738287451T1607106126413","message":"Application error. Please contact support","code":"app_error"}↵" ``` which is not very helpful so if someone can guide me. also i dont want to send payment method so customer can just chose one from payment page.

Posted by Tallal Jamshed 6 months ago