#Beat.

1 messages · Page 1 of 1 (latest)

opal knotBOT
heady pelican
#

Authorization can succeed and its subsequent charge can fail. It's unlikely, but it can happen. Are you using Stripe's test cards for this?

cedar olive
#

Yes.

#
await stripe.paymentIntents.create({
    payment_method: paymentMethod.stripePaymentMethodId,
    amount: 5000,
    payment_method_types: ['card'],
    capture_method: 'manual',
    currency: 'usd',
    customer: user.stripeCustomerId
#

To check the failed card I do
paymentMethod.stripePaymentMethodId = 'pm_card_visa_chargeDeclined'

#

The card I use to always pass is 42 repeating

heady pelican
#

So I believe those are intended to fail only the charge, not necessarily the confirmation

#

Let me double check though

cedar olive
#

No change

#
{
  id: 'pi_3LhdBED3Wg9v9Yjr0jE14OXH',
  object: 'payment_intent',
  amount: 5000,
  amount_capturable: 0,
  amount_details: { tip: {} },
  amount_received: 0,
  application: null,
  application_fee_amount: null,
  automatic_payment_methods: null,
  canceled_at: null,
  cancellation_reason: null,
  capture_method: 'manual',
  charges: {
    object: 'list',
    data: [],
    has_more: false,
    total_count: 0,
    url: '/v1/charges?payment_intent=pi_3LhdBED3Wg9v9Yjr0jE14OXH'
  },
  client_secret: 'pi_3LhdBED3Wg9v9Yjr0jE14OXH_secret_k16W9Na9KMLU6HCOo74dxZpLE',
  confirmation_method: 'automatic',
  created: 1663091152,
  currency: 'usd',
  customer: 'cus_LyOuGh518dKP28',
  description: null,
  invoice: null,
  last_payment_error: null,
  livemode: false,
  metadata: {},
  next_action: null,
  on_behalf_of: null,
  payment_method: 'pm_1LhdBED3Wg9v9YjrI87snOkF',
  payment_method_options: {
    card: {
      installments: null,
      mandate_options: null,
      network: null,
      request_three_d_secure: 'automatic'
    }
  },
  payment_method_types: [ 'card' ],
  processing: null,
  receipt_email: null,
  review: null,
  setup_future_usage: null,
  shipping: null,
  source: null,
  statement_descriptor: null,
  statement_descriptor_suffix: null,
  status: 'requires_confirmation',
  transfer_data: null,
  transfer_group: null
}
#

Looks identical to the card that succeedes

#

Using pm_card_createDispute

heady pelican
#

That Payment Intent has not succeeded. It still requires_payment_method

#

So no charge has been created and the confirmation appears to have been unsuccessful as far as I can tell

cedar olive
#

where?

#

Do you mean requires_confirmation?

heady pelican
cedar olive
#

ok so then how do I kick it back if it didn't succeed? Nothing on this object is telling me that it didn't worked.

heady pelican
#

How are you presenting the payments page? Are you using a custom payment form? Payment Element? Checkout?

cedar olive
#

we use your front end stuff

heady pelican
#

We have a lot of front-end stuff. Is that the Payment Element or is it the Card Element?

cedar olive
#

I wanna say card
stripe.elements().create('card');

#

When the user enters card data we use

stripe.confirmCardSetup(this.setupIntentSecret, {
        payment_method: {
          card: this._card
        }
      });```
heady pelican
cedar olive
#

What do you mean by not confirming the card properly?

#

i'm hijacking the route that attempts to pre-authorize because how we currently have it set up I can't actually pass one of your bad cards on add/create payment method.

heady pelican
#

I don't follow. Why can't you pass one of the test cards? You don't have to use token strings, we provide actually fake card numbers to use.

cedar olive
#

Right. And when the payment method is being created, it fails because the bad card numbers are suppose to. This issue is that my understanding of the bad card numbers, They will fail essentially any scenario. I need to test the scenario where the card is valid but when they attempt to make a charge it fails for whatever reason.

#

I've also tried 4000000000000341 and it looks the same as the object I sent previously

heady pelican
#

Ah, okay that makes sense. That situation won't really happen if you are always creating payments immediately after confirmation. If you are charging the card some time after the confirmation is successful, then you'll need to use webhooks to listen for failed payments: https://stripe.com/docs/api/events/types#event_types-charge.failed

cedar olive
#

Ok use webhooks, got it. Thank you so much.