1. Go to this page and download the library: Download ttrig/laravel-billmate 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/ */
use Ttrig\Billmate\Article as BillmateArticle;
use Ttrig\Billmate\Service as BillmateService;
class CheckoutController extends Controller
{
public function index(BillmateService $billmate)
{
$articles = collect()->push(new BillmateArticle([
'title' => '1kg potatoes',
'price' => 30,
]));
$checkout = $billmate->initCheckout($articles);
return view('checkout', compact('checkout'));
}
}
$billmate->initCheckout($articles, function (&$data) {
data_set($data, 'PaymentData.autoactivate', '1');
});
use Ttrig\Billmate\Order as BillmateOrder;
use Ttrig\Billmate\Service as BillmateService;
class YourRedirectController extends Controller
{
public function accept(BillmateService $billmate)
{
$order = new BillmateOrder(request()->data);
$paymentInfo = $billmate->getPaymentInfo($order);
return view('payment.accept');
}
public function cancel()
{
return view('payment.cancel');
}
}