#sl-tech_code

1 messages ¡ Page 1 of 1 (latest)

wind burrowBOT
#

👋 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/1295643231174004787

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

scarlet pumice
placid bay
#

I think this is it: req_VA8bMDkHi7cTfP

scarlet pumice
#

OK. This checkout session was already completed and therefore expired. You should create a new checkout session for new payments

placid bay
#

ok! how do I create a new checkout session for every request?

#

from my code I can't see where I can create a new session, I thought I already did that..

scarlet pumice
#

https://docs.stripe.com/no-code/payment-links maybe you want to try our no-code solution? A PaymentLink will automatically create a checkout session when your customer opens it

If you want to start selling online, Payment Links offer a simple way for customers to pay you. Learn how to create one that you can share with everyone without writing code.

placid bay
#

yes I looked into links, but I couldn't figure out how to defined different amount for each request? is this possible?

scarlet pumice
#

If you want to use dynamic amount, then checkout sessions API is more suitable for you. But that requires you to write some code

placid bay
#

yes I write code. this is for a webshop I'm developing. but where in my code should I create the new checkout session? or what do I need to do different?

scarlet pumice
placid bay
#

I've done that, and my code is equal to the demo code. shouldn't this create a new session?

#

SessionService service = new SessionService();
Session session = service.Create(opt);

scarlet pumice
#

Yes, you should put some logs in your code and see why it didn't get executed and return your customer a new checkout session URL.

wind burrowBOT
placid bay
#

hmm. it looks like it's a cache issue. when I clear the cache for localhost it works, but else it redirects to Stripe before running the code that creates a new session

austere elk
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

placid bay
#

I got it to work by sending in a unique Guid for each call to the Stripe controller in my project