#WEIRDLEMON - PI capture

1 messages ยท Page 1 of 1 (latest)

soft turtle
#

What is the problem?

forest badge
#

I'm confused as to what needs to passed in

const paymentIntent =await stripe.paymentIntents.capture({{{{SOME_PARAMETER}}}
          );
soft turtle
forest badge
#

Is it the Intent ID which i got from creating the payment intent

#

or is it the secret

#

or is it the payment_method id

#

Description of what I've implemented..

soft turtle
#

The parameters are clearly spelled out in the doc i linked

forest badge
#
  1. I created a payment Intent and stored the id of the created payment intent.
    [args_passed] ==>
const paymentIntent = await stripe.paymentIntents.create({
          description,
          shipping: {
            name: userName,
            address: userAddress,
          },
          customer: customerId,
          amount: parseInt(totalAmt * 100),
          currency: "usd",
          payment_method_types: ["card"],
          capture_method: "manual",
          payment_method: payment_method_id,
          // setup_future_usage: true,
        });
#
  1. Then I stored the Id of this payment intent created
#
  1. I used this stored ID later to capture the payment
#

I'm getting internal server error without any error code

#

So, need help

#

I could be horribly wrong

#

Somewhere

#

I don't see anywhere what is exactly passed in as argument in the code example

soft turtle
#

What else do you want to pass besides the ID?

forest badge
#

just the ID

#

I just want to capture the entire amount

#

but later

#

Error: Stripe: Argument "intent" must be a string, but got: undefined

#

Got this error

soft turtle
#

Okay so you are failing to pass in the ID as a string in your code., that's required

forest badge
#

StripeInvalidRequestError: This PaymentIntent could not be captured because it has a status of requires_confirmation. Only a PaymentIntent with one of the following statuses may be captured: requires_capture.

#

Why am I getting this one?

#

it should have been requires_capture

forest badge
soft turtle
#

The payment method requires confirmation
Do you have a request ID for the Payment Intent creation?

forest badge
#

Resolved

#

!!

#

Thanks @soft turtle

soft turtle
#

Awesome ๐ŸŽ‰

forest badge
#

Thanks a lot for your time!

soft turtle
#

Sure thing, that's why we're here ๐Ÿ™‚