Answers.Body: <p>At first glance I cannot tell you why your plugin runs intermittently.
  But if your plugin is interacting with Charge, there are some log functions you can use that may be helpful. </p>
  
  <pre><code>craft()-&gt;charge_log-&gt;email("yada yada");
  craft()-&gt;charge_log-&gt;note("yada yada");
  craft()-&gt;charge_log-&gt;error("yada yada");
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-12T14:06:18.970Z
Answers.Text: Thanks for that, but since the onCharge event is not triggering in these cases, theres nothing that I would really want to log. And its not being added to the Charge logs, so it's not just my plugin isn't working - it looks like Charge isn't receiving the information that the payment has gone through.
Answers.UserDisplayName: Jai Redden
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-12T12:40:38.367Z
Answers.LastActivityDate: 2019-02-12T12:40:38.367Z
Answers.UserDisplayName: Jim Wyse
Body: <p>I have some Charge payments on my website, and I have registered the onCharge event in my plugin, like so:</p>
  
  <pre><code>public function init()
  {
      parent::init();
      craft()-&gt;on('charge.onCharge', function(Event $event) {
          // Function logic here
      }
  }
  </code></pre>
  
  <p>And 95% of the time it works, but sometimes it doesn't trigger. The transaction goes through, and I can see in my Stripe account that it has been successful, but the payment does not appear in my Charge Logs in Craft, and the onCharge event never triggers.</p>
  
  <p>Can anyone help? Any suggestions?</p>
  
  <p>Thanks, Jai</p>
  
Tags: <plugin-development><plugin-charge><stripe>
Title: Charge Plugin - Stripe payments occasionally not being received in craft
ThreadText: # Charge Plugin - Stripe payments occasionally not being received in craft
  
  (Asked by: username_0 on 2019-02-04)
  
  I have some Charge payments on my website, and I have registered the onCharge event in my plugin, like so:
  
  ```
  public function init()
  {
      parent::init();
      craft()->on('charge.onCharge', function(Event $event) {
          // Function logic here
      }
  }
  
  ```
  
  And 95% of the time it works, but sometimes it doesn't trigger. The transaction goes through, and I can see in my Stripe account that it has been successful, but the payment does not appear in my Charge Logs in Craft, and the onCharge event never triggers.
  
  Can anyone help? Any suggestions?
  
  Thanks, Jai
  
  **Tags:** plugin-development, plugin-charge, stripe
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-12. Score: 1
  
  At first glance I cannot tell you why your plugin runs intermittently.
  But if your plugin is interacting with Charge, there are some log functions you can use that may be helpful.
  
  ```
  craft()->charge_log->email("yada yada");
  craft()->charge_log->note("yada yada");
  craft()->charge_log->error("yada yada");
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for that, but since the onCharge event is not triggering in these cases, theres nothing that I would really want to log. And its not being added to the Charge logs, so it's not just my plugin isn't working - it looks like Charge isn't receiving the information that the payment has gone through.  
  
  ---
  
  