将 flutterwavev3 集成到 laravel 8

问题描述 投票:0回答:3

我真的需要帮助,我尝试将 flutter 集成到 laravel 8 中,通过 composer 使用 php sdk 它显示了这个错误

  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.

我还尝试通过调用颤振波结束点来使用标准方法 但它说

{"status":"error","message":"没有找到这个id的交易","data":null}

看看我的文件 这是我单击按钮时的错误消息在此处输入代码按钮

我的表格

<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>

我的控制器检查控制器

 <?php

namespace App\Http\Controllers;
use App\Models\Category;
use Illuminate\Http\Request;
use Cart;
class CheckoutController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        
        $categories=Category::all();

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

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

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    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;
  
    }

}

php payment-gateway flutterwave
3个回答
1
投票

应该是 composer require flutterwavedev/flutterwave-v3


1
投票

你可以试试这个包:Laravel Flutterwave link

文档在这里


0
投票

在端点的 url 上使用 "" 双引号

不客气

© www.soinside.com 2019 - 2024. All rights reserved.