Im starting using LARAVEL last version 7.12 and I'm having an issue trying to integrate CHARGEBEE library to make request to Chargebee api.
I was reading that I can install packages with composer, I did it:
composer require chargebee/chargebee-php:'>=2, <3'
Doing that now I have downloaded chargebee lib here: /vendor/chargebee/chargebee-php/
Now also I saw This stack overflow question here:
That for the user to correctly use this Library-Package I need to create a ServiceProvider
so I did:
php artisan make:provider ChargeBeeServiceProvider
then I really don't know how to write the REGISTER()
function here, I added also this line: App\Providers\ChargebeeServiceProvider::class,
to /config/app.php
to 'providers'
Right now I have a controller: /app/http/controllers/PortalController
and I'm trying to use this:
ChargeBee_Environment::configure("sitename","apikeyvalue");
$all = ChargeBee_Customer::all(array( "firstName[is]" => "John",
"lastName[is]" => "Doe", "email[is]" => "john@test.com" ));
foreach($all as $entry){
$customer = $entry->customer();
$card = $entry->card();
}
BUT on the frontend it's giving me an error:
Error Class 'App\Http\Controllers\ChargeBee_Customer' not found
Not really sure how i can use this custom Chargebee library here on Laravel.
can somebody please help to integrate in the correct way ?
Thanks!