0

I'm using the srmklive/laravel-paypal v.3 package ( https://github.com/srmklive/laravel-paypal that does not have documentation) in a laravel project. when i press a button the controller process this code:

public function payment()
{
    $provider = new PayPalClient;

    // Through facade. No need to import namespaces
    $provider = PayPal::setProvider();
    $provider->setCurrency('EUR');
    $provider->createOrder([
        "intent"=> "CAPTURE",
        "purchase_units"=> [
            "amount"=> [
              "currency_code"=> "EUR",
              "value"=> "100.00"
            ]
        ]
    ]);
}

But i have this error: Trying to access array offset on value of type null

Relative to this portion of code

$this->apiUrl = collect([$this->config['api_url'], $this->apiEndPoint])->implode('/');

of class srmklive\paypal\src\Traits\PayPalAPI\Orders.php:21

Someone can help me and show how to use this package?

Kobazzo
  • 564
  • 1
  • 7
  • 20
  • 1
    It would seem $this->config is null, perhaps (maybe the value of what the api_url or the apiEndPoint are set to is null) – Preston PHX Mar 12 '21 at 22:07
  • tnx but why? The class srmklive\paypal\src\Traits\PayPalAPI\Orders.php is in the plugin, out of my control. The documentation does not show how to set if, if it's necessary. – Kobazzo Mar 12 '21 at 22:09
  • Have you set your config per https://github.com/srmklive/laravel-paypal#configuration – Preston PHX Mar 12 '21 at 22:11
  • yes, i've set the config. In "app_id" how i need to set? where can i get this value? – Kobazzo Mar 12 '21 at 22:16
  • You aren't using Adaptive Payments, so no value. You'll just have to debug why things are null at the point you receive that error. – Preston PHX Mar 12 '21 at 22:28

0 Answers0