#mauriver21

1 messages ยท Page 1 of 1 (latest)

frank valveBOT
unborn berry
#

That depends entirely on how you want to go about it.

#

Or how you want to filter

#

Charges are the ones with a relatively binary status property so if you simply want to see all payments where charge.status == 'failed', that might be the best place to start

wild hedge
#

I've noticed on this flow when I create a failed payment intent, inmediatly it doesn't get reflected the failed status on the charge. It takes between 10 - 15 seconds to update the charge with failed status when doing this.

await simulateFailedPaymentIntent(customerId);

const charges = await stripe.charges.search({
      query: 'status:"failed"',
      expand: ['data.customer', 'data.payment_intent'],
});

console.log(charges.data.find(charge => charge.customer.id === customerId)) //undefined
#

so I was thinking it would better to search from failed payment intents, but there is no a failed payment intent status

unborn berry
#

Right, because Payment Intents are designed to be recoverable. Additionally you may see different performance if you use the List API. Search tables are not real time due to the time to index

wild hedge
#

Thxs for the confirmation

#

having this clear I will add a delay to my unit test

#

you were so helpful ๐Ÿ™‚

unborn berry
#

I'm glad I was able to shed a little ๐Ÿ’ก on the subject

wild hedge
#

I tried directly list so now I don't need the delay due to what you mention, search tables are not real time. Is this clarification documented on stripe?

const charges = await stripe.charges.list({
      status: "failed",
      expand: ['data.customer', 'data.payment_intent'],
    });
covert birch
#

๐Ÿ‘‹ stepping in as Snufkin needed to step away

wild hedge
#

Thanks!! thats good to know

#

I don't have more questions, thanks again

#

๐Ÿ™‚

covert birch
#

Np!