1. Go to this page and download the library: Download simpaypl/laravel 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/ */
simpaypl / laravel example snippets
use SimPay\Laravel\Facades\SimPay;
SimPay::payment();
SimPay::directBilling();
SimPay::sms();
// at first generate payment
// only e()
->amount(15.00)
->customer(
new \SimPay\Laravel\Dto\Payment\CustomerData(
email: 'Email',
ip: 'IP address',
countryCode: 'PL', // for BLIK it must be PL
)
)
->antifraud(
new \SimPay\Laravel\Dto\Payment\AntiFraudData(
userAgent: 'UserAgent (REQUIRED)',
)
)
->currency('PLN')
->directChannel('blik-level0') // it must be set to blik-level0
->make();
// Now make Level 0 call
try {
$success = SimPay::payment()->blikLevel0()
->ticket('111222') // BLIK code
->ticketType(\SimPay\Laravel\Enums\Payment\BlikLevel0TicketType::T6) // for now, only T6 codes are supported
->transaction($payment) // you may pass full TransactionGenerateResponse or just transactionId
->make();
}
catch(\SimPay\Laravel\Exceptions\BlikLevel0\InvalidBlikTicketException $exception) {
// notify user that BLIK ticket is not valid
// you can also get errorCode returned from our API:
$exception->errorCode;
}
catch(\SimPay\Laravel\Exceptions\SimPayException $exception) {
// other error
// you can also get errorCode returned from our API:
$exception->errorCode;
}
SimPay::directBilling()->generate()
->amount(15.00)
->amountType(\SimPay\Laravel\Enums\DirectBilling\AmountType::Net)
// other are optionals
->returns(new \SimPay\Laravel\Dto\ReturnData(
'https://success.pl',
'https://failure.com',
))
->control('Control field (ex. your database id from your integration)')
->description('Transaction description')
->phoneNumber('+48123123123')
->steamId('SteamID64')
->email('Email')
// make is