Skip to content

Martyn911/payop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PAYOP API WRAPPER

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);