PHP code example of abdallahmohammed / urway-laravel
1. Go to this page and download the library: Download abdallahmohammed/urway-laravel 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/ */
use URWay\Client;
// Create clint instance.
$client = new Client();
$client->setTrackId('YOUR_TRAKING_ID')
->setCustomerEmail('...')
->setCustomerIp('...')
->setCurrency('USD')
->setCountry('EG')
->setAmount(5)
->setRedirectUrl('...');
// Replace presented attributes with the given array.
$client->setAttributes([
'...' => '...'
]);
// Merge presented attributes the given array.
$client->mergeAttributes([
'...' => '...'
]);
// Replace one of presented attributes with the new value.
$client->setAttribute('...', '...');
// Remove one of attributes.
$client->removeAttribute('...');
// Determine whether an attribute exists.
$client->hasAttribute('...'); // returns boolean (true, or false)
$redirect_url = $client->pay();
return redirect()->url($redirect_url);
use URWay\Client;
// Create clint instance.
$client = new Client();
$response = $client->find('TRANSACTION_ID');
if ($response->isSuccess()) {
//
}
if ($response->isFailure()) {
//
}
// To dump all payment details.
dd($response);