#padre_api

1 messages ¡ Page 1 of 1 (latest)

hard brambleBOT
#

👋 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.

neon sapphire
#

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?

cedar forgeBOT
neon sapphire
#

also the webstore is coded in php if that help

marble kindle
neon sapphire
#

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?

marble kindle
#

Nope just once, you would add all of your cart items to the line_items array when creating the session

neon sapphire
#

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}',
]);
marble kindle
#

Have you tried running that codee in test mode?

neon sapphire
#

nope, i'm seeking for clear information, that's why i asked before doing something

marble kindle
#

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

neon sapphire
marble kindle
#

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

neon sapphire
marble kindle
marble kindle
neon sapphire
#

oh so item names from my actual webstore and the code should identic so stripe will know what to display

neon sapphire
marble kindle
#

Unfortunately I'm working in too many threads to use drawing software at the moment

#

Do you see the line_items parameter in your checkout create function? That parameter takes an array, you will want to add more items to that array