title: Required parameter $path follows optional parameter $handlers paypal sdk
body: <p>I really need your help on this problem, since I don't understand how to fix it or where to start looking for an answer. Here's the  thing:</p>
  <p>I'm trying to integrate paypal into Laravel 8 with PHP 8. the package I'm using is the paypal/rest-api-sdk-php v1. I know this is deprecated but I have not found any other solution to get working the v2.</p>
  <p>Well, whenever I try to create a payment with the method $payment-&gt;create($this-&gt;api_context) -by the way, you can check the how-to guiide where I got those examples from below-the process gives me an error saying the following</p>
  <blockquote>
  <p><code>ErrorException Required parameter $path follows optional parameter $handlers</code></p>
  </blockquote>
  <p>I know this is because of an optional parameter being called before a required one. but honestly I've been working on this for weeks and I still can't figure it out.</p>
  <p>Here some evidence:
  error-screen: <a href="https://i.stack.imgur.com/swb1K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/swb1K.png" alt="enter image description here" /></a></p>
  <p>class PagoController (where all magic starts to fail)</p>
  <pre><code>class PagoController extends Controller
  </code></pre>
  <p>{
  private $api_context;</p>
  <pre><code>public function __construct(){
  
      $paypal_config = Config::get('paypal');
  
      $this-&gt;api_context = new ApiContext(
          new OAuthTokenCredential(
              $paypal_config['client_id'],
              $paypal_config['secret']
          )
      );
  
      $this-&gt;api_context-&gt;setConfig($paypal_config['settings']);
  
      //dd($this-&gt;api_context);
  }
  
  public function pagarConPaypal(Request $request, $id_conciliacion){
  
      //Obtener valores de la conciliación
      $registro_pago = Conciliacion::where('id_conciliacion', '=', $id_conciliacion)-&gt;first();
      //dd($registro_pago);
  
  //--Crea un nuevo pago
  
      $payer = new Payer();
      $payer-&gt;setPaymentMethod('paypal');
  
      $amount = new Amount();
      $amount-&gt;setTotal($registro_pago-&gt;monto);
      $amount-&gt;setCurrency('MXN');
  
      $transaction = new Transaction();
      $transaction-&gt;setAmount($amount);
      $transaction-&gt;setDescription($registro_pago-&gt;concepto);
  
      $callbackURL = url('/paypal/estado');
      $redirectUrls = new RedirectUrls();
      $redirectUrls-&gt;setReturnUrl($callbackURL)
          -&gt;setCancelUrl($callbackURL);
  
      $payment = new Payment();
      $payment-&gt;setIntent('Sale')
          -&gt;setPayer($payer)
          -&gt;setTransactions(array($transaction))
          -&gt;setRedirectUrls($redirectUrls);
  
      //dd($payment);
  
  //--Aplica el pago creado
      try {
          $payment-&gt;create($this-&gt;api_context, null);
          // echo $payment;
          return redirect()-&gt;away($payment-&gt;getApprovalLink());
      }
      catch (PayPalConnectionException $ex) {
          // This will print the detailed information on the exception.
          //REALLY HELPFUL FOR DEBUGGING
          echo $ex-&gt;getData();
      }
  </code></pre>
  <p>Any help will be very appreciated. Thanks in advance</p>