martyn911/payop

Payop API Wrapper

v1.0.1 2019-02-18 21:15 UTC

This package is not auto-updated.

Last update: 2024-04-24 23:41:13 UTC


README

Include base class


require_once 'Payop.php';
const PAYOK_PUBLIC = 'public_key';
const PAYOK_SECRET = 'secret_key';

Init payment


// Order params
$params['order']['id'] = 1;
$params['order']['amount'] = '2.0000';
$params['order']['currency'] = 'UAH';
$params['order']['description'] = 'test payment';
$params['customer']['email'] = 'test@mail.ua';
$params['resultUrl'] = 'https://site.ua/success.html';
$params['failUrl'] = 'https://site.ua/error.html';

$payop = new Payop(PAYOK_PUBLIC, PAYOK_SECRET);

header("Location: " . $payop->createPayment($params));

Handle response


$payop = new Payop(PAYOK_PUBLIC, PAYOK_SECRET);

$response = $payop->paymentHandler();

if($response->status == Payop::STATUS_WAIT){
    //wait
}

if($response->status == Payop::STATUS_SUCCESS){
    //success
}

if($response->status == Payop::STATUS_ERROR){
    //error
}

print_r($response);