#cynefin_30

1 messages · Page 1 of 1 (latest)

faint cairnBOT
#

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.

nocturne bridge
#

Hello

#

If they are going to be different Prices each time then yeah creating a new Price is necessary.

noble matrix
#

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 ?

nocturne bridge
#

Yep

noble matrix
#

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

nocturne bridge
#

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

noble matrix
#
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

nocturne bridge
#

1000 USD is $10.00 ?

#

Amount is in smallest currency unit

#

So for USD that is in cents