1. Go to this page and download the library: Download devinweb/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/ */
devinweb / laravel-hyperpay example snippets
use Hyn\Tenancy\Traits\UsesTenantConnection;
use Devinweb\LaravelHyperpay\Models\Transaction as ModelsTransaction;
class Transaction extends ModelsTransaction
{
use UsesTenantConnection;
}
use Devinweb\LaravelHyperpay\Traits\ManageUserTransactions;
class User extends Authenticatable
{
use ManageUserTransactions;
}
use Devinweb\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 Devinweb\LaravelHyperpay\Facades\LaravelHyperpay;
use App\Billing\HyperPayBilling
LaravelHyperpay::addBilling(new HyperPayBilling())->checkout($trackable_data, $user, $amount, $brand, $request);