Answers.Body: <p>Just to update this with an answer, thanks very much to P&amp;T's excellent dev team.</p>
  
  <p>The model implementing <code>RequestResponseInterface</code> returned from the gateway's <code>authorize()</code> method <code>isSuccessful()</code> method should <strong>only return true when completing a payment</strong>.</p>
  
  <p>I also had to return false on the <code>isProcessing()</code> method during my tests. Not sure what that method does but setting both those methods to return <code>false</code> fixed the issue.</p>
  
  <p>It was a recent change in the commerce code that identified this bug in my gateway's code.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-02T15:47:11.533Z
Answers.LastActivityDate: 2019-04-02T15:47:11.533Z
Answers.UserDisplayName: billythekid
Body: <p>Recently I've found that when a customer goes to checkout and hits the <code>craft\commerce\controllers actionPay()</code> using a custom gateway that it's automatically marking the cart as complete. </p>
  
  <p>This never used to happen, the gateway would set the cart to complete after receiving a webhook response itself at a later time, allowing the customer to go back and update their cart before checking out properly(or not as they decide).</p>
  
  <p>Now if they hit the back button they, obviously, have an empty cart as it's been marked as completed (along with the automated emails etc that are sent at that time).</p>
  
  <p>Can someone point me in the right direction on how to stop this auto-complete from happening?</p>
  
Tags: <plugin-craftcommerce2>
Title: Cart completed at gateway redirect issue
ThreadText: # Cart completed at gateway redirect issue
  
  (Asked by: username_0 on 2019-03-06)
  
  Recently I've found that when a customer goes to checkout and hits the `craft\commerce\controllers actionPay()` using a custom gateway that it's automatically marking the cart as complete.
  
  This never used to happen, the gateway would set the cart to complete after receiving a webhook response itself at a later time, allowing the customer to go back and update their cart before checking out properly(or not as they decide).
  
  Now if they hit the back button they, obviously, have an empty cart as it's been marked as completed (along with the automated emails etc that are sent at that time).
  
  Can someone point me in the right direction on how to stop this auto-complete from happening?
  
  **Tags:** plugin-craftcommerce2
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-04-02. Score: 1 | Accepted answer
  
  Just to update this with an answer, thanks very much to P&T's excellent dev team.
  
  The model implementing `RequestResponseInterface` returned from the gateway's `authorize()` method `isSuccessful()` method should **only return true when completing a payment**.
  
  I also had to return false on the `isProcessing()` method during my tests. Not sure what that method does but setting both those methods to return `false` fixed the issue.
  
  It was a recent change in the commerce code that identified this bug in my gateway's code.
  
  
  ---
  
  