#beaver-stealer_code

1 messages ¡ Page 1 of 1 (latest)

mystic skyBOT
#

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

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

upper crescentBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

rough ravine
#

Can you tell me what you want to achieve here?

vale wraith
#

So I want

Customer clicks button ->
if fields are completed then call database+stripe functions
ELSE
Display what is wrong to the customer's input fields. AND don't call the two functions

#

There's some userdata that needs to be delivered to my database and not to the stripe database, because I want to minimize information leak. So the customer email shouldn't go with the stripe meta data but straight to the database.

#

As it's not a stripe field

#

I'm aware it's possible to send the email with Stripe and then receive the event on my servers -> adding a database entry, but I'd like to avoid that method if that's possible

rough ravine
#

I sitll don't quite understand what you are trying to build

#

Here's my understanding: you only want to call confirmPayment when both shippingElementComplete and paymentElementComplete are true

#

But somehow you encounter a difficulty, what is that?

vale wraith
#

When confirmPayment isn't called I still want to display these things

rough ravine
#

Ok, so basically you want to validate the form without calling confirmPayment

#

There's no dedicated API for form validation. You can still use confirmPayment to validate, Stripe.js won't submit payment anyway if the form is not completed.

vale wraith
# rough ravine There's no dedicated API for form validation. You can still use `confirmPayment`...

That is correct. But then I run into another issue as confirmPayment is wrapped in the button's event call.

  // If this is called AFTER submit then there would be issues.
  shippingElement.on("change", function (event) {
  form!.addEventListener("submit", async (event) => {

So it would not be guaranteed that the other events are called before the button submit one.

Which results in the stripe function going through and database function not.

rough ravine
#

You should disable the submit button until both shippingElementComplete and paymentElementComplete are true