/laravel-billwerk

Billwerk package

Primary LanguagePHPMIT LicenseMIT

laravel-resellerinterface

Requirements • PHP >= 8.1

• Composer

• Laravel >= 8.0

Installation

composer require tda/laravel-billwerk

Usage

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();

Features

All features use same layout as the API https://swagger.billwerk.io

Methods

Following the API pattern, uses the GET, POST, PATCH, PUT and DELETE as method

GET

$customer = Billwerk::customers()->get();

with parameters in path

$customer = Billwerk::customers($id)->get();

with parameters in query

$customer = Billwerk::customers()->filter(['search' => 'Max'])->get();

POST

$customer = Billwerk::customers()->post([
    "FirstName": "Marcellus",
    "LastName": "Wallace",
    "Language": "en-US",
    "EmailAddress": "marcellus@example.com"
    ]);

PATCH

$customer = Billwerk::customers()->patch([
    "FirstName": "Antonius",
    ]);

PUT

$customer = Billwerk::customers()->put([
    "FirstName": "Glaucius",
    "LastName": "Caeser",
    "Language": "it-IT",
    "EmailAddress": "glaucius@example.com"
    ]);

DELETE

$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());
}