lmsqueezy/laravel

Support for usage-based billing

dcblogdev opened this issue · 2 comments

Are there plans to add support for usage-based billing?

I'd like to use this for apps that will be paying for multiple seats, from what I understand the API needs the following on checkout:

"attributes": {
      "checkout_data": {
        "variant_quantities": [
          {
            "variant_id": 1,
            "quantity": 10
          }
        ]
      }
    },

then later up update the qty

PATCH https://api.lemonsqueezy.com/v1/subscription-items/1

{
  "data": {
    "type": "subscription-items",
    "id": "1",
    "attributes": {
      "quantity": 5
    }
  }
}

Yes definitely. Just need to find time to work on it. Any pr that kickstarts it is greatly appreciated.

I realised last week when looking at the Lemon Squeezy API changes that this will require a new major release for the library. We'll need a new subscription_items table which holds all item records for subscriptions in a similar fashion like Cashier Stripe and Cashier Paddle. Then we'll need to rework parts of the library to accommodate for this. Finally, we'll need to add a migration path for people upgrading from v1 to v2, most likely using some sort of sync command for subscriptions.