Processing charge.failed event is too restrict
When endpoint processes charge.failed it calls Contribution.getsingle
. Action getsingle
is more restrictive than get
because when contribution does not exist then getsingle
throw exception.
I have such history of Stripe donations:
- customer.created
- customer.updated
- payment_method.attached
- customer.source.created
- charge.failed
On 5. step there is no contribution in CiviCRM yet. This is a single donation, not subscription.
My idea is such:
- use
Contribution.get
with trxn_id = chargeId - when contribution exists, update status to Failed
- when contribution does not exists, create it with Failed status
Edited by scardinius