You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When receiving the customer.subscription.deleted event, the lookup by reference fails, as the subscription appears to have been expired, already… at least when using the cancelImmediately option.
2019-01-02 12:45:39 [-][-][-][warning][stripe] Subscription with the reference “sub_EGnwT4PvrrQoXK” not found when processing webhook evt_1DoGanIS4LqbsGJB6YDcCqyb
Trying the same resulting SQL with a non-expired subscription, or explicitly setting isExpired: true or status: 'any' will find the subscription just fine.
What I don't understand though, is how the subscription is marked as expired, before the webhook arrives. Ah, found some evidence re: immediate cancellation that would suggest a subscription can be silently expired, outside the webhook loop.
This was uncovered as a result of a handler for craft\commerce\services\Subscriptions::EVENT_AFTER_EXPIRE_SUBSCRIPTION not firing—it seems as though the subscription is being expired in the database, but the event never fires, because the webhook doesn't find the subscription, and bails…
Re: research, above… I'll submit another issue with craftcms/commerce with this info…
Sorry for the rambling! I may have partially resolved my own question/curiosity, but still believe there is a bug in how the webhook deals with “already-expired” subscriptions. My sense is that the EVENT_AFTER_EXPIRE_SUBSCRIPTION event should always fire, regardless of how the subscription is expired (immediately, or organically, at the period’s end).
The text was updated successfully, but these errors were encountered:
When receiving the
customer.subscription.deleted
event, the lookup byreference
fails, as the subscription appears to have been expired, already… at least when using thecancelImmediately
option.Trying the same resulting SQL with a non-expired subscription, or explicitly setting
isExpired: true
orstatus: 'any'
will find the subscription just fine.What I don't understand though, is how the subscription is marked as expired, before the webhook arrives.Ah, found some evidence re: immediate cancellation that would suggest a subscription can be silently expired, outside the webhook loop.This was uncovered as a result of a handler for
craft\commerce\services\Subscriptions::EVENT_AFTER_EXPIRE_SUBSCRIPTION
not firing—it seems as though the subscription is being expired in the database, but the event never fires, because the webhook doesn't find the subscription, and bails…Re: research, above… I'll submit another issue with
craftcms/commerce
with this info…Sorry for the rambling! I may have partially resolved my own question/curiosity, but still believe there is a bug in how the webhook deals with “already-expired” subscriptions. My sense is that the
EVENT_AFTER_EXPIRE_SUBSCRIPTION
event should always fire, regardless of how the subscription is expired (immediately, or organically, at the period’s end).The text was updated successfully, but these errors were encountered: