Download the PHP package adrian1207/laravel-przelewy24 without Composer
On this page you can find all versions of the php package adrian1207/laravel-przelewy24. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download adrian1207/laravel-przelewy24
More information about adrian1207/laravel-przelewy24
Files in adrian1207/laravel-przelewy24
Package laravel-przelewy24
Short Description Laravel przelewy24.pl integration
License MIT
Informations about the package laravel-przelewy24
Laravel Przelewy24 module
This module makes integration with przelewy24.pl payment system easier. It supports making payments using przelewy24.pl system.
Installation
-
Run
in console to install this module
-
Open
config/app.php
and addin section
providers
-
Run
in your console to publish default configuration files
-
Open
.env
and add your configuration:PRZELEWY24_MERCHANT_ID
-a Company or an Individual number, who has signed a contract with Przelewy24 (Merchant ID),PRZELEWY24_POS_ID
- the identification number of the shop (default: Merchant ID)PRZELEWY24_CRC
-a random string, used to calculate a CRC value, shown in Przelewy24 Admin panel.PRZELEWY24_TEST_SERVER
- if true, set the test environmentPRZELEWY24_URL_RETURN
- Return address, where Client will be redirected to, after the transaction is completed (default 'transfers24/callback').PRZELEWY24_URL_STATUS
- address where the status of a transaction is sent. It can be omitted if stored in P24 system (default 'transfers24/status').
Usage
In order to use the system, you need to do a few things:
-
You need to launch the registration request in order to init payment
-
You need to handle customer returning routes to your app. By default there are routes 'transfers24/callback'
- You should ensure transaction verify. Here you should send verify request of payment after receiving notification about correct transaction from payment system. You need to handle returning routes to status of the transaction which is sent automatically from payment system. By default there are routes 'transfers24/status'
Registration request
This is main request you need to launch to init payment.
The most basic sample code for authorization request could look like this:
This code should be run in controller as it's returning response which will takes few things.
-
Status registration payment
-
Token, if registration done with success
-
Error code return from payment system
-
Error Message return from payment system
- Request parameters send to payment system
For setAmount
default currency is PLN. If you want to use other currency, you should use currency constant from \Devpark\Transfers24\Currency
class as 2nd parameter. Also please notice that amount you should give to this function is real amount (with decimal places) and not converted already to Przelewy24 format.
For \Devpark\Transfers24\Requests\Transfers24::execute
method 2nd parameter decides of redirection to payment system when true or return url for making payment when false
Define customer returning routes
You should create routes that will redirect customer after the completed transaction (those routes will be launched using GET
HTTP method),
Handling transaction verify route
To make sure the payment was really successful you should use \Devpark\Transfers24\Requests\Transfers24::receive
method. The simplest code could look like this:
This code should be run in controller, because you should return non-empty response when receiving valid przelewy24 request for transaction verify. As you see, you should make sure it was real payment before you process the order and then you need to make sure that it was successful. You can identify payment via session_id (unique ID generate during registration of payment)).
Licence
This package is licenced under the MIT license