PHPackages                             seberm/paypal-component - 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. [API Development](/categories/api)
4. /
5. seberm/paypal-component

ActiveLibrary[API Development](/categories/api)

seberm/paypal-component
=======================

PayPal basic library and Nette component

1.0.3(10y ago)159046[4 issues](https://github.com/seberm/nette-paypal/issues)BSD-2-Clause-FreeBSDPHPPHP &gt;=5.6CI failing

Since Jul 21Pushed 10y ago2 watchersCompare

[ Source](https://github.com/seberm/nette-paypal)[ Packagist](https://packagist.org/packages/seberm/paypal-component)[ Docs](https://github.com/seberm/nette-paypal)[ RSS](/packages/seberm-paypal-component/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (7)Used By (0)

PayPal Component
================

[](#paypal-component)

### Installation

[](#installation)

Simplest installation is using `composer`:

```
$ composer require seberm/paypal-component

```

or manually you can edit `composer.json`:

```
"require": {
        "seberm/paypal-component": "1.0.*"
}

```

### Configuration

[](#configuration)

#### A) Using DI Extension (Nette 2.1+)

[](#a-using-di-extension-nette-21)

Add following lines into your `config.neon` file.

```
parameters: ...

---------------------------
paypal:
    api:
       username: 'seberm_1332081338_biz_api1.gmail.com'
       password: '1332081363'
       signature: 'AWiH1IO0zFZrEQbbn0JwDZHbWukIAebmYjpOylRCqBGGgztea2bku.N4'
    sandbox: true # default is false

extensions:
    paypal: Seberm\DI\PayPalExtension
---------------------------

php:
    date.timezone: Europe/Prague
    ...
```

More about DI container extensions you can find here:

#### B) Manually throught factories

[](#b-manually-throught-factories)

Alternatively you can configure component via factories.

```
parameters:
    paypal:
        api:
            username: 'seberm_1332081338_biz_api1.gmail.com'
            password: '1332081363'
            signature: 'AWiH1IO0zFZrEQbbn0JwDZHbWukIAebmYjpOylRCqBGGgztea2bku.N4'
        sandbox: true

factories:
    paypalOrderButton:
        implement: Seberm\Components\PayPal\Buttons\IOrderFactory
        setup:
            - setCredentials(%paypal.api%)
            - setSandBox(%paypal.sandbox%)
```

### Example of a Presenter

[](#example-of-a-presenter)

Firstly, you have to get IOrderFactory object.

#### Getting IOrderFactory using DI extensions (method A)

[](#getting-iorderfactory-using-di-extensions-method-a)

```
/** @var \Seberm\Components\PayPal\Buttons\IOrderFactory @inject */
public $factory;
```

#### Getting IOrderFactory using nette factories (method B)

[](#getting-iorderfactory-using-nette-factories-method-b)

```
/** @var \Seberm\Components\PayPal\Buttons\IOrderFactory $factory */
public $factory;

/**
 * @param \Seberm\Components\PayPal\Buttons\IOrderFactory $factory
 */
public function injectFactory(\Seberm\Components\PayPal\Buttons\IOrderFactory $factory)
{
    $this->factory = $factory;
}
```

Following code will be the same for both methods.

```
/** @var \Seberm\Components\PayPal\Buttons\Order */
private $orderButton;

public function startup()
{
    parent::startup();

    $this->orderButton = $this->factory->create();
    $this->orderButton->setSessionSection($this->session->getSection('paypal'));
    $this->orderButton->onSuccessPayment[] = array($this, 'successPayment');
}

/**
 * Creates new button control. After that you can load this control in template
 * via {control paypalButton}.
 * @return Seberm\Components\PayPal\Buttons\Order
 */
protected function createComponentPaypalButton()
{
    $control = $this->orderButton;
    $control->setCurrencyCode(\Seberm\PayPal\API\API::CURRENCY_EURO);
    $control->onConfirmation[] = array($this, 'confirmOrder');
    $control->onError[] = array($this, 'errorOccurred');
    $control->onCancel[] = array($this, 'canceled');

    // It is possible to set shipping
    $button->shipping = 4.3;

    // or set a tax
    $button->tax = 3.1;

    $price = 56; // In Euro in this example

    $control->addItemToCart('Product A', 'A - Product description', $price);
    $control->addItemToCart('Product B', 'B - Product description', 123);

    return $control;
}
```

##### Don't forget to define callback methods

[](#dont-forget-to-define-callback-methods)

This method is called after successful confirmation. It has one argument `$data`.

```
public function successPayment($data) {
    /**
     * Here you can proccess information about user. For example save him to the
     * database...
     */

     $payerID = $data->payerID;
     $firstName = $data->firstName;
     $lastName = $data->lastName;
     $email = $data->email;

     // See dump($data);
}
```

Following method is called if some error occures (for example error in communication). It receives an array of errors.

```
public function errorOccurred($errors)  { ... }
```

```
// It is called if payment inicialization succeeds
public function confirmOrder($data) {
    /**
     * Here you can do some checks of the order data. If everything is ok,
     * you can confirm the order with confirmExpressCheckout() method.
     */
    ...
    $this->orderButton->confirmExpressCheckout();
}

public function canceled($data)       { ... } // Called if user cancels his order
```

### Adding PayPal button to a template

[](#adding-paypal-button-to-a-template)

Add following control macro where you want to have your PayPal button.

```
{control paypalButton}

```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 62.7% 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 ~275 days

Recently: every ~340 days

Total

6

Last Release

3669d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.2

1.0.3PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec9da7b0d684abfb799d9e0093de1b17ae0eee3cc68219a1634f79ccc6517f54?d=identicon)[seberm](/maintainers/seberm)

---

Top Contributors

[![seberm](https://avatars.githubusercontent.com/u/212597?v=4)](https://github.com/seberm "seberm (69 commits)")[![jsifalda](https://avatars.githubusercontent.com/u/1549390?v=4)](https://github.com/jsifalda "jsifalda (26 commits)")[![fmasa](https://avatars.githubusercontent.com/u/5658260?v=4)](https://github.com/fmasa "fmasa (7 commits)")[![martinknor](https://avatars.githubusercontent.com/u/2004222?v=4)](https://github.com/martinknor "martinknor (6 commits)")[![fprochazka](https://avatars.githubusercontent.com/u/158625?v=4)](https://github.com/fprochazka "fprochazka (1 commits)")[![MartinKokesCz](https://avatars.githubusercontent.com/u/1529358?v=4)](https://github.com/MartinKokesCz "MartinKokesCz (1 commits)")

---

Tags

apinettepaymentspaypalcomponent

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

59914.4M62](/packages/mollie-mollie-api-php)[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[openbuildings/paypal

PayPal SDK for ExpressCheckout and AdaptivePayments. Supports recurring payments, simple payments, parallel payments and chained payments.

31176.0k](/packages/openbuildings-paypal)[transbank/transbank-sdk

Transbank SDK

62626.4k12](/packages/transbank-transbank-sdk)[mollie/magento

iDEAL, Creditcard, Bancontact/Mister Cash, SOFORT, Bank transfer, Bitcoin, PayPal &amp; paysafecard for Magento https://www.mollie.com/

397.9k](/packages/mollie-magento)

PHPackages © 2026

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