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
No related merge requests found
......@@ -260,6 +260,13 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
return TRUE;
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();
if ($this->contribution['contribution_status_id'] == $pendingStatusId) {
$params = [
......
......@@ -184,6 +184,7 @@ class CRM_Stripe_Webhook {
'charge.failed',
'charge.refunded',
'charge.succeeded',
'charge.captured',
'customer.subscription.updated',
'customer.subscription.deleted',
];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment