Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

control: convert single tier to metered+per_unit #267

Merged
merged 1 commit into from
Mar 1, 2023
Merged

Conversation

bmizerany
Copy link
Contributor

This changes how Tier interprets and converts tiers to Stripe prices.

Previously, a single tier in a pricing.json would convert to a metered
price with one or two tiers depending on if the tier had an inf limit or
not. If it did not have an inf limit, a catch-all was created to satisfy
Stripe. This produced awkward invoices.

This commit changes Tier to convert a feature that has a single tier
without a base price to be a metered+per_unit price in Stripe, which
shows up less awkwardly on invoices.

This also opens us up to support pricing transforms in Stripe for these
types of prices.

@bmizerany
Copy link
Contributor Author

bmizerany commented Mar 1, 2023

To test:

; cat <<-EOS | tier push -c -
{
    "plans": {
        "plan:tiers@0": {
            "features": {
                "feature:single": {
                    "tiers": [
                        {
                            "upto": 1,
                            "price": 1.1
                        }
                    ]
                }
            }
        }
    }
}
EOS

; tier subscribe org:single plan:tiers@0
; tier report org:single feature:single 10

You should see:

CleanShot 2023-02-28 at 16 43 15@2x

CleanShot 2023-02-28 at 16 50 46@2x

@bmizerany bmizerany marked this pull request as ready for review March 1, 2023 01:20
This changes how Tier interprets and converts tiers to Stripe prices.

Previously, a single tier in a pricing.json would convert to a metered
price with one or two tiers depending on if the tier had an inf limit or
not. If it did not have an inf limit, a catch-all was created to satisfy
Stripe. This produced awkward invoices.

This commit changes Tier to convert a feature that has a single tier
without a base price to be a metered+per_unit price in Stripe, which
shows up less awkwardly on invoices.

This also opens us up to support pricing transforms in Stripe for these
types of prices.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant