Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

php - integrate flutterwavev3 into laravel 8

I really need help, I tried integrating flutter into laravel 8, using the php sdk via composer it shows me this error

  composer install flutterwavedev/flutterwave-v3

 Invalid argument flutterwavedev/flutterwave-v3. Use "composer require flutterwavedev/flutterwave-v3" 
     instead to add packages to your composer.json.        

    $ composer require flutterwavedev/flutterwave-v3
  Using version ^1.0 for flutterwavedev/flutterwave-v3
    ./composer.json has been updated
  Running composer update flutterwavedev/flutterwave-v3
    Loading composer repositories with package information
    Updating dependencies
     Your requirements could not be resolved to an installable set of packages.



 Problem 1
    - Root composer.json requires flutterwavedev/flutterwave-v3 ^1.0 -> satisfiable by 
  flutterwavedev/flutterwave-v3[1.0.0].
(lock file version) by a partial update and that version does not match. Make sure you list it as an 
 argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages 
currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I also tried using the standard method by making call to the flutter wave end point but it says

{"status":"error","message":"No transaction was found for this id","data":null}

look at my files this is the error message when i click my button enter code here the buttonenter image description here

my form

<form class="lg:mt-6 lg:w-84" action="{{route('checkout.store')}}" method="POST">
    {{csrf_field()}}
      <label for="name" class="block text-xs font-semibold text-gray-600 uppercase">Name</label>
          <input id="firstname"  value="{{auth()->user()->name}}"
          type="text" name="name" placeholder="Full Name"  class="block w-full p-3 mt-2 text-gray-700 bg-gray-200 appearance-none focus:outline-none focus:bg-gray-300 focus:shadow-inner"  />
      <label for="Phone" class="block text-xs font-semibold text-gray-600 uppercase">Phone</label>
          <input id="phone" type="text" name="name" placeholder="Full Name"  class="block w-full p-3 mt-2 text-gray-700 bg-gray-200 "  />
       <label for="email" class="block mt-2 text-xs font-semibold text-gray-600 uppercase">E-mail</label>
       <input id="email" type="email" name="email" placeholder="[email protected]" autocomplete="email" class="block w-full p-3 mt-2 text-gray-700 bg-gray-200" value="{{auth()->user()->email}}" readonly/>
       
       <label for="address" class="block mt-2 text-xs font-semibold text-gray-600 uppercase">Address</label>
      <input  type="text" name="name" placeholder="address"  class="block w-full p-3 mt-2 text-gray-700 bg-gray-200 " />
      
      <label for="State" class="block mt-2 text-xs font-semibold text-gray-600 uppercase">State</label>
      <input  placeholder="State"  class="block w-full p-3 mt-2 text-gray-700 bg-gray-200" />
       <label class="block mt-2 text-xs font-semibold text-gray-600 uppercase">City</label>
       <input  type="text" placeholder="City"  class="block w-full p-3 mt-2 text-gray-700 bg-gray-200 "  />
        
      <button type="submit"Name="pay"  class="w-full mt-6 font-medium text-blue-700 uppercase shadow-lg" >
        Save and continue
      </button> 
      
    </form>

my controller check out controller

 <?php

namespace AppHttpControllers;
use AppModelsCategory;
use IlluminateHttpRequest;
use Cart;
class CheckoutController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return IlluminateHttpResponse
     */
    public function index()
    {
        
        $categories=Category::all();

        return view('pages.checkout', [
            'categories'=>$categories]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return IlluminateHttpResponse
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  IlluminateHttpRequest  $request
     * @return IlluminateHttpResponse
     */
    public function store(Request $request)
    {
        $request= [
            'tx_ref' =>time(),
            'amount' => Cart::total(),
            'currency'=>'NGN',
            'redirect_url'=>route('thankyou'),
            'payments_options'=>'card',
            'customer'=>[
              'email'=> auth()->user()->email,
              'name'=> auth()->user()->name,
                     ],
            ' customizations,'=>[
          'title'=> "Remedy plus",
          'description'=> "Payment for items in cart",
          'logo' => asset('img/logo.png'),
            ],
            'meta'=>[
              'price'=> Cart::total(),
               'email'=> auth()->user()->email
            ],
          ];
  
          $curl = curl_init();
  
  curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.flutterwave.com/v3/transactions/123456/verify",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_POSTFIELDS => json_encode($request),
    CURLOPT_HTTPHEADER => array(
      "Content-Type: application/json",
      "Authorization: Bearer FLWSECK_TEST-1090b4e5393b92f0887e4ff3b7978a94-X"
    ),
  ));
  
  $response = curl_exec($curl);
  
  curl_close($curl);
 
  echo $response;
  
    }

}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...