Requirements • PHP >= 8.1
• Composer
• Laravel >= 8.0
Installation
composer require tda/laravel-billwerk
Inside Laravel:
use Tda\LaravelBillwerk\Billwerk;
originally the keys are read from config in 'services.billwerk' as:
('services.billwerk.client_id'),
('services.billwerk.client_secret'),
It is possible to send the credentials also, e.g.:
Billwerk::credentials($client, $secret);
You can set on sandbox
Billwerk::isSandbox();
All features use same layout as the API https://swagger.billwerk.io
Following the API pattern, uses the GET, POST, PATCH, PUT and DELETE as method
$customer = Billwerk::customers()->get();
with parameters in path
$customer = Billwerk::customers($id)->get();
with parameters in query
$customer = Billwerk::customers()->filter(['search' => 'Max'])->get();
$customer = Billwerk::customers()->post([
"FirstName": "Marcellus",
"LastName": "Wallace",
"Language": "en-US",
"EmailAddress": "marcellus@example.com"
]);
$customer = Billwerk::customers()->patch([
"FirstName": "Antonius",
]);
$customer = Billwerk::customers()->put([
"FirstName": "Glaucius",
"LastName": "Caeser",
"Language": "it-IT",
"EmailAddress": "glaucius@example.com"
]);
$customer = Billwerk::customers($id)->delete();
You can check all methods in
tda/laravel-billwerk/Trait/Endpoints
It is possible see the return when it fails
if(Billwerk::isFailed()) {
dd(Billwerk::showError());
}