PHP code example of hossammonir / hyperpay

1. Go to this page and download the library: Download hossammonir/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/ */

    

hossammonir / hyperpay example snippets


    use HossamMonir\HyperPay\Facades\HyperPay;
    use HossamMonir\HyperPay\Enums\HyperPayPaymentMethod;
    use HossamMonir\HyperPay\Data\Customer;

        HyperPay::setAmount('100.50') // amount must match ^[0-9]{1,12}(\\.[0-9]{2})?$ 
        ->setMethod(HyperPayPaymentMethod::VISA)
        ->setCurrency('SAR')
        ->setTransactionId('123123123') // your should create unique transaction id for each payment
        ->setCustomer(new Customer(
            givenName: 'Hossam',
            surname: 'Monir',
            mobile: '966500000000',
            email: '[email protected]', // optional
            merchantCustomerId: '123456789', // optional
        ))
        ->basicCheckout();
bash
php artisan vendor:publish --provider="HossamMonir\HyperPay\HyperPayServiceProvider"