1. Go to this page and download the library: Download thepay/api-client 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/ */
/** @var \ThePay\ApiClient\TheConfig $theConfig */
// TheClient instance dependencies
$signatureService = new \ThePay\ApiClient\Service\SignatureService($theConfig);
/** @var \Psr\Http\Client\ClientInterface $httpClient some PSR-18 implementation */
/** @var \Psr\Http\Message\RequestFactoryInterface $requestFactory some PSR-17 implementation */
/** @var \Psr\Http\Message\StreamFactoryInterface $streamFactory some PSR-17 implementation */
// if you install suggested guzzle implementation you can use this:
// $httpClient = new \GuzzleHttp\Client();
// $requestFactory = $streamFactory = new \GuzzleHttp\Psr7\HttpFactory();
$apiService = new \ThePay\ApiClient\Service\ApiService(
$theConfig,
$signatureService,
$httpClient,
$requestFactory,
$streamFactory
);
$thePayClient = new \ThePay\ApiClient\TheClient(
$theConfig,
$apiService
);
/** @var \ThePay\ApiClient\TheClient $thePayClient */
// Render payment methods for payment (100,- Kč)
$paymentParams = new \ThePay\ApiClient\Model\CreatePaymentParams(10000, 'CZK', 'uid124');
// display button, user will choose payment method at the payment gate
echo $thePayClient->getPaymentButton($paymentParams);
// or buttons with available payment methods, payment method will be preselected
// echo $thePayClient->getPaymentButtons($paymentParams);
// or just get payment link and redirect customer whenever you want
// $payment = $thePayClient->createPayment($createPayment);
// $redirectLink = $payment->getPayUrl();
/** @var \ThePay\ApiClient\TheClient $thePayClient */
$payment = $thePayClient->getPayment($uid);
// check if the payment is paid
if ($payment->wasPaid()) {
// Check if the order isn't labeled as paid yet. If not, do so.
// ...
}
/** @var \ThePay\ApiClient\TheClient $thePayClient */
$payment = $thePayClient->getPayment($uid);
// check if the payment is paid
if ($payment->wasPaid()) {
// Check if the order isn't labeled as paid yet. If not, do so.
// ...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.