renoki-co / cashier-register Goto Github PK
View Code? Open in Web Editor NEWCashier Register is a simple quota feature usage tracker for Laravel Cashier subscriptions.
License: Apache License 2.0
Cashier Register is a simple quota feature usage tracker for Laravel Cashier subscriptions.
License: Apache License 2.0
Laravel: 8.44
Cashier Register: 5.02
Cashier / Stripe: 12.14
When laravel cashier registers Multiplan Subscriptions it wipes stripe_id from subscriptions
table PR#1048
CashierRegister relies on that value to identify registered Saas plan and as a result, recordFeatureUsage
fails because getPlan() returns null
I have a situation that all my models need to extend
Jenssegers\Mongodb\Eloquent\Model
because I am using MongoDB.
I set the configuration file to use my models:
'models' => [
'usage' => \App\Entities\App\Subscription\Usage::class,
],
The issue is my model can't extend RenokiCo\CashierRegister\Models
, and for that reason, I can exceptions like this one when resetting quotas.
TypeError: Argument 1 passed to App\Entities\App\Subscription\Subscription::RenokiCo\CashierRegister\Concerns\{closure}() must be an instance of RenokiCo\CashierRegister\Models\Usage, instance of App\Entities\App\Subscription\Usage given, called in /var/www/saas-starter/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php on line 230
Reason Is the package has a type check and expect models to extend RenokiCo\CashierRegister\Models
. As I explained in some cases we do not want to use Eloquent, so I want to propose a change that instead of type check for models, we add Contracts (interfaces), and type check interfaces, which would make it more flexible.
I would like to hear other opinions first, and I can propose PR when we make a plan.
cc @rennokki
Thanks for the package, can you merge the paddle branch?
When installing on a fresh Laravel 8 / JetStream 2 :
composer require renoki-co/jetstream-cashier-billing-portal
Using version ^1.2 for renoki-co/jetstream-cashier-billing-portal
./composer.json has been updated
Running composer update renoki-co/jetstream-cashier-billing-portal
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- renoki-co/jetstream-cashier-billing-portal[1.2.0, ..., 1.2.1] require renoki-co/cashier-register ^3.4.0 -> satisfiable by renoki-co/cashier-register[3.4.0, 3.4.1].
- renoki-co/cashier-register[3.4.0, ..., 3.4.1] require doctrine/dbal ^2.9 -> found doctrine/dbal[v2.9.0, ..., 2.12.x-dev] but it conflicts with your root composer.json require (^3.0).
- Root composer.json requires renoki-co/jetstream-cashier-billing-portal ^1.2 -> satisfiable by renoki-co/jetstream-cashier-billing-portal[1.2.0, 1.2.1].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Could we get a PR to fix this, because currently, it's returning the free plan even if the user has another plan due to a mixup of table names?
Hi, just found out this awesome package but i was wondering if it can decrease the feature usage. For example I have a plan which limit user to create up to 5 photos. I can count them up as the docs say by use $subscription->recordFeatureUsage(1)
everytime user create a new photo. But if they remove photo should we release the slot so they can use up again?
Perhaps a silly question with an obvious answer:
When I am syncing metered feature use, that is resettable within each billing period, I should account for that in the closure, correct? Something along those lines:
Saas::syncFeatureUsage('minutes', function ($subscription, Feature $feature) {
return $subscription->billable->minutes()->withinCurrentBillingPeriod()->count();
});
Is there a way to pass in the period boundaries to the scope?
Laravel 8 throws an error when I try to require doctrine/dbal:^3.0
Not a problem to for me to require is as ^2.9, but I checked the migrations folder... why is there a dbal dependency anyway?
Hi, just came across this package, when i'm installing it apart from failing in dependencies cashier now has useSubscriptionModel witch makes BillableWithXXX redundant and they changed to polymorfic relations. Be nice to have it in a future update
Hi,
Great package as usual, any plan to support laravel 8, try to give it a shot and not work ?
Keep on the great work !!
Best,
used & used_total get incremented correctly with
$subscription->recordFeatureUsage('feature', 100)
however, once qouta is reached 'used' stops incrementing (which might be expected since there is an overflow handler), but 'used_total' increments x2
steps to replicate,
cold run:
definition
$subscription->recordFeatureUsage('mails', 100); // used = 100, used_total = 100
$subscription->recordFeatureUsage('mails', 100); // used = 200, used_total = 200
$subscription->recordFeatureUsage('mails', 100); // used = 300, used_total = 300
$subscription->recordFeatureUsage('mails', 100); // used = 300, used_total = 500
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.