2017 © Pedro Peláez
 

library paypal-laravel

A Laravel 5 wrapper for PayPal

image

pulkitjalan/paypal-laravel

A Laravel 5 wrapper for PayPal

  • Monday, August 7, 2017
  • by pulkitjalan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 249 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 90 % Grown

The README.md

PayPal Laravel

A Laravel 5 wrapper for PayPal, (*1)

Total Downloads, (*2)

Requirements

  • PHP >= 5.5

This package wraps paypal/rest-api-sdk-php package., (*3)

Installation

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,

Configuration

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
    // ],
],

Usage

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());
    }
}

Similar Packages

The Versions

07/08 2017

dev-master

9999999-dev https://github.com/pulkitjalan/paypal-laravel

A Laravel 5 wrapper for PayPal

  Sources   Download

MIT

The Requires

 

laravel paypal