Skip to content

browner12/billing

Repository files navigation

billing

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Note: Replace Andrew Brown browner12 `````` browner12@gmail.com ```browner12``` ```billing``` ```accept payments``` with their correct values in README.md, CHANGELOG.md, CONTRIBUTING.md, LICENSE.md and composer.json files, then delete this line.

This is a billing package. It abstracts the implementation allowing you to quickly setup billing using your preferred provided. Please note that currently only the Stripe implementation is available.

Install

Via Composer

$ composer require browner12/billing

Setup

Add the service provider to the providers array in config/app.php.

'providers' => [
    browner12\billing\BillingServiceProvider::class,
];

Publishing

You can publish everything at once

php artisan vendor:publish --provider="browner12\billing\HelperServiceProvider"

or you can publish groups individually.

php artisan vendor:publish --provider="browner12\billing\HelperServiceProvider" --tag="config"

Usage

Make sure you start by updating your new billing.php config file. You must select a provider, and set the API key. Your API key should most likely use an environment variable.

Next you will want to instantiate the biller with dependency injection.

public function __construct(BillingInterface $biller)
{
    //assign
    $this->biller = $biller;
}

To create a charge call the charge method.

$this->biller->charge(2199, $token, 'description of the charge');

The $token will come from your service provider. The token allows you to prevent any payment details from ever touching your server.

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email browner12@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Releases

No releases published

Packages

No packages published

Languages