1. Go to this page and download the library: Download ovri/payment 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/ */
ovri / payment example snippets
= new Ovri\Payment([
'MerchantKey' => '<your-merchant-key>',
'SecretKey' => '<your-secret-key>',
'API' => 'https://api.ovri.app'
]);
$data = [
'amount' => '<amount-transaction>',
'RefOrder' => '<your-reference-order-id>',
'Customer_Email' => '<customer-email>',
'Customer_Name' => '<customer-lastname>',
'Customer_FirstName' => '<customer-firstname>'
];
$reponse = $Ovri->initializePayment($data);
//201 success request (others code = failed)
if ($reponse['http'] === 201) {
//Code is internal Ovri coding (200 success others is failed)
if ($reponse['Code'] === 200) {
//Either you redirect the customer to the WEB payment url
header('Location: ' . $reponse['DirectLinkIs']);
//Or you just get the token to initiate one of our JS SDK libraries
//@token is $reponse['SACS']
}
} else {
//Error and display result
foreach ($reponse as $key => $value) {
//If key Explanation or MissingParameters array for explain error
if ($key === 'Explanation' || $key === 'MissingParameters') {
echo "<b>$key</b> => " . print_r($value, TRUE) . "<br>";
} else {
echo "<b>$key</b> => $value <br>";
}
}
}