1. Go to this page and download the library: Download devmohy/laravel-budpay 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/ */
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Redirect;
use Budpay;
class PaymentController extends Controller
{
/**
* Redirect the User to Budpay Payment Page
* @return Url
*/
public function redirectToGateway()
{
try{
return Budpay::getAuthorizationUrl()->redirectNow();
}catch(\Exception $e) {
return Redirect::back()->withMessage(['msg'=>'The budpay token has expired. Please refresh the page and try again.', 'type'=>'error']);
}
}
/**
* Obtain Budpay payment information
* @return void
*/
public function handleGatewayCallback()
{
$paymentDetails = Budpay::getPaymentData();
dd($paymentDetails);
// Now you have the payment details,
// you can then redirect or do whatever you want
}
}
/*
* This convenient method handles the behind-the-scenes tasks of sending a POST request with the * form data to the Budpay API. It takes care of all the necessary steps, including obtaining
* the authorization URL and redirecting the user to the Budpay Payment Page. We've abstracted
* away all the complexities, allowing you to focus on your coding tasks without worrying about * these implementation details. So go ahead, enjoy your coding journey while we handle the rest!
*/
Budpay::getAuthorizationUrl()->redirectNow();
/**
* This method gets all the transactions that have occurred
* @returns array
*/
Budpay::getAllTransactions();
/**
* This method Initiate a payment request using Budpay Standard Checkout
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::standardCheckout();
/**
* This method Initiate a payment request using Budpay Server To Server Bank Transfer Checkout
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::serverToServerBankTransferCheckout();
/**
* This method Initiate a payment request to Budpay using server to server v2
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::serverToServerV2();
/**
* This method Fetch transaction using transaction ID
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::fetchTransaction();
/**
* Initiate a payment request to Budpay
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::requestPayment();
/**
* This method Create customer on budpay
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::createCustomer();
/**
* This method Create a dedicated virtual account and assign to a customer
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::createDedicatedVirtualAccount();
/**
* This method List dedicated virtual accounts
* @returns array
*/
Budpay::listDedicatedVirtualAccount();
/**
* This method Fetch Dedicated Virtual Account By ID
* @returns array
*/
Budpay::fetchDedicatedVirtualAccountById();
/**
* This method Create Payment Link
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::createPaymentLink();
/**
* This method Fetch Settlements
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::getSettlements();
/**
* This method Fetch Settlements By Batch ID
* @returns array
*/
Budpay::getSettlementsByBatch();
/**
* This method Create Refund
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::createRefund();
/**
* This method Fetch Refunds
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::listRefunds();
/**
* This method Fetch refund by Reference
* @returns array
*/
Budpay::fetchRefund();
/**
* This method Fetch Banks
* @returns array
*/
Budpay::bankLists();
/**
* This method Initiate Transfer
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::singlePayout();
/**
* This method Initiate Bulk Transfer
* "currency": "NGN",
* "transfers": [
* {
* "amount": "200",
* "bank_code": "000013",
* "bank_name": "GUARANTY TRUST BANK",
* "account_number": "0050883605",
* "narration": "January Salary"
* },
* {
* "amount": "100",
* "bank_code": "000013",
* "bank_name": "GUARANTY TRUST BANK",
* "account_number": "0050883605",
* "narration": "February Salary"
* },
* ]
* @returns array
*/
Budpay::bulkPayout(
["currency" => "NGN",
"transfers" => [
{
"amount" => "200",
"bank_code" => "000013",
"bank_name" => "GUARANTY TRUST BANK",
"account_number" => "0050883605",
"narration" => "January Salary"
},
{
"amount" => "100",
"bank_code" => "000013",
"bank_name" => "GUARANTY TRUST BANK",
"account_number" => "0050883605",
"narration" => "February Salary"
},
{
"amount" => "100",
"bank_code" => "000013",
"bank_name" => "GUARANTY TRUST BANK",
"account_number" => "0050883605",
"narration" => "March Salary"
}
]]
);
/**
* This method Fetch a payout record using payout reference.
* @param $ref
* @returns array
*/
Budpay::verifyPayout($ref);
/**
* This method return Payout Fee (Bank Transfer Fee)
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::payoutFee();
/**
* This method return Wallet balance by Currency
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::walletBalance();
/**
* This Wallet transactions method allows you fetch all your wallet transaction history.
* @returns array
*/
Budpay::walletTransactions();
/**
* This method Fetch all available Airtime Providers
* @returns array
*/
Budpay::airtimeProviders();
/**
* This method Buy Airtime
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::airtimeTopUp();
/**
* This method FFetch all available Internet Providers.
* @returns array
*/
Budpay::internetProviders();
/**
* This method Get all available Internet Data Plans
* @returns array
*/
Budpay::internetDataPlans();
/**
* This method Initiate a Internet Data Purchase Transaction
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::internetDataPurchase();
/**
* This method Get all available Tv Packages (Bouquet) of a Provider
* @returns array
*/
Budpay::tvProviders();
/**
* This method Get all available Tv Packages (Bouquet) of a Provider
* @param string $provider
* @returns array
*/
Budpay::tvProviderPackages();
/**
* This method Perform a Tv UIC Number Validation
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::tvValidate();
/**
* This method Initiate a Tv Subscription Payment
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::tvSubscription();
/**
* This method Get all available Electricity Providers
* @returns array
*/
Budpay::electricityProviders();
/**
* This method Perform a Electricity Meter Number Validation
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::electricityValidate();
/**
* This method Initiate a Electricity Recharge Payment
* Included the option to pass the payload to this method for situations
* when the payload is built on the fly (not passed to the controller from a view)
* @returns array
*/
Budpay::electricityRecharge();