title: Object of class Illuminate\Routing\Redirector could not be converted to string. srmklive/laravel-paypal
body: <p>I am currently working on a paypal checkout using paypal and <a href="https://github.com/srmklive/laravel-paypal" rel="nofollow noreferrer">https://github.com/srmklive/laravel-paypal</a>. I'm using the express checkout which I modified it a little bit to fit the requirements of the my project. During testing it is working in a couple of tries, paypal show and payment executes properly but when I tried to run the exact same code. I get this error I don't know what it means.    </p>
  
  <p>I tried to check my routes if it all of the errors happens to my routes but all of it are working properly. I also tried dump and die like dd("check") just to check if its really going to my controller and it does. I did this in the method "payCommission" (this where the I think the error happens) </p>
  
  <p>This is my route for the controller</p>
  
  <h1>api.php</h1>
  
  <pre class="lang-php prettyprint-override"><code>Route::get('service/commissionfee/payment' , 'api\service\ExpressPaymentController@payCommission');
  
  Route::get('paypal/ec-checkout-success', 'api\service\ExpressPaymentController@payCommissionSuccess');
  </code></pre>
  
  <h1>ExpressPaymentController.php</h1>
  
  <pre class="lang-php prettyprint-override"><code>
  &lt;?php
  
  namespace App\Http\Controllers\api\service;
  
  use Illuminate\Http\Request;
  use App\Http\Controllers\Controller;
  use Srmklive\PayPal\Services\ExpressCheckout;
  
  class ExpressPaymentController extends Controller
  {
      protected $provider;
  
      public function __construct()
      {
          try {
              $this-&gt;provider = new ExpressCheckout();
          }
          catch(\Exception $e){
              dd($e);
          }
  
      }
  
  
      public function payCommission(Request $request)
      {
  
  
  
              $recurring = false;
              $cart = $this-&gt;getCheckoutData($recurring);
  
              try {
                  $response = $this-&gt;provider-&gt;setExpressCheckout($cart, $recurring);
  
                  return redirect($response['paypal_link']);
  
              } catch (\Exception $e) {
  
                  dd($e);
                  return response()-&gt;json(['code' =&gt; 'danger', 'message' =&gt; "Error processing PayPal payment"]);
              }
  
      }
  
      public function payCommissionSuccess(Request $request)
      {
  
          $recurring = false;
  
          $token = $request-&gt;get('token');
          $PayerID = $request-&gt;get('PayerID');
  
          $cart = $this-&gt;getCheckoutData($recurring);
  
          // ? Verify Express Checkout Token
          $response = $this-&gt;provider-&gt;getExpressCheckoutDetails($token);
  
          if (in_array(strtoupper($response['ACK']), ['SUCCESS', 'SUCCESSWITHWARNING'])) {
              if ($recurring === true) {
                  $response = $this-&gt;provider-&gt;createMonthlySubscription($response['TOKEN'], 9.99, $cart['subscription_desc']);
                  if (!empty($response['PROFILESTATUS']) &amp;&amp; in_array($response['PROFILESTATUS'], ['ActiveProfile', 'PendingProfile'])) {
                      $status = 'Processed';
                  } else {
                      $status = 'Invalid';
                  }
              } else {
                  // ? Perform transaction on PayPal
                  $payment_status = $this-&gt;provider-&gt;doExpressCheckoutPayment($cart, $token, $PayerID);
                  $status = $payment_status['PAYMENTINFO_0_PAYMENTSTATUS'];
              }
  
              return response()-&gt;json(['success' =&gt; "payment complete"]);
          }
      }
  
      private function getCheckoutData($recurring = false)
      {
          $data = [];
  
          $order_id = 1;
  
              $data['items'] = [
                  [
                      'name'  =&gt; 'Product 1',
                      'price' =&gt; 9.99,
                      'qty'   =&gt; 1,
                  ],
  
              ];
  
              $data['return_url'] = url('api/paypal/ec-checkout-success');
  
  
  
          // ! 
  
          $data['invoice_id'] = config('paypal.invoice_prefix').'_'.$order_id;
          $data['invoice_description'] = "Commission Fee payment";
          $data['cancel_url'] = url('/');
  
          $total = 0;
          foreach ($data['items'] as $item) {
              $total += $item['price'] * $item['qty'];
          }
  
          $data['total'] = $total;
  
          return $data;
      }
  }
  
  
  </code></pre>
  
  <p>Error I am getting</p>
  
  <pre class="lang-php prettyprint-override"><code>Object of class Illuminate\Routing\Redirector could not be converted to string
  </code></pre>
  
  <p>Thank you in advance</p>