#cynefin_30
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- cynefin_30, 3 hours ago, 23 messages
Hello
If they are going to be different Prices each time then yeah creating a new Price is necessary.
You can use lookup keys to help if this applies (https://stripe.com/docs/products-prices/manage-prices#lookup-keys) but mostly yeah you just are going to have a big product catalogue if you are charging many different amounts
Okay looking into this 👀
Okays as I can see
const price = await stripe.prices.create({
product: '{{PRODUCT_ID}}',
unit_amount: 1000,
currency: 'usd',
recurring: {
interval: 'month',
},
lookup_key: 'standard_monthly',
});
this piece of code will return me a created price_id which will be associated with a product if I am correct and I can able to use this price Id while creating checkout session for User right ?
Yep
Cool
Can I just omit lookup_key for my use case where I am only interested about the price_id of the associated with a particular product ? because I have something like one to many relationship where one product with many prices
@nocturne bridge am I correct or I am missing something
Yeah lookup_key is for being able to be dynamic from the frontend.
It doesn't really apply to what you are describing overall.
If you want you can also just create your Prices inline when you create your Checkout Session
Using line_items.price_data: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data
const checkoutObject = {
/* Specify different payment method */
payment_method_types: ["card"],
line_items: [
{
price_data: {
currency: "usd",
product: "prod_PNzfoZHjtE1WXx",
recurring: {
interval: "month",
interval_count: 1,
},
unit_amount: 1000,
},
quantity: 1,
},
],
customer: "cus_PMV9uMpyqvZdS1",
mode: "subscription", // payment, subscription etc
success_url: `https://xxx`,
cancel_url: `https://xxx`,
};
I did try to use as per you mentioned creating a dynamic price for the product but when I opening the checkout url returned from the response it gives the original price of the product e.g here I have specified 1000 USD as the amount here is the attached screenshot of the checkout page
@nocturne bridge