PHP
PHP copied to clipboard
Undefined constant Flutterwave\Config\PackageConfig::BASE_URL
Description
When attempting to verify a transaction using the verifyWithTxref() method in the flutterwavedev/flutterwave-v3 package, an error occurs indicating "Undefined constant Flutterwave\Config\PackageConfig::BASE_URL". This issue arises during the initialization of the Transactions service.
Steps to Reproduce
-
Initialize the Transactions service with the appropriate configuration using the following code:
$transaction = new \Flutterwave\Service\Transactions( PackageConfig::setUp( ……, ……, ……, ) ); -
Attempt to verify the transaction using the
verifyWithTxref($id)method.
Expected behaviour
The Transactions service should initialize successfully.
Actual behaviour
The error "Undefined constant Flutterwave\Config\PackageConfig::BASE_URL" occurs during the initialization of the Transactions service, specifically in the constructor at line 34: $this->baseUrl = $this->config::BASE_URL.
Configuration
- API Version: v3
- Environment: live
- Language: PHP 8.1 | Laravel 10.10
Additional Information
The issue seems to stem from the constructor of the \Flutterwave\Service\Transactions class. The line $this->baseUrl = $this->config::BASE_URL attempts to access the constant BASE_URL from PackageConfig, resulting in an undefined constant error.