Vant Laravel API is a Laravel package for interacting with the Vant API, providing a simple interface for handling payments, transfers, and transactions within a Laravel application.
- Retrieve banks list
- Verify transfer recipients
- Initiate transfers
- Create wallets
- Fetch transaction history
- Verify transactions
- Handle webhooks securely
Run the following command to install the package:
composer require vant/vant-laravelAfter installation, publish the package configuration file:
php artisan vendor:publish --tag=configThis will create a config/vant.php file where you can configure API settings.
Update your .env file with your API credentials:
VANT_API_BASE_URL=https://dev.vantapp.com/api/partner/
VANT_API_KEY=your-api-key
VANT_API_SIGNATURE=your-signatureYou can inject the VantApi service into your controllers or services:
use Vant\VantLaravel\Services\VantApi;
class BankController
{
protected $vantApi;
public function __construct(VantApi $vantApi)
{
$this->vantApi = $vantApi;
}
public function listBanks()
{
return $this->vantApi->getBanks();
}
}Alternatively, you can use the provided Vant facade:
use Vant\VantLaravel\Facades\Vant;
$banks = Vant::getBanks();Vant::getBanks();$data = [
'account_number' => '1234567890',
'bank_code' => '044',
];
Vant::verifyTransferRecipient($data);$data = [
'recipient' => 'recipient_code',
'amount' => 5000,
'currency' => 'NGN',
];
Vant::initiateTransfer($data);$data = [
'user_id' => 12345,
'currency' => 'NGN',
];
Vant::createWallet($data);Vant::allTransactions();Vant::getTransaction('txn_ABC123');$data = [
'amount' => 10000,
'currency' => 'NGN',
'customer' => [
'email' => 'customer@example.com',
],
];
Vant::checkout($data);if (Vant::verifyWebhook()) {
// Process webhook
}All API requests handle exceptions gracefully and return error messages in case of failure.
Feel free to contribute by submitting a pull request or reporting issues.
This package is licensed under the MIT License.