#Haim-capture

1 messages · Page 1 of 1 (latest)

crisp whale
#

@solemn kite do you mean, you want to place a hold on their credit card(like what e.g. hotels or car rentals do) and then capture it later?

solemn kite
#

Yes, usually the capture happened after few seconds it just for to do something between like :after the user payed we're sending some feedbak and then capturing it or reject it in case we failed to send the feedbak

solemn kite
#

Hi,
Just to make sure I'm understand the process:

  1. So I need to start by creating checkout like the following example (I'm using NodeJS):
    const stripe = require('stripe')('sk_test_51JeDdZHx54gYKcAYb18F19sb0O5oLEqY8A7G0fnj2aZvNnPbu0V7YIsO2DYL0aSMiOWgjrvWkHydnxKIBgzlRH5i002WBCl1yn');

const session = await stripe.checkout.sessions.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
payment_method_types: ['card'],
line_items: [
{price: 'price_H5ggYwtDq4fbrJ', quantity: 2},
],
mode: 'payment',
});
2. Then I need to use the indent to capture the transaction as follow:
const stripe = require('stripe')('sk_test_51JeDdZHx54gYKcAYb18F19sb0O5oLEqY8A7G0fnj2aZvNnPbu0V7YIsO2DYL0aSMiOWgjrvWkHydnxKIBgzlRH5i002WBCl1yn');

const intent = await stripe.paymentIntents.capture('pi_ANipwO3zNfjeWODtRPIg', {
amount_to_capture: 750,
})

#

My question is, the checkout.create need a specific 'mode' to capture the transaction futurely?

crisp whale
#

yep that code seems reasonable! I'd suggest testing it out. As for mode, it only works with mode:payment (which is the one you'd usually use, unless you're doing recurring subscriptions)