Search code examples
node.jsstripe-paymentsstripe-payment-intent

Would PaymentIntent error out during creation if not enough funds or not payment method, etc?


const stripe = require('stripe')(secret_key);

const paymentIntent = await stripe.paymentIntents.create({
  customer: customer_id,
  amount: 2000,
  currency: 'usd',
  automatic_payment_methods: {enabled: true},
});

If I create a PaymentIntent like the above via Node, will it check for whether or not the customer actually has the resources to fulfill this payment amount?


Solution

  • No. PaymentIntent will need to be confirmed (passing confirm: true) to actually attempt to charge this customer_id.

    Note that you shouldn't share your secret key, even a Test mode one, in a public space like this.