feat: plan limits

This commit is contained in:
Mythie
2023-10-15 20:26:32 +11:00
parent 0d026f3476
commit 093488a67c
31 changed files with 750 additions and 272 deletions

View File

@ -0,0 +1,17 @@
import { stripe } from '@documenso/lib/server-only/stripe';
export type GetProductByPriceIdOptions = {
priceId: string;
};
export const getProductByPriceId = async ({ priceId }: GetProductByPriceIdOptions) => {
const { product } = await stripe.prices.retrieve(priceId, {
expand: ['product'],
});
if (typeof product === 'string' || 'deleted' in product) {
throw new Error('Product not found');
}
return product;
};