Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class "PaypalServerSdkLib\PaypalServerSdkClientBuilder" not found #27

Open
asia2tv opened this issue Dec 14, 2024 · 4 comments
Open

Class "PaypalServerSdkLib\PaypalServerSdkClientBuilder" not found #27

asia2tv opened this issue Dec 14, 2024 · 4 comments

Comments

@asia2tv
Copy link

asia2tv commented Dec 14, 2024

I have a problem

Context:

{
  "exception": "[object] (Error(code: 0): Class \"PaypalServerSdkLib\\PaypalServerSdkClientBuilder\" not found at /home/ascom/public_html/project/app/Http/Controllers/Frontend/PayPalController.php:50)
[stacktrace]
#0 [internal function]: App\\Http\\Controllers\\Frontend\\PayPalController->__construct()
#1 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(989): ReflectionClass->newInstanceArgs(Array)
#2 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(819): Illuminate\\Container\\Container->build('App\\\\Http\\\\Contro...')
#3 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1048): Illuminate\\Container\\Container->resolve('App\\\\Http\\\\Contro...', Array, true)
#4 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(755): Illuminate\\Foundation\\Application->resolve('App\\\\Http\\\\Contro...', Array)
#5 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1030): Illuminate\\Container\\Container->make('App\\\\Http\\\\Contro...', Array)
#6 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(285): Illuminate\\Foundation\\Application->make('App\\\\Http\\\\Contro...')
#7 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(1125): Illuminate\\Routing\\Route->getController()
#8 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Routing/Route.php(1054): Illuminate\\Routing\\Route->controllerMiddleware()
#9 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(820): Illuminate\\Routing\\Route->gatherMiddleware()
#10 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(802): Illuminate\\Routing\\Router->gatherRouteMiddleware(Object(Illuminate\\Routing\\Route))
#11 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#12 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#13 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#14 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#15 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#16 /home/ascom/public_html/project/vendor/litespeed/lscache-laravel/src/LSCacheMiddleware.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#17 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Litespeed\\LSCache\\LSCacheMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#20 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#23 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#26 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#27 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#28 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#29 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#32 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/InvokeDeferredCallbacks.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#33 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\InvokeDeferredCallbacks->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#34 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#35 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#36 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#37 /home/ascom/public_html/project/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1190): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#38 /home/ascom/public_html/index.php(17): Illuminate\\Foundation\\Application->handleRequest(Object(Illuminate\\Http\\Request))
#39 {main}
"
@christophrrb
Copy link

Any solution on this so far?

@asadali214
Copy link

asadali214 commented Dec 23, 2024

@asia2tv This most probably is looking like a missing import issue, can you double check if you have added the following import:

use PaypalServerSdkLib\PaypalServerSdkClientBuilder;

Cc: @christophrrb

@christophrrb
Copy link

christophrrb commented Dec 23, 2024

Yes, I have, so that's not the issue for me 😕.

I even downloaded sample code form this link https://www.paypalobjects.com/dev-studio-space/repositories/multilanguage/standard_html_php.zip, and if I run composer install and then composer start, the sample code gives me that same error. My code was using version 0.6.1, and the PayPal sample code uses version 0.6.0, and they both gave me the same error.

Edit: Added link and spelling

@christophrrb
Copy link

@asia2tv @asadali214 found the issue.

There is a capitalization discrepancy between what's show on the Integrate PayPal Checkout website vs. what's in the PayPal PHP GitHub docs.

The website shows use PaypalServerSdkLib\PaypalServerSDKClientBuilder;,
Docs Website Name

but it's supposed to be use PaypalServerSdkLib\PaypalServerSdkClientBuilder; ("Sdk" instead of "SDK") as in the GitHub docs example.
GitHub Name

The sample code link from my first message matches the website, so anyone following the website will likely get this error.

In short, to fix:

  • Change line 6 of your index.php file to use PaypalServerSdkLib\PaypalServerSdkClientBuilder;
  • Run composer dump-autoload so that composer has the right name to autoload now.
  • Run composer start, and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants