Skip to content
Snippets Groups Projects
Commit a81361cd authored by mattwire's avatar mattwire
Browse files

Handle charge.succeeded/charge.captured when no customer_id is provided

parent 2391a855
No related branches found
No related tags found
1 merge request!656.1.3
...@@ -260,6 +260,13 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN { ...@@ -260,6 +260,13 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
return TRUE; return TRUE;
case 'charge.succeeded': case 'charge.succeeded':
// For a recurring contribution we can process charge.succeeded once we receive the event with an invoice ID.
// For a single contribution we can't process charge.succeeded because it only triggers BEFORE the charge is captured
if (empty(CRM_Stripe_Api::getObjectParam('customer_id', $this->_inputParameters->data->object))) {
return TRUE;
};
case 'charge.captured':
// For a single contribution we have to use charge.captured because it has the customer_id.
$this->setInfo(); $this->setInfo();
if ($this->contribution['contribution_status_id'] == $pendingStatusId) { if ($this->contribution['contribution_status_id'] == $pendingStatusId) {
$params = [ $params = [
......
...@@ -184,6 +184,7 @@ class CRM_Stripe_Webhook { ...@@ -184,6 +184,7 @@ class CRM_Stripe_Webhook {
'charge.failed', 'charge.failed',
'charge.refunded', 'charge.refunded',
'charge.succeeded', 'charge.succeeded',
'charge.captured',
'customer.subscription.updated', 'customer.subscription.updated',
'customer.subscription.deleted', 'customer.subscription.deleted',
]; ];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment