← Back to Cumulus subscriptions Support
I am not seeing any documentation on how to actually implement payments. Does your plugin integrate with any payment processors? Am I supposed to use events to fire my own routines to collect payment? If so, what are those events, and how do I report back the success/failure of payments? HOW DOES THIS WORK?!
I want a monthly plan that auto-renews. How do I do this? I would think that maybe I create a Monthly plan, set it to expire in 1 month, then switch to the same plan after expiry. Plan editor does not let me select the same plan. How do I do this?
Docs incomplete. Your documentation leaves off with... "...so for the half of the year, it’s $50 still left to pay (see PriceCalculator section below)."
There is no section on PriceCalculator.
- A few months ago I inquired about having different permission levels within a cluster (ie. Cluster admin vs Cluster user). Is this still in the works? Do you have an ETA?
Thanks for your response!
Thanks for using our plugin and sorry for the problems you have encountered.
- Unfortunately, the payments have to be integrated on your own up to this time.
PriceCalculatoris meant to calculate the price of the subscription while
markAsPaid()method in the
Subscriptionmodel is meant to be run after ensuring the payment went well. It would be great if you share any ideas on how to make it more convenient.
- If you want the subscription to be renewed every month then you have to ensure that the payment was successful every month. After setting the expiring period on the plan to 1 month you can use
prolongate()method on the subscription. This will automatically add 1 month to the current expiration date. The
plan after expiryis meant to be changed automatically when payment was not successful. The subscription expired -> let's change the plan. As simple as that.
- You are perfectly right! Sorry about that. The truth is, we wanted to write documentation about that but, although it sounds funny, we have decided to write very complete documentation in the classes (the documentation in code :) ). The only thing we are missing here is autogenerated API docs. Still, we believe that in most IDEs docs from PHP Docs are suggested so we decided to drop the chapter.
- And I believe I have promised you that I will come with something by the end of '19? Again, sorry about that, my job queue has overflowed in December and my TODO list is enormous. I have a living MVP that's being tested in one of my production apps so it's not that far from being live product but so far it requires a lot of work to become fully featured plugin. If you are in a hurry and would like to see it faster - let me know, I will make my best to reorder my TODO list.
Thank you for your interest,
Thank you for the quick response, however I am still at a loss as to the best way to handle payments. I can think of a number of ways I could wedge something in to make it work, but surely you had a specific method in mind.
Does the subscriptions plugin create an order for each new subscription as well as subscriptions that need to be renewed? Is there an event that gets fired for each expiring subscription or do I need to create my own scheduled events to identify the subscriptions that are due for renewal by walking all the models? Do you use this plugin yourself with any paid service, and if so, how do YOU handle payments.
Here is one example that would seem logical to me...
- CumulusSubscriptions determines all subs that are due for renewal today and at the scheduled time creates an order for each one, then fires an event passing a collection of orders.
- I code an event handler that iterates through the collection of orders passing through my payment processor then invoke the Orders model's markAsPaid method which then appropriately marks the order and automatically extends the subscription (based on the defined expiry period (ie. 1 month). *Note it would be good to be able to have a method to register a failed payment as well
I see there is a lot of information that should be added to the docs. I am very grateful for your questions. I'll try to answer them here and in the future move the answers to the docs. If anything won't be clear after reading them, don't hesitate to ask more. It will definitely help other users.
Daily at 1:00 (right now it's hardcoded)
SubscriptionsOperator::processExpiredSubscriptions() is run. Its job is to automatically change the plans for subscriptions that have expired. It also fires
initbiz.cumulussubscriptions.beforeProcessingExpiredSubscriptions event with
&$expiredSubscriptions parameter before running any logic.
When it comes to orders, they are not created automatically. The plugin gives you three components:
I will describe a typical use case and try to present a solution for your automatic monthly renewing subscriptions.
Typical use case
- Embed the
CreateOrdercomponent on the page that's going to be used by clusters to create new orders.
- Embed the
SubscriptionManagecomponent on your cluster's settings page and select page where the
CreateOrdercomponent is embedded. The
SubscriptionManagecomponent displays information about the current cluster's subscription and allows clusters to show upgrade or prolonging information for their subscription (depending on the current plan).
SubscriptionManage is redirecting to the create-order page (using the
createOrderPage property) with query string built for redirection. The
CreateOrder component uses the parameters from the query string to display offer - "how much will that cost to prolongate or upgrade from your current plan to the one you have selected". After confirmation, the order is created, the order's id is stored in the current session as
initbiz.cumulussubscriptions.order_id and it's redirected to the payment page using the
When it comes to autoconfirmation about the payment status you have to create your own logic in your own
routes.php that will use something like that:
$order = Order::find($orderIdFromService); $order->markAsPaid(); $order->apply(); $order->save();
Appling the order means upgrading or prolonging the subscription basing on the order details.
Auto-renewing subscription monthly
Bind to the
initbiz.cumulussubscriptions.findExpiringSubscriptions event. It's run daily at 10 am. Right now it's hardcoded. In your handler find subscriptions that expire in, for example, one day:
$expiringSubscriptions = Subscription::active()->endingInExactly(1)->get();
For every subscription create orders:
$order = Order::ofProlongatePlan($expiringSubscription); $order->save();
And if payment went well you can run:
$order->markAsPaid(); $order->apply(); $order->save();
Order model you have two
additional_data. You can use them to store pretty much everything that concerns the statuses of the payments.
I hope you're satisfied with the support and plugins. Waiting for your feedback!
Exactly what I was looking for. Thank you!
hi, is this now well documented? Meaning to add payment handling? I am considering purchasing cumulus for my sass solutions but need help and documentation to handle the payment (probably stripe subscriptions) so I am wondering if there is an updated documentation for this? thank youi
1-6 of 6