#JimP
1 messages ยท Page 1 of 1 (latest)
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?
Thanks @fierce dagger : req_TJHpIdSDotpESt
Thank you, will check in to that request in a minute
It looks like prices themselves don't have a description but you can set one at the product level https://stripe.com/docs/api/products/create#create_product-description
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
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
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
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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?
Yes
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?
You can create a Product catalogue, you just have to make sure each Product has the description you want
So one product, one price?
Yep! And these can be created ahead of time, you just have to specify them when the Checkout Session is created
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?
They persist beyond the Checkout Session and can be reused if needed
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)?
Yep!
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?
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
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?
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
๐
Yeah, so carriage returns and HTML tags are entirely ignored and Checkout is displayed as plain text no matter what description is
Thanks - helpful to know!
Really appreciate your help - you are making my life much, much easier!
Happy to do so! Feel free to drop more questions as they come up.