#Elena - Payments

1 messages · Page 1 of 1 (latest)

vivid portal
kind wind
#

karbi suggested to first make paymentintent uncaptured

#

and then capture it say after i create the document

#

but im not able to capture the paymentintent, when i pass the paymentintent ```js
const intent = await stripe.paymentIntents.capture('pi_ANipwO3zNfjeWODtRPIg')

vivid portal
#

Hello! Taking a step back, I'm not sure I completely understand exactly what you want to do. Can you outline the ideal steps in your payment flow without worrying about any existing constraints? Then I can help you build that or get as close as possible.

kind wind
#
Current payment flow
1. initalize a payment intent

2. User inputs his card details. I have my own payment card, not hosted

3. I finalize the payment intent, and create a document in database
#

I want to change step 3. Where I uncapture the payment (so i know it could be successfully payed), then create document in database, and then capture the payment

#

I basically just dont want to take payment before the document in database is created

vivid portal
#

Okay, so like this?

  1. Create a Payment Intent
  2. Customer provides card info
  3. You use the Payment Intent to place a hold on funds
  4. You create the document in your database
  5. You capture the funds you placed on hold
kind wind
#

yes that is what i want

#

I managed to make the payment intent uncaptured, and then i sent the paymentintent to frontend. when user inputs card info and click "pay", i send the paymentintent to backend and then i try to capture the paymentintent, but it doesnt capture it. When i goto dashboard its not captured

vivid portal
kind wind
#

I did this ```js

  1. created a paymentintent with capture_method: manual.

  2. sent this paymentintent to client.

  3. When user click pay, i send a request to a route to create a document in database. With this request i send the paymentintent

  4. I try to use this code to capture payment intent

console.log("paymentIntent", paymentIntent)

const intent = await stripe.paymentIntents.capture(paymentintent)

#

@vivid portal

vivid portal
#

Can you give me the ID of that Payment Intent?

kind wind
#

i exited out of the terminal 5 min ago.. fu

#

it was in the console

vivid portal
#

You can get it from the Dashboard.

kind wind
#

oh let me

#

omg i think i know why... i didnt specify the amount to pay

vivid portal
#

Ah, yes, amount is required. 🙂

kind wind
#

i thought it was not required. it would take the whole amount if not specified

#
 The total authorized amount is captured by default—you can’t capture more than this. To capture less than the initial amount, pass the amount_to_capture option. Partially capturing automatically releases the remaining amount.
#

no actually docs says that u dont need to specify

#

by default it captures everything