Skip to content

Instantly share code, notes, and snippets.

@dipeshhkc
Last active January 15, 2023 21:37
Show Gist options
  • Save dipeshhkc/edea1c1017876e870df218aff647a80a to your computer and use it in GitHub Desktop.
Save dipeshhkc/edea1c1017876e870df218aff647a80a to your computer and use it in GitHub Desktop.
export const plans = [
{
name: "Basic",
tier: "basic",
price: 5,
priceId: "price_1MNhAzFSrpGVHE9i8tGqm0R7",
},
{
name: "Pro",
tier: "pro",
price: 30,
priceId: "price_1MNmnJFSrpGVHE9itLCER4dX",
},
];
export const getPriceId = (name:string) => {
return plans.find((t) => {return t.tier === name})?.priceId;
};
export const getTierName = (priceId:string) => {
return plans.find((t) => {return t.priceId === priceId})?.tier;
};
export const getHumanReadableTierName = (priceId:string) => {
return plans.find((t) => {return t.priceId === priceId})?.name;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment