#.abishek
1 messages · Page 1 of 1 (latest)
Have you tried this description? https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items-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.
it looks like it defaults to the product name, will setting that affect what product name is shown on the checkout page?
The default value is product name, but if you set a custom value, it will display instead
will it take HTML or just plain text?
Should be plain text
receive this error Received unknown parameter: line_items[0][data]
Probably just som syntax issue? Could you share the full code?
This is what I am passing to create the checkout session
That syntax (0 => ...) is correct
Is that Node.js?
https://stripe.com/docs/api/checkout/sessions/create?lang=node please select the language on the code example here to see how the syntax should be
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
PHP
that is the var_dump of array data being passed
here is the json output of the array if this is helpful
{"success_url":"https:\/\/tdba2.test\/thank-you?session_id={CHECKOUT_SESSION_ID}","cancel_url":"https:\/\/tdba2.test\/programs\/membership-packages","line_items":[{"data":{"description":"Zyon Floyd - 15"},"price_data":{"currency":"usd","unit_amount":11800,"product":"prod_OgpGSNoCNM7VTu","recurring":{"interval":"month"}},"quantity":1},{"data":{"description":"Zyon Floyd - 15, Test - 12"},"price_data":{"currency":"usd","unit_amount":4410,"product":"prod_OgpGl5OrEtzf9r"},"quantity":2}],"mode":"subscription","client_reference_id":"aaf0c284-baa1-453d-990b-7618f3e346e1","customer":"cus_JleLRxju5KkjYP","consent_collection":{"terms_of_service":"required","promotions":"auto"},"custom_text":{"submit":{"message":"You additionally accept to the cancellation policy as documented here: .https:\/\/tdba2.test\/cancellation-policy"}},"metadata":{"cart_id":"aaf0c284-baa1-453d-990b-7618f3e346e1"}}
i feel like line_items.data is only a getter and not a setter
$stripe->checkout->sessions->create([
'success_url' => 'https://example.com/success',
'line_items' => [
[
'price' => 'price_H5ggYwtDq4fbrJ',
'quantity' => 2,
],
],
'mode' => 'payment',
]);
Let's try passing it like this
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
i am already doing that and that works fine
i want to pass additional data per line item and that is what I was initially asking about
Hello! I'm taking over and catching up...
ok
Ah, I think the guidance above is a little incorrect. The line item descriptions shown in Checkout are based on the Product name, so you can either change the name of the Product, or you can specify arbitrary Product data inside price_data when you create the Checkout Session: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product_data-name
ok, i am on the latest version of the API and I get this error when I try to create a session with description on the line_items
You cannot use `line_items.amount`, `line_items.currency`, `line_items.name`, `line_items.description`, or `line_items.images` in this API version. Please use `line_items.price` or `line_items.price_data`. Please see https://stripe.com/docs/payments/checkout/migrating-prices for more information.
looks like that is for older api versions
Yep, that won't work, sorry. The guidance above about setting a description there was not correct.
and I am not using product_data because I have reference to the product_id on stripe
Then you would need to change that Product's name.
ok ya, that won't work because my intention is not to change the product name, but show additional info for that product info. Our website does event registrations and I was hoping to show the name of the person registering for the each event on the checkout page
each event can have multiple users registering, so per lineitem can have multiple people.
so, looks like a no go. if you have any other suggestions of acheiving this, it would be helpful