2017 © Pedro Peláez
 

library laravel-payment-commands

Payment commands for laravel

image

amonger/laravel-payment-commands

Payment commands for laravel

  • Tuesday, August 23, 2016
  • by haveacigaro
  • Repository
  • 1 Watchers
  • 5 Stars
  • 698 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Laravel Payment Commands

This repo contains a set of commands which allow you to use Laravels command bus to take payments through paypal express (with more to come)., (*1)

Setting up

Initially you're going to have to find your api details, which you can find under your profile page on paypal., (*2)

You'll need to add these to your .env file, (*3)

PAYPAL_USERNAME=username
PAYPAL_PASSWORD=password
PAYPAL_SIGNATURE=signature
#PAYPAL_TEST_MODE=true # Be sure to use this if accessing a sandbox!

You'll then need to add the gateway service provider to your app.php. This binds the provider to the GatewayInterface., (*4)

    'providers' => [
        ...
        PaymentCommands\Paypal\Providers\GatewayServiceProvider::class
    ],

Dispatching Commands

After this has been added, you're good to go! Just fire the command bus in your controller for handling the payment. This will return the redirect url, which you can then redirect to., (*5)

    public function index()
    {
        $cancelUrl = url('/cancel');
        $returnUrl = url('/capture');
        $currency = 'GBP';

        $items = [
            [
                'price' => 200,
                'description' => 'A bike',
                'quantity' => 1
            ]
        ];

        $redirectUrl = $this->dispatch(new MakePayment($items, $currency, $cancelUrl, $returnUrl));
        return redirect($redirectUrl);
    }

After the payment has been completed, you redirect the user back to your website., (*6)

    public function capture()
    {
        $this->dispatch(new CapturePayment(Input::get('token'), Input::get('payerID')));
    }

Extending

Each stage of the command bus fires an event which you can hook into., (*7)

You can read about how to implement this by looking at the Event Documentation, (*8)

The Versions

23/08 2016

dev-master

9999999-dev

Payment commands for laravel

  Sources   Download

MIT

The Requires

 

by Alan Monger

23/08 2016

v0.1.5

0.1.5.0

Payment commands for laravel

  Sources   Download

MIT

The Requires

 

by Alan Monger

12/08 2016

v0.1.4

0.1.4.0

Payment commands for laravel

  Sources   Download

MIT

The Requires

 

by Alan Monger

13/08 2015

v0.1.3

0.1.3.0

Payment commands for laravel

  Sources   Download

MIT

The Requires

 

by Alan Monger

18/06 2015

v0.1.2

0.1.2.0

Payment commands for laravel

  Sources   Download

MIT

The Requires

 

by Alan Monger

18/06 2015

v0.1.1

0.1.1.0

Payment commands for laravel

  Sources   Download

MIT

The Requires

 

by Alan Monger

18/06 2015

v0.1.0

0.1.0.0

Payment commands for laravel

  Sources   Download

MIT

The Requires

 

by Alan Monger