PHP code example of barstec / laravel-cashbill

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

    

barstec / laravel-cashbill example snippets




namespace App\Http\Controllers;

use Barstec\Cashbill\Payload;
use Barstec\Cashbill\Payment;
use Barstec\Cashbill\PersonalData;

class CashbillExample extends Controller
{
    public function handle()
    {
        $payload = new Payload();
        $payload->setTitle("Example title");
        $payload->setAmount(9.5);

        $personalData = new PersonalData();
        $personalData->setEmail("[email protected]");
        $personalData->setFirstName("Name");
        $personalData->setSurname("Surname");
        $payload->setPersonalData($personalData);

        $payment = new Payment($payload);
        return $payment->redirect();
    }
}

protected $listen = [
    TransactionCreated::class => [
        ExampleListener::class
    ]
];


$order = new Order($orderId);
$paymentDetails = $order->update();
bash
  php artisan vendor:publish --provider="Barstec\Cashbill\CashbillServiceProvider"
bash
  php artisan migrate