PHP code example of skytech / payment-php-sdk
1. Go to this page and download the library: Download skytech/payment-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/ */
skytech / payment-php-sdk example snippets
$order = new \Skytech\Sdk\Order();
$order->setAmount(100);
$order->setCurrency(643); //Russian rubles. ISO 4217 numeric-3
$order->setDescription("Test description");
$merchant = new \Skytech\Sdk\Merchant();
$merchant->setLanguage('RU'); // ISO 639-1
$merchant->setMerchantId("ES000000");
$merchant->setApproveUrl($approveUrl);
$merchant->setCancelUrl($cancelUrl);
$merchant->setDeclineUrl($declineUrl);
$address = new \Skytech\Sdk\Customer\Address();
$address->setCountry(643); // ISO 3166-1 numeric
$address->setRegion("Moscow");
$address->setCity("Moscow");
$address->setAddressline("evergreen street");
$address->setZip("123123");
$customer = new \Skytech\Sdk\Customer($address);
$customer->setEmail($email);
$customer->setPhone($phone);
$customer->setIp($clientIp);
$connector = new \Skytech\Sdk\Connector();
$connector->setCert('C:\Payment_php_sdk\test.pem', ''); // Path to the client certificate
$payment = new \Skytech\Sdk\Payment($order, $merchant, $customer, $connector);
try {
$response = $payment->purchase();
} catch (Exception $e) {
echo $e->getMessage();
}
$url = $response->getPaymentUrl(); // Redirect client to payment page by this url
header('Location: ' . $url);
bash
composer