#koks_api

1 messages ¡ Page 1 of 1 (latest)

sweet cedarBOT
#

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

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

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.

tiny vector
#

hi

plucky thistle
#

eg:

elements.create("expressCheckout", { 
  paymentMethods: { 
    klarna: 'never' 
  }
});
tiny vector
#

Can you check my second question " Do i need to create Payment Intent for this use case? Is it even supported."

plucky thistle
#

The express checkout element is initialized without a payment intent, but you do need one to complete payment

tiny vector
#

yes, during my test payment is not getting completed

#

getting message as timeout

#

how to handle payment intent for express checkout scenario

plucky thistle
#

Please make sure you're implemented all the non-optional steps there

#

this is roughly:
1/ initialize stripe.js & ECE
2/ listen to the confirm event and call your server to create a payment intent
3/ confirm the payment intent

tiny vector
#

ok thanks, let me check and come back if needed

#

how to listen to the confirm event?

#

Done with Step (1). How to listen to Confirm Event/

sweet cedarBOT
rare nest
#

Hi there, stepping in as synthrider needs to step away.

tiny vector
#

ok

rare nest
#

Did you take a look at the shared docs?

tiny vector
#

Yes

rare nest
tiny vector
#

ok, I'm new to stripe and not very familiar with JS as well. Where i need to place confirm event?

#

Is it a separate function or within ECE mount section?

rare nest
#

Sorry, we can't write your code for you and it would depend a lot on your own integration/architecture for where you should put it.

#

Overall it is a separate function, though I'm not sure what you mean by "within ECE mount section".

tiny vector
#

here is where i mount ECE in JS

rare nest
#

Gotcha then yes you can put the confrim handler within that function.

tiny vector
#

getting timeout error still...

#

here is the code

rare nest
#

You'll need to add logs throughout your code to see what is happening

tiny vector
rare nest
#

Also is there a reason you are creating a Confirmation Token here?

tiny vector
rare nest
#

All you need is the client secret from the PaymentIntent that you create server-side.

tiny vector
#

i just used the same js what you shared

rare nest
#

No the JS I shared from the docs is:

expressCheckoutElement.on('confirm', async (event) => {
  const {error: submitError} = await elements.submit();
  if (submitError) {
    handleError(submitError);
    return;
  }

  // Create the PaymentIntent and obtain clientSecret
  const res = await fetch('/create-intent', {
    method: 'POST',
  });
  const {client_secret: clientSecret} = await res.json();

  const {error} = await stripe.confirmPayment({
    // `elements` instance used to create the Express Checkout Element
    elements,
    // `clientSecret` from the created PaymentIntent
    clientSecret,
    confirmParams: {
      return_url: 'https://example.com/order/123/complete',
    },
  });

  if (error) {
    // This point is only reached if there's an immediate error when
    // confirming the payment. Show the error to your customer (for example, payment details incomplete)
    handleError(error);
  } else {
    // The payment UI automatically closes with a success animation.
    // Your customer is redirected to your `return_url`.
  }
});
#

So I'd try that instead and log out your clientSecret after calling your backend

tiny vector
#

my bad, let me try this

#

how to logout clientsecret?

rare nest
#

You use console.log()