dev-master
9999999-dev https://github.com/pulkitjalan/paypal-laravelA Laravel 5 wrapper for PayPal
MIT
The Requires
by Pulkit Jalan
laravel paypal
Wallogit.com
2017 © Pedro Peláez
A Laravel 5 wrapper for PayPal
A Laravel 5 wrapper for PayPal, (*1)
This package wraps paypal/rest-api-sdk-php package., (*3)
Require the package, (*4)
composer require pulkitjalan/paypal-laravel
Laravel 5.5 uses Package Auto-Discovery, so you don't need to manually add the ServiceProvider., (*5)
If you don't use auto-discovery, add the following to the providers array in your config/app.php, (*6)
PulkitJalan\PayPal\PayPalServiceProvider::class,
Next add the following to the aliases array in your config/app.php. Pick and choose if you want or add all 3., (*7)
'PayPal' => PulkitJalan\PayPal\Facades\PayPal::class,
The config is set in config/services.php, (*8)
'paypal' => [
'client_id' => env('PAYPAL_CLIENT_ID'),
'client_secret' => env('PAYPAL_CLIENT_SECRET'),
'mode' => env('PAYPAL_MODE'), // default is sandbox
// 'log' => [
// 'enabled' => true // default is false
// 'file' => 'paypal.log' // default is laravel.log
// 'level' => 'DEBUG' // default is DEBUG
// ],
],
Main use is to get one of the PayPal api classes., (*9)
use PulkitJalan\PayPal\PayPal
class App {
protected $paypal;
public function __construct(PayPal $paypal)
{
$this->paypal = $paypal;
}
public function payout()
{
$payouts = $this->paypal->payout(); // returns PayPal\Api\Payout
$senderBatchHeader = $this->paypal->payoutSenderBatchHeader(); // returns PayPal\Api\PayoutSenderBatchHeader
...
$senderItem = $this->paypal->payoutItem(); // returns PayPal\Api\PayoutItem
...
$payouts->setSenderBatchHeader($senderBatchHeader)
->addItem($senderItem);
...
$payout->create([], $this->paypal->getApiContext());
}
}
A Laravel 5 wrapper for PayPal
MIT
laravel paypal