1. Go to this page and download the library: Download mnastalski/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/ */
mnastalski / przelewy24-php example snippets
use Przelewy24\Przelewy24;
$przelewy24 = new Przelewy24(
merchantId: 12345,
reportsKey: 'f0ae...',
crc: 'aef0...',
isLive: false,
);
$transaction = $przelewy24->transactions()->register(
// Required parameters:
sessionId: 'unique order identifier from your application',
amount: 125,
description: 'transaction description',
email: 'buyer email address',
urlReturn: 'url to return to after transaction',
// Optional parameters:
urlStatus: 'url to which the transaction status webhook will be sent',
// client: 'Mateusz Nastalski',
// currency: \Przelewy24\Enums\Currency::EUR,
// language: Language::ENGLISH,
// ...
);
$przelewy24->transactions()->verify(
sessionId: 'unique order identifier from your application',
orderId: $webhook->orderId(),
amount: 125,
);
$refund = $przelewy24->transactions()->refund(
requestId: 'unique request identifier from your application',
refundsId: 'unique refunds identifier from your application',
refunds: [
new RefundItem(
orderId: $webhook->orderId(),
sessionId: 'unique order identifier from your application',
amount: 2100,
description: 'item #1',
),
new RefundItem(
orderId: $webhook->orderId(),
sessionId: 'unique order identifier from your application',
amount: 125,
description: 'item #2',
),
],
urlStatus: 'url to which the refund status webhook will be sent',
);