#Is there a way to store failed payment history?

11 messages Β· Page 1 of 1 (latest)

grave geyser
#

The Order is placed only when the payment is successful.
I have a requirement to list failed/unsuccessful payments for a specific order.
Has anyone ever tried similar?
Please suggest anything regarding failed payment history.
Thanks in advanced πŸ™‚

uneven shuttle
#

That might include querying your payment provider's API to get the unsuccessful payments for a unique identifier for an order you sent to your payment provider

#

I'm not sure if Medusa holds any unsuccessful payment, because it calls the useCart hook when the payment is successful, I may be wrong tho

grave geyser
#

Hi @uneven shuttle, Medusa does not hold unsuccessful payments. You'll have an initiated Payment Session record if payment is unsuccessful. I wanted to know if anyone has tweaked the code to store the failed payments or if that makes sense to hold the failed payment records for an order.

#

Also to add more context, Payment and PaymentSession are different. I guess Payment records are made from the PaymentSession records once the cart is used to place the order. I might be wrong πŸ™‚

uneven shuttle
#

PaymentSession is created before the payment to hold the information for order, and Payment is created when payment is acutally made.

#

instead of creating a new entity or customize the order entity, i would modify the order page to get all payments related to that order

#

you know by calling payment's provider

grave geyser
#

Yep, that's right but my question is that Medusa does not store the failed payments so in that case I won't get the list. I know by making some changes in the DB and PaymentProcessor error handling code I can create new entries for the failed payments. I wanted to know if anyone has tried that or has some insights in similar feature.

uneven shuttle
#

sorry i didn't tried it before πŸ™‚ wanted to help with the knowledge i got

#

i don't want to give you wrong suggestions