Skip to main content

Hybrid Pricing

How to create hybrid pricing models.

Every pricing model maps to usage. Seat-based pricing is the usage of seats. Flat, monthly pricing is just a quantity of one with recurring charges. Even a t-shirt purchase is just a quantity of one on your receipt, it just resets so that you aren't charged again.

Therefore, there is only one type of pricing model in Limitr — hybrid.

Limitr Cloud Users

Policy creation is made much simpler using our no-code UI. Any changes to strategy can be made right within the editor, automatically versioned, auditable, and publishable at the click of a button.

Behind the scenes (and if you click developer view), you'll see a policy config similar to the ones below. Instead of adding JSON or Stof, you'll define credits and entitlements within the UI. However, behaviorally, they are identical to the ones defined on this page, and the integration is the same.


Seats

Seats are straightforward — define a seat credit.

policy: {
    credits: {
        // added a price for any future plans with soft limits that charge for seats
        seat: { description: 'A single seat', price: { amount: 19.99 } }
    }
    plans: {
        starter: {
            label: 'Starter Plan'
            entitlements: {
                seats: {
                    description: 'Included seats with the plan'
                    // mode is 'hard' by default, seats don't reset
                    limit: { credit: 'seat', value: 10 }
                }
            }
        }
    }
}
seat-based
import { Limitr } from '@formata/limitr';
const policy = await Limitr.new(`policy: { ... }`);
// const policy = await Limitr.cloud({ token }); // for Limitr Cloud users

// create a new customer if one doesn't already exist (locally or remotely via Cloud)
await policy.ensureCustomer('demo', 'starter');

const starting = await policy.remaining('demo', 'seats');
console.log(`Starting with ${starting} seats`);

await policy.increment('demo', 'seats');
await policy.allow('demo', 'seats', 8);
console.log(`Used ${await policy.value('demo', 'seats')} seats, ${await policy.remaining('demo', 'seats')} remaining`);

if (!await policy.allow('demo', 'seats', 2)) {
    console.log('Blocked!! Cannot use 2 more seats, limit is:', await policy.limit('demo', 'seats'));
}

await policy.decrement('demo', 'seats');
if (await policy.allow('demo', 'seats', 2)) {
    console.log('Success!! Used 2 more seats after decrement,', await policy.value('demo', 'seats'), 'total');
}
Output

If you need multiple prices, one per plan for example, define multiple credits with different prices: starter_seat, pro_seat. The seats entitlement would be the same name on every plan, and is the only name referenced from within your code.