#kelley_api

1 messages ยท Page 1 of 1 (latest)

low bloomBOT
#

๐Ÿ‘‹ 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/1225874240352551054

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

half grailBOT
hexed bobcat
#

Can you clarify which one you are attemtping to use?

copper smelt
#

Have this first route to create my payment_intent working:

    const { amount, currency } = req.body;

    const paymentIntent = await stripe.paymentIntents.create({
          amount,
          currency,
          automatic_payment_methods: {
            enabled: true,
          },
          application_fee_amount: 123,
        },
        {
          stripeAccount: 'acct_1',
        }
      );

    console.log(paymentIntent);
})```
#

Then when I go to confirm the payment intent:

    const { paymentIntent } = req.body;
    
    const capturedPaymentIntent = await stripe.paymentIntents.capture(paymentIntent);
    console.log(capturedPaymentIntent);
})```
#

I get this error: This PaymentIntent could not be captured because it has a status of requires_payment_method. Only a PaymentIntent with one of the following statuses may be captured: requires_capture.

#

To chartge the customer, do I want capture or confirm?

And how can I test this in postman?

hexed bobcat
#

You are missing a few steps

#

The payment intent after you create it doesn't have a payment method associated with it

#

Or, you can include the test Payment Method when you create the Intent and pass confirm: true

#

You should not need to capture the funds unless you specify capture_method: "manual" when creating the intent

half grailBOT
copper smelt
#

So when I am doing this from the frontend, I would get the pamynt method from the elements form and then what do I need to pass in the request body to charge the card?

Just this info:

    const capturedPaymentIntent = await stripe.paymentIntents.confirm(
        paymentIntent,
        {
            payment_method: 'pm_card_visa', <--- method from stripe elements?
            return_url: 'https://example.com',
        }
        );```
hexed bobcat
#

That will transition the PaymentIntent to a status of requires_confirmation. Then you just need to confirm it and you will see the application fee deducated

copper smelt
#

So I

  1. Create payment intent
  2. Confirm payment intent
  3. Capture payment intent?
hexed bobcat
copper smelt
#

Let me peek

hexed bobcat
#

And you will only need to capture the intent if you specify that you want to capture it manually by passing capture_method: "manual" when you create the intent. Otherwise, it will go through automatically when you confirm it.

copper smelt
#

Ok gonna try to go through this whole flow.

#

thx

#

An am I using the connect accounts secret key? Or the connected accounts?

hexed bobcat
#

You use the Platform's API keys and specify the Connect Account in the stripe_account parameter