PHPackages                             willvin/przelewy24 - 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. willvin/przelewy24

ActiveLibrary[Payment Processing](/categories/payments)

willvin/przelewy24
==================

A simple php payment library that implements the przelewy24 payment gateway.

2.0.0(2y ago)311.6k↓38.6%MITPHPPHP &gt;=7.4CI passing

Since May 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/willvin313/przelewy24)[ Packagist](https://packagist.org/packages/willvin/przelewy24)[ RSS](/packages/willvin-przelewy24/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Przelewy24
==========

[](#przelewy24)

A simple composer package that implements the przelewy24 payment gateway.

#### willvin's Przelewy24 payment processing library

[](#willvins-przelewy24-payment-processing-library)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Codacy Badge](https://camo.githubusercontent.com/ee908719c5c3f8a86d3aa43ad000cb34a6daa68ebe219d8fa573bbdee176bb14/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3863666437326435356361343432653462336430366662626633613763653839)](https://www.codacy.com/manual/willvin313/przelewy24?utm_source=github.com&utm_medium=referral&utm_content=willvin313/przelewy24&utm_campaign=Badge_Grade)

For more information about the Przelewy24 API, take a look at the [manual](http://www.przelewy24.pl/files/cms/13/przelewy24_specification.pdf)

Install
=======

[](#install)

This gateway can be installed with [Composer](https://getcomposer.org/):

```
$ composer require willvin/przelewy24
```

Example
=======

[](#example)

Initiate Transaction
--------------------

[](#initiate-transaction)

```
require_once __DIR__ . '/vendor/autoload.php';

use willvin\Przelewy24\Gateway;

$gateway = new Gateway();

$gateway->initialize([
    'merchantId' => 'YOUR MERCHANT ID HERE',
    'posId'      => 'YOUR POS ID HERE',
    'crc'        => 'YOUR CRC KEY HERE',
    'testMode'   => true, // Sets P24 gateway to use sandbox url
]);

$gateway->setPostData([
    'p24_transactionId' => 'Transaction ID',
    'p24_amount'        => 'Amount',
    'p24_description'   => 'Description',
    'p24_email'         => 'Email',
    'p24_session_id'    => $gateway->getSessionId('Transaction ID'), //pass your transaction id here or use this $gateway->getSessionId($orderId) function to generate the id
    'p24_currency'      => 'Currency',
    'p24_country'       => 'Country',
    'p24_url_return'    => 'Url to redirect user, after payment',
    'p24_url_status'    => 'Transaction status callback url',
]);

$res = $gateway->trnRegister(); // ruturns a code like this D35CD73C0E-37C7B5-059083-E8EFB7FA96

if(!$res['error']){
    $res = $gateway->trnRequest($res['token']); // trigger the payment
} else {
    echo 'Transaction failed.';
}
```

Verify Transaction
------------------

[](#verify-transaction)

```
require_once __DIR__ . '/vendor/autoload.php';

use willvin\Przelewy24\Gateway;

$gateway = new Gateway();

$rawData = file_get_contents('php://input');
parse_str($rawData, $p24Data);

if(!empty($p24Data)){
	$gateway->initialize([
		'merchantId' => 'YOUR MERCHANT ID HERE',
		'posId'      => 'YOUR POS ID HERE',
		'crc'        => 'YOUR CRC KEY HERE',
		'testMode'   => true, // Sets P24 gateway to use sandbox url
	]);

	$gateway->setPostData([
		'p24_session_id' => $p24Data['p24_session_id'],
		'p24_order_id' => $p24Data['p24_order_id'],
		'p24_amount' => $p24Data['p24_amount'],
		'p24_currency' => $p24Data['p24_currency']
	]);
	$res = $gateway->trnVerify(); // Use to verify the payment sent to your callback url
}
```

Usage
=====

[](#usage)

Initialization
--------------

[](#initialization)

```
require_once __DIR__ . '/vendor/autoload.php';

use willvin\Przelewy24\Gateway;

$gateway = new Gateway();

$gateway->initialize([
    'merchantId' => 'YOUR MERCHANT ID HERE',
    'posId'      => 'YOUR POS ID HERE',
    'crc'        => 'YOUR CRC KEY HERE',
    'testMode'   => true, // Sets P24 gateway to use sandbox url
]);
```

OR

```
require_once __DIR__ . '/vendor/autoload.php';

use willvin\Przelewy24\Gateway;

$gateway = new Gateway('YOUR MERCHANT ID HERE', 'YOUR POS ID HERE', 'YOUR CRC KEY HERE', true);
```

Set Post Data
-------------

[](#set-post-data)

```
$gateway->setPostData([
    'p24_transactionId' => 'Transaction ID',
    'p24_amount'        => 'Amount',
    'p24_description'   => 'Description',
    'p24_email'         => 'Email',
    'p24_session_id'    => 'Session ID',
    'p24_currency'      => 'Currency',
    'p24_country'       => 'Country',
    'p24_url_return'    => 'Url to redirect user, after payment',
    'p24_url_status'    => 'Transaction status callback url',
    'p24_channel'       => $gateway::P24_CHANNEL_ALL, // you have the following channels available P24_CHANNEL_CC, P24_CHANNEL_BANK_TRANSFERS, P24_CHANNEL_MANUAL_TRANSFER, P24_CHANNEL_ALL_METHODS_24_7, P24_CHANNEL_USE_PREPAYMENT, P24_CHANNEL_ALL
]);
```

OR

```
$gateway->addValue('p24_transactionId', 'Transaction ID');
$gateway->addValue('p24_amount', 'Amount');
$gateway->addValue('p24_description', 'Description');
$gateway->addValue('p24_email', 'Email');
$gateway->addValue('p24_session_id', 'Session ID');
$gateway->addValue('p24_currency', 'Currency');
$gateway->addValue('p24_country', 'Country');
$gateway->addValue('p24_url_return', 'Url to redirect user, after payment';
$gateway->addValue('p24_url_status', 'Transaction status callback url';
$gateway->addValue('p24_channel', $gateway::P24_CHANNEL_ALL);// you have the following channels available P24_CHANNEL_CC, P24_CHANNEL_BANK_TRANSFERS, P24_CHANNEL_MANUAL_TRANSFER, P24_CHANNEL_ALL_METHODS_24_7, P24_CHANNEL_USE_PREPAYMENT, P24_CHANNEL_ALL
```

### Other available Post Data fields

[](#other-available-post-data-fields)

```
p24_address

p24_language

p24_client

p24_city

p24_order_id

p24_method

p24_time_limit

p24_shipping

p24_wait_for_result

p24_encoding

p24_transfer_label

p24_phone

p24_zip

#### Shopping cart details, where X is a number 1-100 (optional 2)

p24_name_X

p24_description_X

p24_quantity_X

p24_price_X

p24_number_X
```

For more details, you can read the [przelewy24 documentation](http://www.przelewy24.pl/eng/storage/app/media/pobierz/Instalacja/przelewy24_specification.pdf)

Register transaction
--------------------

[](#register-transaction)

```
$res = $gateway->trnRegister(); // ruturns a token like this D35CD73C0E-37C7B5-059083-E8EFB7FA96
```

Initiate Transaction
--------------------

[](#initiate-transaction-1)

```
$res = $gateway->trnRequest('Pass transaction token here'); // trigger the payment with your token
```

Verify Transaction
------------------

[](#verify-transaction-1)

```
$res = $gateway->trnVerify(); // Use to verify the payment sent to your callback url
```

Generate Session ID
-------------------

[](#generate-session-id)

```
$gateway->getSessionId('Transaction ID');
```

Support
=======

[](#support)

If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/willvin313/przelewy24/issues), or better yet, fork the library and submit a pull request.

*Click "Watch and Star" to get an email notification once an update is made to this repository. And contributions are also welcomed.*

You can support this project by donating to the following address.

[![Buy Me A Coffee](https://camo.githubusercontent.com/9a769e616ce78645bf51d12e4179cfbfd72fb413722b284e0be3ec3c75a86010/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f64656661756c742d6f72616e67652e706e67)](https://www.buymeacoffee.com/GCWc1kS)

**PayPal:** [Make a Donation](https://paypal.me/iamwillvin)

**Patreon:** [Become a Patron!](https://www.patreon.com/bePatron?u=25729924)

**YouTube:** [Subscribe to willvin](https://www.youtube.com/channel/UCHCEiFFWcdcXhzgePJJtIZQ)

Security
========

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
=======

[](#credits)

- [TicketSwap](https://github.com/ticketswap)
- [Przelewy24](https://przelewy24.pl)

License
=======

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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 ~1161 days

Total

2

Last Release

1026d ago

Major Versions

1.0.0 → 2.0.02023-07-27

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

2.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7949714?v=4)[William Gauvin](/maintainers/willvin)[@willvin](https://github.com/willvin)

---

Top Contributors

[![willvin313](https://avatars.githubusercontent.com/u/17111747?v=4)](https://github.com/willvin313 "willvin313 (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

composercomposer-librarygatewayphp-codephp-libraryphpradprzelewy-gatewayprzelewy-payment-libraryprzelewy24willvin313phpcomposerpackagepaymentsPrzelewy24payment gateway

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/willvin-przelewy24/health.svg)

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

###  Alternatives

[kingflamez/laravelrave

A Laravel Package for Flutterwave Rave

151286.1k4](/packages/kingflamez-laravelrave)[mnastalski/przelewy24-php

Przelewy24 PHP library

52101.2k2](/packages/mnastalski-przelewy24-php)[razorpay/magento

Razorpay Magento 2.0 plugin for accepting payments.

3076.5k1](/packages/razorpay-magento)[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)[threesquared/laravel-paymill

Laravel wrapper for the Paymill API

121.3k](/packages/threesquared-laravel-paymill)

PHPackages © 2026

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