mirror of
https://github.com/documenso/documenso.git
synced 2025-11-16 09:41:35 +10:00
feat: plan limits
This commit is contained in:
17
packages/ee/server-only/stripe/get-product-by-price-id.ts
Normal file
17
packages/ee/server-only/stripe/get-product-by-price-id.ts
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user