PHP code example of piatkowski / przelewy24-php

1. Go to this page and download the library: Download piatkowski/przelewy24-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

piatkowski / przelewy24-php example snippets


$client = new \Przelewy24\Przelewy24( [
	'merchantId' => '...',
	'posId'      => '...',
	'crc'        => '...',
	'reportKey'  => '...', // API KEY
	'sandbox'    => true,
] );

$transaction = $client->transaction( [
	'sessionId'   => '...',
	'amount'      => '...',
	'currency'    => 'PLN',
	'description' => '...',
	'email'       => '...',
	'urlReturn'   => '...',
	'urlStatus'   => '...'
] );

$transaction->getRedirectUrl();

// get incoming data from php://input
$notification = $client->receiveNotification();

// create Notification object from raw data
$notification = $client->createNotification([
    'sessionId'     => '...',
    'amount'        => '...',
    'orderId'       => '...',
    'currency'      => '...', // optional, default: PLN
]);

$response   = $client->verify( $notification );
$status     = $response->getStatus();   //HTTP Status Code
$data       = $response->getData();     //Response data object
shell
composer