0

I've implemented a simple Views-based interface for upgrading and downgrading subscription plans in my Drupal Commerce store. The plans are powered by Commerce License and Commerce License Billing. I've implemented a custom license type in order to provide the option of metered billing.

I'm noticing that the default behavior of changing the plan ($license->product_id) is simply to change it and update the due amount on the next prepayment. However, it doesn't charge for the upgraded plan for the rest of the billing cycle right away. Is this something I can tell the license or the billing cycle to do, or is it something I have to handle on my own? If so, how can I properly calculate the prorated amount to charge?

The question is basically the same re. refunds, and I assume that once I know how to calculate a charge, I'd simply process a refund if the amount was negative. I guess I would have to refund some of the most recent payment...I'd actually prefer to give them a discount on their next order, but I don't know how to do that either. Because Commerce License Billing manages so much in the Order Refresh process, how to approach all this is a bit muddy for me.

Worth mentioning that I am using commerce_cardonfile and commerce_stripe.

  • I'm considering trying to write some code that will 1) charge them for upgrades immediately 2) delay downgrades to the next month in order to avoid having to handle refunds. The order refresh process makes the second one tricky, so at this point I'll just hack something together. – wizonesolutions Feb 18 '16 at 8:38
  • Noticed I had missed commerce_license_billing_change_plan(). I think this will get me closer, at least for downgrades. Need to read the code and see if it can handle immediate upgrades. – wizonesolutions Feb 18 '16 at 9:29
  • I think scheduling will work for downgrades. Seems like I have to enforce scheduling changes for that to actually occur. I already have a license type, so I can. For upgrades, I'm thinking I will just manually charge the difference in the calculated prices between old and new. I'll generate an order and charge it using commerce_cardonfile. If I prorate, I'll figure it that out manually too. It'll be Close Enough™. – wizonesolutions Feb 19 '16 at 14:30
  • In the end I just decided to schedule downgrades and cancellations, not refund. – wizonesolutions Apr 10 '16 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.