Comments (14)
Just to add a usecase: we have a non-linear per member pricing (so subscription quantity is not an option) and customers constantly add or remove members, so managing it all in the Dashboard would be a full-time job.
from cashier-paddle.
This will be available in today's release. I'll try to add docs soon.
from cashier-paddle.
By no means great with PR's but I mocked up how this could be done by extending the subscription model.
From the API docs it seems we can't update existing modifiers, so I am wondering if the modifier_id
returned should be stored on our DB so it can be deleted if the modifier was to change in the future. Only issue I see with that is you can have multiple modifiers per subscription.
May need to check if the keep_modifiers
option can be set when swapping a plan too, as true by default.
/**
* Add a modifier to the Paddle subscription.
*
* @param int $plan
* @param array $options
* @return $this
*/
public function modifier(array $options = [])
{
$payload = $this->billable->paddleOptions(array_merge([
'subscription_id' => $this->paddle_id,
'modifier_amount' => '10', //Would pass this via $options
'recurring' => 1, //Probably make use of ->recurring()
'modifier_description' => 'Added by Cashier'
], $options));
$response = Cashier::post('/subscription/modifiers/create', $payload)['response'];
$this->paddleInfo = null;
//Ideas for modifier_id response. Maybe should be an array so we can reference to list/delete a modifier?
$this->modifier_id = $response['modifier_id'];
$this->save();
return $response;
}
from cashier-paddle.
The reason we didn't include it in the package is because Paddle already has a full UI in their dashboard to manage these modifiers.
Can you please give some more explanation about your use case, why you'd want to use the API for these and how it would benefit you?
from cashier-paddle.
Hey @driesvints - The original idea was to make use of modifiers with volume based billing. Every level of usage would result in a price modifier being added so we didn't need to create loads of individual plans. I took the idea from their guide.
After a few discussions with Paddle, we decided modifiers would be too messy in the long run. I've setup new plans per (1000 contacts) on my app instead.
I can see some uses for it however if someone wanted to automate a modifier on an existing subscription, rather than their UI.
Happy to close this as ended up not using. For anyone that needs it, the code above should mostly work :)
from cashier-paddle.
No worries. Closing then as there's no direct use case.
from cashier-paddle.
@driesvints I might have use case ...
Our subscription prices keeps on changing so can't keep adding new subscriptions in paddle instead of that if modifier is included in package we can simply change recurring prices
reference /2.0/subscription/modifiers/create
from cashier-paddle.
@pawan1793 what prevents you from using the Paddle dashboard?
from cashier-paddle.
@driesvints in paddle dashboard there is just one plan of $1 ... I'll be modifying plan pricing on my application not on paddle, This way I'll not have to maintain many subscription products.
eg There are 3 plans
Basic - 5$
Gold - 10$
Pro - 15$
for all this plan i'll use subscription product i.e of $1 on paddle and set prices while creating subscription by Overriding Checkout Prices
now if user want to change Gold plan. having modifier will help to add amount on current subscription.
from cashier-paddle.
If you can practically write down what you expect to be present in terms of a public API we could look into it maybe. Is it similar to what the OP wrote above?
from cashier-paddle.
yes
from cashier-paddle.
I'll take a look at this eventually. But feel free to send in a PR in the meantime.
from cashier-paddle.
I'd like to point out when I looked at this, Paddle didn't allow you to update modifiers, so you'd need to store the ID of the one applied and remove if you were to change that amount.
from cashier-paddle.
Yeah we'll need to do that as well.
from cashier-paddle.
Related Issues (20)
- Allow reusing an existing customer through `PerformsCharges::subscribe()` HOT 8
- createAsCustomerIfNotExists HOT 4
- Disable generic trial once customer is subscribed HOT 1
- Fix incrementQuantity() & decrementQuantity() Throwing Error HOT 5
- Notice in the docs about "default checkout URL" HOT 1
- [2.x] add end at of the subscription period HOT 1
- Fix nextPayment() total HOT 1
- returnTo function added to checkout does not redirect HOT 6
- Bill for non-catalog items HOT 4
- Issues with subscriptions "price_id must be a string" HOT 4
- Webhook duplicating the response statuses HOT 8
- Cashier::findBillable($customerId) not returning anythying HOT 2
- Get subscription payment method HOT 1
- Add support for authentication via client-side tokens HOT 1
- Paddle webhook handler doesnt work HOT 3
- Laravel cashier-paddle package conflict with passport Auth Header HOT 1
- Paddle with Passport giving: Authentication header included, but incorrectly formatted HOT 2
- Pausing Subscriptions HOT 1
- Applying a discount on checkout HOT 1
- Problem with billing API - Transaction not created in the db HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cashier-paddle.