PHP code example of deyjandi / laravel-viva-wallet

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

    

deyjandi / laravel-viva-wallet example snippets


...

use Deyjandi\VivaWallet\Facades\VivaWallet;
use Deyjandi\VivaWallet\Payment;

...

$payment = new Payment($amount = 1000);

$checkoutUrl = VivaWallet::createPaymentOrder($payment);

...

...

use Deyjandi\VivaWallet\Enums\RequestLang;
use Deyjandi\VivaWallet\Enums\PaymentMethod;
use Deyjandi\VivaWallet\Facades\VivaWallet;
use Deyjandi\VivaWallet\Customer;
use Deyjandi\VivaWallet\Payment;

...

$customer = new Customer(
    $email = '[email protected]',
    $fullName = 'John Doe',
    $phone = '+306987654321',
    $countryCode = 'GR',
    $requestLang = RequestLang::Greek,
);

$payment = new Payment();

$payment
    ->setAmount(2500)
    ->setCustomerTrns('short description of the items/services being purchased')
    ->setCustomer($customer)
    ->setPaymentTimeout(3600)
    ->setPreauth(false)
    ->setAllowRecurring(true)
    ->setMaxInstallments(3)
    ->setPaymentNotification(true)
    ->setTipAmount(250)
    ->setDisableExactAmount(false)
    ->setDisableCash(true)
    ->setDisableWallet(false)
    ->setSourceCode(1234)
    ->setMerchantTrns('customer order reference number')
    ->setTags(['tag-1', 'tag-2'])
    ->setBrandColor('009688')
    ->setPreselectedPaymentMethod(PaymentMethod::PayPal);

$checkoutUrl = VivaWallet::createPaymentOrder($payment);

...

...

use Deyjandi\VivaWallet\Facades\VivaWallet;

...

$transaction = VivaWallet::retrieveTransaction($transactionId);

bash
php artisan vendor:publish --tag="viva-wallet-config"
zsh
php artisan viva-wallet:webhook-key