PHPackages                             jpranskaitis/paypal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. jpranskaitis/paypal

ActiveLibrary[Payment Processing](/categories/payments)

jpranskaitis/paypal
===================

Laravel-Paypal is simple package help you process direct credit card payments, stored credit card payments and PayPal account payments with your Laravel 5 projects using paypal REST API SDK.

1.1(11y ago)0795BSD-2-ClausePHPPHP &gt;=5.3.0

Since Dec 19Pushed 1y agoCompare

[ Source](https://github.com/jpranskaitis/laravel-paypal)[ Packagist](https://packagist.org/packages/jpranskaitis/paypal)[ RSS](/packages/jpranskaitis-paypal/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (3)Used By (0)

laravel-paypal
--------------

[](#laravel-paypal)

`laravel-paypal` handless direct credit card payments, stored credit card payments and PayPal account balance payments. It's developed for use with Laravel 5 and leverages the latest Paypal REST API SDK for PHP.

Installation
------------

[](#installation)

1. Run this command in your Laravel project root to install using Composer `composer require netshell/paypal dev-master`
2. Next, add the service provider to `app/config/app.php` in the `providers` array.

```
'providers' => array(
    // ...
    'Netshell\Paypal\PaypalServiceProvider',
)
```

3. Finally, add an alias to `app/config/app.php` in the `aliases` array.

```
'aliases' => array(
    // ...
    'Paypal' => 'Netshell\Paypal\Facades\Paypal',
)
```

\##Configuration

Use the `$apiContext->setConfig()` method to pass in your PayPal details. Below is one example of sandbox configuration in a controller constructor:

```
    private $_apiContext;

    public function __construct()
    {
        $this->_apiContext = PayPal::ApiContext(
            config('services.paypal.client_id'),
            config('services.paypal.secret'));

		$this->_apiContext->setConfig(array(
			'mode' => 'sandbox',
			'service.EndPoint' => 'https://api.sandbox.paypal.com',
			'http.ConnectionTimeOut' => 30,
			'log.LogEnabled' => true,
			'log.FileName' => storage_path('logs/paypal.log'),
			'log.LogLevel' => 'FINE'
		));

    }
```

Given you have set your developer information in `config/services.php`:

```
'paypal' => [
	'client_id' => 'Client_ID',
	'secret' => 'Your_secret'
],

```

Code Samples
------------

[](#code-samples)

### List Payments

[](#list-payments)

```
Paypal::getAll(array('count' => 1, 'start_index' => 0), $this->_apiContext);
```

### Payment Details

[](#payment-details)

```
Paypal::getById($payment_id, $this->_apiContext);
```

### Example Controller

[](#example-controller)

This example provides you have a controller that runs the package configuration like in the snippet in the Configuration section.

```
use PayPal;
use Redirect;
// ...
public function getCheckout()
{
	$payer = PayPal::Payer();
	$payer->setPaymentMethod('paypal');

	$amount = PayPal:: Amount();
	$amount->setCurrency('EUR');
	$amount->setTotal(42); // This is the simple way,
	// you can alternatively describe everything in the order separately;
	// Reference the PayPal PHP REST SDK for details.

	$transaction = PayPal::Transaction();
	$transaction->setAmount($amount);
	$transaction->setDescription('What are you selling?');

	$redirectUrls = PayPal:: RedirectUrls();
	$redirectUrls->setReturnUrl(action('ThisController@getDone'));
	$redirectUrls->setCancelUrl(action('ThisController@getCancel'));

	$payment = PayPal::Payment();
	$payment->setIntent('sale');
	$payment->setPayer($payer);
	$payment->setRedirectUrls($redirectUrls);
	$payment->setTransactions(array($transaction));

	$response = $payment->create($this->_apiContext);
	$redirectUrl = $response->links[1]->href;

	return Redirect::to( $redirectUrl );
}

public function getDone(Request $request)
{
	$id = $request->get('paymentId');
	$token = $request->get('token');
	$payer_id = $request->get('PayerID');

	$payment = PayPal::getById($id, $this->_apiContext);

	$paymentExecution = PayPal::PaymentExecution();

	$paymentExecution->setPayerId($payer_id);
	$executePayment = $payment->execute($paymentExecution, $this->_apiContext);

    // Clear the shopping cart, write to database, send notifications, etc.

    // Thank the user for the purchase
	return view('checkout.done');
}

public function getCancel()
{
    // Curse and humiliate the user for cancelling this most sacred payment (yours)
	return view('checkout.cancel');
}
```

### Customize Paypal payment page

[](#customize-paypal-payment-page)

First we need to create a new WebProfile for obtain the id, then in the future we can simply set this id to the payment object.

```
public function createWebProfile(){

	$flowConfig = PayPal::FlowConfig();
	$presentation = PayPal::Presentation();
	$inputFields = PayPal::InputFields();
	$webProfile = PayPal::WebProfile();
	$flowConfig->setLandingPageType("Billing"); //Set the page type

	$presentation->setLogoImage("https://www.example.com/images/logo.jpg")->setBrandName("Example ltd"); //NB: Paypal recommended to use https for the logo's address and the size set to 190x60.

	$inputFields->setAllowNote(true)->setNoShipping(1)->setAddressOverride(0);

	$webProfile->setName("Example " . uniqid())
		->setFlowConfig($flowConfig)
		// Parameters for style and presentation.
		->setPresentation($presentation)
		// Parameters for input field customization.
		->setInputFields($inputFields);

	$createProfileResponse = $webProfile->create($this->_apiContext);

	return $createProfileResponse->getId(); //The new webprofile's id
}
```

Now set the WebProfile's id to the payment object `$payment->setExperienceProfileId("XP-ABCD-EFGH-ILMN-OPQR");`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~73 days

Total

2

Last Release

4085d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/73af2a3d8c004410d685d1cc1db89753d6dd9ea324388fdb24db2da7aa36c9fc?d=identicon)[jpranskaitis](/maintainers/jpranskaitis)

---

Top Contributors

[![anouarabdsslm](https://avatars.githubusercontent.com/u/2453950?v=4)](https://github.com/anouarabdsslm "anouarabdsslm (72 commits)")[![ash-rain](https://avatars.githubusercontent.com/u/4172202?v=4)](https://github.com/ash-rain "ash-rain (13 commits)")[![jpranskaitis](https://avatars.githubusercontent.com/u/1993455?v=4)](https://github.com/jpranskaitis "jpranskaitis (5 commits)")[![Tizianoz93](https://avatars.githubusercontent.com/u/7263852?v=4)](https://github.com/Tizianoz93 "Tizianoz93 (2 commits)")[![mferrara](https://avatars.githubusercontent.com/u/795065?v=4)](https://github.com/mferrara "mferrara (2 commits)")[![jonathanfreites](https://avatars.githubusercontent.com/u/15368977?v=4)](https://github.com/jonathanfreites "jonathanfreites (1 commits)")[![josephting](https://avatars.githubusercontent.com/u/1507016?v=4)](https://github.com/josephting "josephting (1 commits)")[![exodusanto](https://avatars.githubusercontent.com/u/13484843?v=4)](https://github.com/exodusanto "exodusanto (1 commits)")[![justgage](https://avatars.githubusercontent.com/u/164033?v=4)](https://github.com/justgage "justgage (1 commits)")[![maxl28](https://avatars.githubusercontent.com/u/1271301?v=4)](https://github.com/maxl28 "maxl28 (1 commits)")[![danielold-inmanage](https://avatars.githubusercontent.com/u/20152916?v=4)](https://github.com/danielold-inmanage "danielold-inmanage (1 commits)")[![theprdv](https://avatars.githubusercontent.com/u/23725761?v=4)](https://github.com/theprdv "theprdv (1 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (1 commits)")

### Embed Badge

![Health badge](/badges/jpranskaitis-paypal/health.svg)

```
[![Health](https://phpackages.com/badges/jpranskaitis-paypal/health.svg)](https://phpackages.com/packages/jpranskaitis-paypal)
```

###  Alternatives

[laraveldaily/laravel-invoices

Missing invoices for Laravel

1.5k1.3M4](/packages/laraveldaily-laravel-invoices)[anouar/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card payments, stored credit card payments and PayPal account payments with your L4 projects using paypal REST API SDK.

33980.2k2](/packages/anouar-paypalpayment)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
