Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Stripe Stripe
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 59
    • Issues 59
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Extensions
  • StripeStripe
  • Issues
  • #71

Closed
Open
Created Jul 26, 2019 by jamie@jamieDeveloper

no receive date - possibly caused by newer Stripe API

The symptom is recurring contributions with either the contribution date and/or the payment date set to 1969-12-31.

There seems to be a lot of refactoring since the last release, so I suspect this point can be simply closed and will be addressed by the next release, but I though I'd open it just to document.

It seems that with more recent Stripe API versions (I'm still waiting on confirmation) the object returned by Stripe has changed and the date is no longer available in the expected position.

I made this minor change to fix it:

diff --git a/CRM/Core/Payment/StripeIPN.php b/CRM/Core/Payment/StripeIPN.php
index 8e7c701..7dd26bc 100644
--- a/CRM/Core/Payment/StripeIPN.php
+++ b/CRM/Core/Payment/StripeIPN.php
@@ -189,7 +189,16 @@ class CRM_Core_Payment_StripeIPN extends CRM_Core_Payment_BaseIPN {
             break;
 
           case 'receive_date':
-            $value = date("Y-m-d H:i:s", $this->_inputParameters->data->object->date);
+            $value = NULL;
+            $date = NULL;
+            // How Stripe passes the date seems to have changed.
+            // This is the old way.
+            $date = $this->_inputParameters->data->object->date;
+            if (empty($date)) {
+              // This is the new way.
+              $date = $this->_inputParameters->data->object->status_transitions->paid_at;
+            }
+            $value = date("Y-m-d H:i:s", $date);
             break;
 
           case 'subscription_id':
Assignee
Assign to
Time tracking