PHP code example of wameed / urway-payment-gateway

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

    

wameed / urway-payment-gateway example snippets


return [
    'auth' => [
        'terminal_id' => env('URWAY_TERMINAL_ID'),
        'password' => env('URWAY_PASSWORD'),
        'merchant_key' => env('URWAY_MERCHANT_KEY'),
    ],
    'url'=>[
        //change 'payments-dev.urway-tech' to 'payments.urway-tech' when you are ready to go live
        'base'=>env('URWAY_BASE_URL','https://payments-dev.urway-tech.com'),
        'payment'=>env('URWAY_PAYMENT_URL','URWAYPGService/transaction/jsonProcess/JSONrequest'),
    ]
];


  $urway = new Urway();

  $urway->setTrackId($trackID)
        ->setAmount($total_after_cal_tax)
        ->setCurrency('SAR')
        ->setCountry('SA')
        ->setAttribute('udf1', 'udf1')
        ->setPaymentPageLanguage('ar')
        ->setAttribute('udf4', 'udf4')
        ->setAttribute('udf5', 'udf5')
        ->setCustomerEmail($request->email)
        ->setRedirectUrl(route('user.payment.verify'));

  $response = $urway->pay();

  $payment_url = $response->getPaymentUrl();

        $urway = new Urway();

        $urway->setTrackId(request('TrackId'))
            ->setAmount(request('amount'))
            ->setCurrency('SAR');

        $redirect_url = $urway->verify(request('TranId'));

        return $redirect_url->body();