Event for a Charge (Pre-Authorization) expiring.

164 views
Skip to first unread message

Steven

unread,
May 8, 2017, 3:33:16 PM5/8/17
to Stripe API Discussion
Hello,

We are interested in knowing when a pre-authorization has expired. To that end, we've noticed two things:

1. There is no specific attribute for an expired Charge on the Charge object itself.
2. I didn't see any mention of a specific event for a un-captured Charge (a.k.a., a pre-authorization) expiring.

For #1, we're currently determining a Charge is expired if it's been refunded, but not captured. Something like this:

def expired?
  stripe_charge.refunded? && !stripe_charge.captured?
end

Is that a safe assumption/logic correct?


For #2, we're guessing that since there's no explicit expired attribute, there's no explicit corresponding event. e.g., there's no a charge.expired event. But there is a charge.refunded event. Could we listen for that event, and then use logic like #1 (above) to determine that the pre-authorization just expired?

Thank you,
Steven

Remi J.

unread,
May 8, 2017, 3:51:29 PM5/8/17
to api-d...@lists.stripe.com
Hey Steven,

At the moment, we do not send an event when an authorization is released. This means that, internally, we refund the charge after 7 days but this does not trigger a `charge.refunded` event (or any other event). You would need to keep track of this on your end instead. For example, you'd track the time at which an authorization expires and run a cron job daily that looks at any authorization that is past that time and hasn't been captured and then flag it as released.

You can check for `refunded: true` and `captured: false` as you mentioned to confirm when an authorization was released automatically. You can also look at the `created` property on the refund to know when it was refunded.

Hope this helps!
Remi

--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss+unsubscribe@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Steven

unread,
May 8, 2017, 4:07:13 PM5/8/17
to Stripe API Discussion
Thanks, Remi.

I don't suppose you know if there's any plan to either add an explicit event, or start triggering the `capture.refunded` event?

Related - is there a way to manually release an authorization, w/o capturing it?

Thanks,
Steven
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.

Remi J.

unread,
May 8, 2017, 4:20:21 PM5/8/17
to api-d...@lists.stripe.com
Hey Steven,

We don't have specific plans to add a specific event in the near future though I do agree that it would be useful so I will raise it with the team. 

You can release an authorization by calling the Create Refund API [1]. This works the same way on authorization as one captured charges as those are ultimately the same object in the API.

To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss+unsubscribe@lists.stripe.com.
Reply all
Reply to author
Forward
0 new messages