#kun_api

1 messages ¡ Page 1 of 1 (latest)

daring mistBOT
#

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

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

  • kun_api, 8 hours ago, 23 messages
distant furnace
bleak coyote
#
app.post('/create-confirm-intent', async (req, res) => {
  try {
    const intent = await stripe.paymentIntents.create({
      confirm: true,
      amount: 1099,
      currency: 'usd',
      // In the latest version of the API, specifying the `automatic_payment_methods` parameter is optional because Stripe enables its functionality by default.
      automatic_payment_methods: {enabled: true},
      confirmation_token: req.body.confirmationTokenId, // the ConfirmationToken ID sent by your client
    });
    res.json({
      client_secret: intent.client_secret,
      status: intent.status
    });
  } catch (err) {
    res.json({
      error: err
    })
  }
});

this step will send me client_secret so I can use in stripe.handleNextAction ??

distant furnace
#

Yep.

bleak coyote
#

further more

 this.stripeService
              .confirmCardSetup(this.clientSecret, {

this stripe method also do the 3D verification

#

so what is the difference between these two fucntions?

distant furnace
#

confirmCardSetup is not related to the guide you're using. It's used to confirm a Setup Intent with a card, which is not what you're doing.

bleak coyote
#

ohhh got it

distant furnace
bleak coyote
#

you are right I am using setpintent and then confirm it

distant furnace
#

Sorry, not sure I understand. The guide you linked to uses Payment Intents, not Setup Intents.

bleak coyote
#

a quick question
stripe createConfirmationToken method will it send me error if someone add dummy card instead of confirmation token?
and this is how I can validate the card right?

distant furnace
#

Let's back up a bit. Can you tell me, at a high level, what you're trying to build?

bleak coyote
#

I am trying to setup one time payment using stripe card elements on frontend end
and on server side I am using payment intent

distant furnace
#

What do you mean by "setup" exactly? Are you trying to take an immediate one-time payment now, or are you trying to save payment info now and make the payment later?

bleak coyote
#

what I exactly wanted is
the client adds its card information then I using this card information customer pay the bill immediatly

distant furnace
#

And do you want to save the payment info for later use, or only use it once for this one payment?

bleak coyote
#

I will save the card details including
paymentMethodId for later use as well

distant furnace
#

Okay, and do you want to build a custom payment form on your own site for this, or do you want to use Stripe's page for this? The latter is easier and quicker to build.

bleak coyote
#

No I will use custom business logic and will do it from my server

distant furnace
#

What specific custom business logic do you need?

bleak coyote
#

Once the card information I get from the stripe element and one they are validate
I will use them to pay the bill for the user . tht is why I am using payment setup intent at backend
and then pass the client secret to frontend again for the 3D

distant furnace
#

Wait, I think there's a misunderstanding. Are you trying to perform 3D Secure as a separate step from the payment step?

bleak coyote
#

and the 3D verification is in step 6

distant furnace
#

Yeah, don't worry about that for now. I'm asking you what you want to build so I can tell you if it's possible or not, and if it is possible point you to the right guide.

#

In order to do that I need to understand what custom business logic you need.

#

I also need to understand how you're thinking about 3D Secure and the payment steps.

bleak coyote
#

ok let me summarize it

User comes to my application buy 12 usd product
by click on pay its card will be charged 12 usd and then he can confrim it using 3D

distant furnace
#

That's not how it works. 3D Secure happens during the payment process, before the payment happens, it doesn't happen after the payment.

bleak coyote
#

so what this method do
stripe.handleNextAction(
which is in step 6

distant furnace
#

On that guide, in step #5, you attempt to collect the payment. If the payment requires a next action, like 3D Secure, the Payment Intent will go into a status of requires_action which means the payment hasn't happened yet, and the required action needs to be handled first. At that point you send the client secret to your frontend and call stripe.handleNextAction to have the customer handle the next action. If that next action succeeds only then does the payment go through.

bleak coyote
#

what are the other statuses I can get except for require_action

distant furnace
bleak coyote
#

except for succeeded and canceled

all other status will have client secret?

#

I mean thses statuses

processing
requires_action
requires_capture
requires_confirmation
requires_payment_method
distant furnace
#

You don't really need to worry about all of those statuses at this point in this particular flow. What I'm still not clear on is the custom business logic you mentioned earlier. Can you tell me more about that?

bleak coyote
#

The business logic is to just charge the customer with 3D

distant furnace
#

Oh, okay, so you don't need to use this flow at all, which is more complex than required for your use case.

bleak coyote
#

so what flow I should use then?

distant furnace
#

That takes a payment and saves the payment info for future use. It handles 3D Secure and everything as well.

#

I recommend that unless you really need the more custom flow above.

bleak coyote
#

I went through this guide quickly

#

can you tell me the difference
and why this is more suitable for my task?

#
  const {error} = await stripe.confirmPayment({
    //`Elements` instance that was used to create the Payment Element
    elements,
    confirmParams: {
      return_url: 'https://example.com/order/123/complete',
    },
  });

and on the frontend why is method not taking client_secret from payment intent as a parameter?

distant furnace
#

The guide you were originally using is designed for use cases where people want to examine the payment details inside the Confirmation Token before proceeding. It's more of an advanced flow designed for companies who do things like special logic to determine if a payment should even be attempted or not.

bleak coyote
distant furnace
bleak coyote
#

yes because our appliation requirements dont allow us to use stripe checkout directly

distant furnace
#

Why?

bleak coyote
#

I dont knwo

#

its client requirements

distant furnace
bleak coyote
#

Thanks for the help

#

really appreciate it

distant furnace
#

No problem!

bleak coyote
#

you have guided me well