#JimP

1 messages ยท Page 1 of 1 (latest)

late heronBOT
fierce dagger
#

Hello, two-shoes is out at the moment but I am happy to help. Can you send me the ID of a request (req_123) where you got that error?

neat locust
#

Thanks @fierce dagger : req_TJHpIdSDotpESt

fierce dagger
#

Thank you, will check in to that request in a minute

neat locust
#

Thanks.

#

Or req_VXBd9RRqaSSTYF

fierce dagger
#

Do you have the request ID for your invoice line item error? You can set descriptions on the line items I believe, it may just be with a different syntax

neat locust
#

No, it didn't give me a request ID. This is the syntax I used:

[line_items] => Array
(
[0] => Array
(
[price] => price_1MCR9BECgyDJozCpDd5Q6c89
[description] => THIS IS THE LINE-ITEM DESCRIPTION
[quantity] => 1
)

    )
#

Ah! Found it! req_DuMl9cMLBE2j6l?t=1670449618

#
  • that's the request to create the checkout session
potent kite
#

Hi there ๐Ÿ‘‹ taking over for @fierce dagger

Sorry for the mis-type. The Product that is associated with a Price actually contains the description and it shows up in Checkout once it's set

fierce dagger
#

And if you are defining one-off items for the session, you can define them in the product_data hash, but that is for when you aren't passing in a pre made price ID like that https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product_data-description

neat locust
#

So does that mean the only way to display a price description is to define both the product and the price when I create the checkout session?

#

So forget about creating a product catalogue in Stripe, and simply do everything on-the-fly?

neat locust
#

And if I use line_items.product_data, does that create a product and a price in my dashboard, or does it disappear once the session is finished?

potent kite
neat locust
#

So one product, one price?

potent kite
#

Yep! And these can be created ahead of time, you just have to specify them when the Checkout Session is created

neat locust
#

OK. If I create them when I create the checkout session, do they persist (and therefore proliferate), or disapper when the checkout session is finished?

potent kite
#

They persist beyond the Checkout Session and can be reused if needed

neat locust
#

OK. So best practice is to use the API to create a unique product/price combination for each possible price (eg. Product 1 is Membership A/annual subscription; Product 2 is Membership A/monthly subscription; Product 3 is Membership A/Lifetime one-time price)?

potent kite
#

Yep!

neat locust
#

OK. Got it! Thanks!

#

While you're there, where do product images get used?

#

I was sort of expecting to see them on the checkout page, but nothing there?

potent kite
#

Hmm, let me double check. I think the intent is just to give a URL that links to the Product's image so you can embed it into HTML or JS, but let me double-check

#

Ah, so it should be showing up in Checkout. Mine does when I add an image to the Product

neat locust
#

OK - problem in my code then!!

#

Final dumb question of the evening (thanks for your patience!): does the product.description display HTML? If not, can I at least put in \r\n line breaks?

#

Or is it always just a single block of unformatted text?

potent kite
#

Final dumb question of the evening (thanks for your patience!): does the product.description display HTML? If not, can I at least put in \r\n line breaks?
These really aren't dumb questions! Trust me, I get a lot of them and these aren't them.

Anyway, to answer your question, I think Stripe interprets your description as a string literal, so I'm pretty sure things like line breaks and HTML tags are ignored, but let me double-check

neat locust
#

๐Ÿ˜†

potent kite
#

Yeah, so carriage returns and HTML tags are entirely ignored and Checkout is displayed as plain text no matter what description is

neat locust
#

Thanks - helpful to know!

#

Really appreciate your help - you are making my life much, much easier!

potent kite
#

Happy to do so! Feel free to drop more questions as they come up.