#padre_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1220402782348120104
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
I'm trying to add on this checkout page instead of showing "Purchasing at store.mc-1st.ro" to whathever the customer will buy, for example x1 VIP
What API do I need in order to be able to do so?
also the webstore is coded in php if that help
Hello, this doc shows how to set up a Checkout Session with line items https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=stripe-hosted&lang=php#redirect-customers
Hello Pompey.
So as I understand I need to create a $checkout_session = $stripe->checkout->sessions->create for each item i have in my webstore?
Nope just once, you would add all of your cart items to the line_items array when creating the session
so this should look like this?
'line_items' => [[ 'VIP', 'VIP+' etc
'price_data' => [
'currency' => 'usd',
'product_data' => [
'name' => 'T-shirt',
],
'unit_amount' => 2000,
],
'quantity' => 1,
]],
'mode' => 'payment',
'ui_mode' => 'embedded',
'return_url' => 'https://example.com/checkout/return?session_id={CHECKOUT_SESSION_ID}',
]);
Have you tried running that codee in test mode?
nope, i'm seeking for clear information, that's why i asked before doing something
Is 'VIP', 'VIP+' etc a placeholder for other items? I think our PHP library will error if you put strings where key value pairs are expected
yea, as a placeholder as example to be sure if i understood, but seems that i didn't xD
I would highly recommend testing in test mode first, we're happy to consult on errors that happen and it can be really clarifying to how these calls work
If i add all of my items in the line_items, when the customer checks out a specific item, it won't be showing up all of the items listed into that line?
Can you tell me more about what you are having trouble understanding? Happy to clarify but I'm not clear on what you aren't clear on
Correct, the session only knows about the line item or items you pass it. Stripe doesn't have a concept of your cart outside of that
oh so item names from my actual webstore and the code should identic so stripe will know what to display
yes, not sure where actually to write the items, in line_items but if you can draw me an arrow where to begin and where to do next, I'm pretty new in matters of coding