#dimiszk

1 messages · Page 1 of 1 (latest)

obtuse marshBOT
hollow lava
#

Hi there!

#

How do you plan to create the subscriptions? With a Checkout Session (recommended), or directly calling the Subscription endpoint?

indigo shard
#

With a Checkout Session

hollow lava
#

Then you can create a Checkout Session by passing line_items.price with a price ID, or use line_items.price_data and line_items.price_data.product_data if you don't want to create products/price in Stripe.

indigo shard
#

But then i must create a price on stripe? (how do i get the price ID). I don't want to create anything on stripe except the recurring payment.

hollow lava
#

No, you don't have to create a price ID! Like I said you have two different options:

  • Create a Checkout Session by passing line_items.price, this requires a price ID
  • or create a Checkout Session with line_items.price_data and line_items.price_data.product_data. In this case no need to create any products/price in Stripe, you directly set the price/currency/etc. in the API call.
indigo shard
#

Ι am very confused with the API... Could you give me a json sample?

hollow lava
#

Sure, give me a few minutes.

#

In Node.JS it would look something like this:

const session = await stripe.checkout.sessions.create({
  mode: "subscription", 
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
  line_items: [{
    price_data: {
      currency: "eur",
      unit_amount: 500,
      recurring: {
        interval: "month"
      },
      product_data: {
        name: "test"
      }
    }, 
    quantity: 1,
  }],
});
indigo shard
#

Thank you very much !!! I 'll give it a try. I am using .NET.

hollow lava