basgate/laravel-sdk is a Laravel package for laravel sdk for bas mini apps platform.
It currently has 2 GitHub stars and 107 downloads on Packagist (latest version v1.0.0).
Install it with composer require basgate/laravel-sdk.
Discover more Laravel packages by basgate
or browse all Laravel packages to compare alternatives.
Last updated
This SDK simplifies integration with the BAS Mini Apps Platform in Laravel applications. It provides convenient services and facades to interact with BAS APIs for authentication, payment, and other functionalities.
Require the package via Composer:
composer require basgate/laravel-sdk
Configure your BAS Credentials:
You must configure your BAS API credentials by adding environment variables to your application's .env file.
Edit your .env file:
Open your Laravel application's .env file and add the following environment variables, replacing the placeholder values with your actual BAS credentials.
BAS_BASE_URL=
BAS_CLIENT_ID=
BAS_CLIENT_SECRET=
BAS_APP_ID=
BAS_MERCHANT_KEY=
BAS_ENVIRONMENT=staging # or production
BAS_CALLBACK_URI=
Environment Variable Descriptions:
BAS_BASE_URL: The base URL for the BAS API platform. This should be set to your Staging or Production API endpoint (e.g., https://api-tst.basgate.com).BAS_CLIENT_ID: Your Mini App's Client ID (App ID) provided by BAS when you register your Mini App.BAS_CLIENT_SECRET: Your Mini App's Client Secret . Keep this secret and do not share it publicly. Provided by BAS.BAS_APP_ID=: Your Mini App ID . Provided by BAS.BAS_MERCHANT_KEY: Merchant Key used to generate checksum/signature for API requests. Provided by BAS.BAS_ENVIRONMENT: The environment your application is running in. Set to staging for development and testing, or production for live environments.Important Security Notes:
BAS_CLIENT_SECRET, BAS_MERCHANT_KEY secret and protected. Do not commit them to public Git repositories or share them insecurely.BAS: For authentication-related functionalities (Login Flow), payment-related functionalities (Payment Flow) , and general BAS service functionalities.**Example
PHP (Controller/Service):
use BAS;
// ... in your controller or service ...
$transactionStatus = BAS::checkTransactionStatus($orderId);
// Send refund request
$trxToken="Yac4bNFV3Yi3CsnMO9mLR4WRcJPPTqjGUFkzMDc0MTU=";
$refund= BAS::refund($trxToken);
// initiate Transaction and generateBasPaymentJS
try {
$transaction = BAS::initiateTransaction($orderId, $amount, $currency);
if (isset($transaction['status']) && $transaction['status'] == 1) {
$paymentJS = BAS::generateBasPaymentJS($transaction['body']['trxToken'], $transaction['body']['order']);
return view('bas::payment', ['paymentJS' => $paymentJS]);
}
http://your_app_url/bas
Steps to prepare the experimental environment on the simulator
Here you should put your system link followed by /bas
try payment