asciisd / cashier-tap
Asciisd Cashier provides an expressive, fluent interface to Tap's subscription billing services.
Installs: 153
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 2
Language:Blade
Requires
- php: ^8.3
- ext-intl: *
- asciisd/tap-php: ^2.0
- dompdf/dompdf: ^2.0
- moneyphp/money: ^4.0
Requires (Dev)
- ext-json: *
- laravel/framework: ^10.0|^11.0
- mockery/mockery: ^1.0
- orchestra/testbench: ^8.18|^9.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.4
Suggests
- ext-intl: Allows for more locales besides the default "en" when formatting money values.
README
Introduction
Laravel Cashier-tap provides an expressive, fluent interface to Tap's company subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading writing. In addition to basic subscription management, Cashier can handle coupons, swapping subscription, subscription "quantities", cancellation grace periods, and even generate invoice PDFs.
Installation
1- Run composer required command:
You can install the bindings via Composer. Run the following command:
composer require asciisd/cashier-tap
2- Run install command:
this command will install ServiceProvider
, Configs
and views
php artisan cashier:install
3- Run publish command:
this command will knet assets
php artisan cashier:publish
4- Run migration command:
table by run the migrations:
php artisan migrate
5- Add .env
parameters
TAP_API_KEY= TAP_WEBHOOK_SECRET= //use this key if you want tap to post the result back to your application
Using this package
not yet finished, you can use this package as following example:-
add Billable
trait to the User model
namespace App; use Illuminate\Foundation\Auth\User as Authenticatable; use Asciisd\Cashier\Billable; class User extends Authenticatable { use Billable; }
use pay() method
try{ //allowed payment methods is ['src_kw.knet', 'src_all', 'src_card'] $payment_method = 'src_card'; $payment = $user->charge(10, $payment_method); $payment->url; // this will return payment link } catch(\Asciisd\Cashier\Exceptions\PaymentActionRequired $exception) { $payment = $exception->payment; } return $payment->actionUrl();
After finished the payment you will redirect to /tap/receipt you can change that from config file to make your own handler, so please make sure to add this directory to the VerifyCsrfToken $except also if you want to use webhook you should add tap/webhook also to the VerifyCsrfToken $except method
Test cards
Contributing
Thank you for considering contributing to Cashier!
License
Laravel Cashier-tap is open-sourced software licensed under the MIT license.