PHP code example of abdallhsamy / laravel-hyperpay
1. Go to this page and download the library: Download abdallhsamy/laravel-hyperpay 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/ */
abdallhsamy / laravel-hyperpay example snippets
use Hyn\Tenancy\Traits\UsesTenantConnection;
use Abdallhsamy\LaravelHyperpay\Models\Transaction as ModelsTransaction;
class Transaction extends ModelsTransaction
{
use UsesTenantConnection;
}
use Abdallhsamy\LaravelHyperpay\Traits\ManageUserTransactions;
class User extends Authenticatable
{
use ManageUserTransactions;
}
use Abdallhsamy\LaravelHyperpay\Facades\LaravelHyperpay;
class PaymentController extends Controller
{
public function prepareCheckout(Request $request)
{
$trackable = [
'product_id'=> 'bc842310-371f-49d1-b479-ad4b387f6630',
'product_type' => 't-shirt'
];
$user = User::first();
$amount = 10;
$brand = 'VISA' // MASTER OR MADA
return LaravelHyperpay::checkout($trackable_data, $user, $amount, $brand, $request);
}
}
use Abdallhsamy\LaravelHyperpay\Facades\LaravelHyperpay;
use App\Billing\HyperPayBilling
LaravelHyperpay::addBilling(new HyperPayBilling())->checkout($trackable_data, $user, $amount, $brand, $request);