PHP code example of geekk / payselection-payments-php
1. Go to this page and download the library: Download geekk/payselection-payments-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/ */
geekk / payselection-payments-php example snippets
use Geekk\PayselectionPaymentsPhp\Paylink\PaymentRequestData;
use Geekk\PayselectionPaymentsPhp\Paylink\PaymentRequestExtraData;
use Geekk\PayselectionPaymentsPhp\PayselectionApi;
use Geekk\PayselectionPaymentsPhp\SignatureCreator;
use GuzzleHttp\Client;
//...
$paymentRequest = new PaymentRequestData($orderId, $amount, $currency, $description);
$extraData = new PaymentRequestExtraData();
$extraData->setWebhookUrl('https://...');
$extraData->setSuccessUrl('https://...');
$extraData->setDeclineUrl('https://...');
$paymentRequest->setExtraData($extraData);
$paylinkCreator = new PayselectionApi(new Client(), $siteId, new SignatureCreator($secretKey));
$paylinkResult = $paylinkCreator->createPaylink($paymentRequest);
if ($paylinkResult->success()) {
header('Location: ' . $paylinkResult->getPaymentUrl());
exit;
}
echo $paylinkResult->getErrorCode().' '.$paylinkResult->getErrorDescription()
use Geekk\PayselectionPaymentsPhp\Paylink\ReceiptData;
use Geekk\PayselectionPaymentsPhp\Paylink\ReceiptData\ClientData;
use Geekk\PayselectionPaymentsPhp\Paylink\ReceiptData\CompanyData;
use Geekk\PayselectionPaymentsPhp\Paylink\ReceiptData\ItemData;
// ...
$company = new CompanyData('YOUR_INN', 'https://shop-site.net');
$client = new ClientData('[email protected]');
$items = [new ItemData(7.95, 'Some digital goods')];
$receipt = new ReceiptData($company, $client, $items);
$paylinkResult = $paylinkCreator->createPaylink($paymentRequest, $receipt);