#Beat.
1 messages · Page 1 of 1 (latest)
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?
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
So I believe those are intended to fail only the charge, not necessarily the confirmation
Let me double check though
Try data from this section: https://stripe.com/docs/testing#invalid-data I believe the confirmation step should fail
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
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
The most recent event on the payment intent (pi_3LhdBED3Wg9v9Yjr0jE14OXH): https://dashboard.stripe.com/test/events/evt_3LhdBED3Wg9v9Yjr0DtY9Cp8
Scroll to the bottom of this page to see the latest activity: https://dashboard.stripe.com/test/payments/pi_3LhdBED3Wg9v9Yjr0jE14OXH
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.
How are you presenting the payments page? Are you using a custom payment form? Payment Element? Checkout?
we use your front end stuff
We have a lot of front-end stuff. Is that the Payment Element or is it the Card Element?
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
}
});```
Yup, that's correct. I would recommend looking through this guide: https://stripe.com/docs/payments/card-element
It looks like your Card Element is creating a Payment Intent, but is not confirming the card properly
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.
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.
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
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok use webhooks, got it. Thank you so much.