#Santos

1 messages · Page 1 of 1 (latest)

young spindleBOT
fresh solar
#

Hi there

#

That will get you the Customer associated to each Refund

tardy trout
#

What if a source was used when creating the refund? Here's the log: req_jX4UXzIth6gxHK

fresh solar
#

Ah I'm sorry. You said "unlinked refunds"

#

I missed that

#

Hmmm no I don't believe there is any way to query the Customer for unlinked refunds....

#

There is no property on the Refund object that would indicate this other than the associated PaymentIntent/Charge

#

Which obviously doesn't exist in this case

tardy trout
#

Thanks for clarifying 👍

fresh solar
#

Sure thing

tardy trout
#

Ah one more question if you don't mind.

fresh solar
#

No problem

tardy trout
#

The way we were handling refunds before, we were pulling the latest invoice and grabbing the charge ID from it. We would then create a refund using this charge ID. This was for customers who decided to cancel their subscription via our UI.

We ran into an issue with downgrading products; if a customer downgraded their product, we would modify the subscription and then the existing refund creation logic would fail because the latest invoice was for a downgrade which has no charge ID.

So the steps are:

  • modify subscription (downgrade)
  • create refund using latest invoice charge (fails)

Would you recommend changing the order? So:

  • create refund using latest invoice charge
  • modify subscription (downgrade)

We want to create the refund after the subscription modification takes place; if the modification fails, we don't create a refund.

fresh solar
#

Yeah I wouldn't change the order

#

It sounds like you just don't want to rely on latest_invoice