1. Go to this page and download the library: Download sovic/pays-cz-php-sdk 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/ */
sovic / pays-cz-php-sdk example snippets
$pays = new Pays('{merchant-id}', '{shop-id}', '{secret}');
$paysPayment = $pays->createPayment('{shop-payment-id}', '{price}', '{currency}');
$paysPayment->setEmail('{customer-email}'); // optionally add customer email for Pays.cz notifications
// get Pays.cz gateway url (E.g. for payment button)
$url = $pays->buildPaymentUrl($paysPayment, '{return-url}');
// redirect to Pays.cz gateway directly
$pays->redirectToPaymentUrl($paysPayment, '{return-url}');
$query = [ … ]; // query params array from HTTP request
try {
$paysPayment = $pays->validatePaymentRequestQuery($query);
if ($paysPayment->isPaid()) {
// handle successful payment
$clientPaymentId = $paysPayment->getClientPaymentId();
} else {
// handle failed|cancelled payment
}
} catch(Exception $e) {
// invalid request, some parameter missing or invalid signature hash, output 400 Bad Request
}
// all OK, output 202 Accepted
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.