Use Laravel PayPal as a standalone PHP client
mainThe package does not require Laravel. You can use it in any PHP project by instantiating the PayPal service and passing your credentials directly using setApiCredentials().
use Srmklive\
PayPal\Services\PayPal as PayPalClient;
$provider = new PayPalClient;
$provider->setApiCredentials([
'mode' => 'sandbox', // or 'live'
'sandbox' => [
'client_id' => 'YOUR_SANDBOX_CLIENT_ID',
'client_secret' => 'YOUR_SANDBOX_CLIENT_SECRET',
'app_id' => 'APP-80W284485P519543T',
],
'live' => [
'client_id' => 'YOUR_LIVE_CLIENT_ID',
'client_secret' => 'YOUR_LIVE_CLIENT_SECRET',
'app_id' => 'YOUR_LIVE_APP_ID',
],
'payment_action' => 'Sale',
'currency' => 'USD',
'notify_url' => '',
'locale' => 'en_US',
'validate_ssl' => true,
]);
$provider->getAccessToken();
// API methods are now available
$order = $provider->createOrder([...]);