Welcome to Ozan Pay PHP SDK. This repository contains Ozan Pay's PHP SDK.
PHP 5.3 and above.
If you have any questions, please create an issue on Github or contact us at [email protected].
You can install the sdk via Composer. Run the following command:
composer require ozanlimited/ozanpay-php-sdk
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
try {
$ozan = new Ozan\Ozan([
'api_key' => 'OZAN-MERCHANT-API-KEY',
'secret_key' => 'OZAN-MERCHANT-SECRET-KEY',
'is_live' => false,
]);
$request = new PaymentRequest();
$request->setCheckoutToken('tlqUxDrGeSaCPaC+Dt/+dBZMdwqe8uZOWnqnVcShUCmPL0kOffEYSf5y91ltG8CxCO83wvHAcbBDdYldisyjzCSzjINXHk4fvaPHyAtMx9w=');
$request->setAmount(123.45);
$request->setCurrency('GBP');
$paymentResponse = $ozan->createPayment($request);
$payment = $paymentResponse->getPayment();
echo 'Payment id: ' . $payment->getPaymentId();
echo 'Payment status: ' . $payment->getStatus();
} catch (OzanResponseException $e) {
// When Ozan API returns an error
echo 'Ozan API returned an error: ' . $e->getErrorDescription();
echo 'Ozan error code: ' . $e->getErrorCode();
exit;
}