#legend-checkout-lineitems
1 messages · Page 1 of 1 (latest)
hello, mind sharing the req_123 Request ID you got back in that error msg? can look it up
ah move currency param into the price_data hash
right now it is outside the price_data hash
since you're specifying price_data you need all its required params inside that hash
I'll try that now
Also a related question, is "price_data" attribute even listed on the line_items api page? I only found this format from the example code but couldnt find it in the api
https://stripe.com/docs/api/invoices/line_item
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
InvalidRequestError: Request req_s6mhrhimVfH7J1: Received unknown parameter: line_items[0][price_d
ata][quantity]
after moving currency into price_data
quantity isn't a param in price_data so you have to move that out
see the API ref
think of it this way, you're specifying a dynamic Price via price_data and then defining what quantity of that Price is being purchased, outside of price_data but inside an array in line_items
Ok. It's actually working! Thank you. I need to get a lot better at reading/using docs.
My final question (for now) is actually the same issue I was having before. Following the guide, I was returning redirect(session.url, code=303) in my flask route, but I get
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://checkout.stripe.com/pay/cs_test_a1qcu0tiY2QKSIFVxxgjedYwfA9iJHPW9yLRd6V8etV5XMa91Lrqqk0Tp4#fidkdWxOYHwnPyd1blpxYHZxWlFcampIVGRwc2FAQXQwMUtsUXVtT
I trigger this checkout route as a post ajax in my clientside code.
One of the other devs was saying I need instead of this redirect to use clientside code after the ajax post to send them to the stripe URL? Could you help me understand what the issue is, what that solution means, and how I might implement it?
ah CORS isn't my strongest suite but what I would do instead of doing a
redirect(session.url, code=303)
is to return the CheckoutSession URL to your client-side, then on your webpage, just do a redirect there like
I'll attempt that now