Answers.Body: <p>Looks like your redirect does not contain the full url back to your site. </p>
  
  <p>The error shows:</p>
  
  <p><code>195.170.169.29 - - [20/Jul/2016:09:05:17 +0100] "POST /index.php/actions/commerce/payments/...
  </code></p>
  
  <p>But I would expect to see a url starting with <code>http://sitename.com/</code> since your gateway needs the full url to redirect you back to your site.</p>
  
  <p>Make sure you have a siteUrl set up in your craft settings: <a href="https://craftcms.com/support/site-url" rel="nofollow">https://craftcms.com/support/site-url</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-22T10:07:49.407Z
Answers.Text: I had the same issue with downloading pdfs on the "My Orders" section.
  As craft commerce is located in a directory called "shop" example.com/shop "shop" seems to be missing from the URL. 
  
  <h4>Receipt (<a href="{{ order.getPdfUrl('receipt') }}">Download</a>)</h4> 
  
  This misses the
Answers.UserDisplayName: Dan Lee
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-22T11:24:32.187Z
Answers.Text: Not sure what you mean, but yes, it is important to set a siteUrl so that urls perform correctly.
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-21T13:40:38.090Z
Answers.LastActivityDate: 2016-07-21T13:40:38.090Z
Answers.UserDisplayName: Luke Holder
Answers.Body: <p>We had a similar issue to this recently and found it was caused by CSRF protection being turned on, SagePay is attempting to POST data back to your server but without the CSRF token it becomes an invalid request.</p>
  
  <p>The solution to this is to add a quick check in your <code>config/general.php</code>:</p>
  
  <pre><code>return array(
      'enableCsrfProtection' =&gt; !isset($_GET['p']) || $_GET['p'] !== 'actions/commerce/payments/acceptNotification',
  );
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-28T15:48:42.943Z
Answers.LastActivityDate: 2017-09-28T15:48:42.943Z
Answers.UserDisplayName: Paul Blundell
Body: <p>When I test with my payment gateway (Sage Pay) I get a server error stating Craft Commerce isn't providing a redirect after payment is received:</p>
  
  <pre><code>Server error 5006: Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL.
  </code></pre>
  
  <p>This is what is shown in my error logs:</p>
  
  <pre><code>195.170.169.29 - - [20/Jul/2016:09:05:17 +0100] "POST /index.php/actions/commerce/payments/completePayment?commerceTransactionId=9&amp;commerceTransactionHash=b965d6bb8ca17ffc475849ab878721d5 HTTP/1.1" 404 50171 "-" "SagePay-Notifier/1.0"
  </code></pre>
  
  <p>Does anyone know what might be causing the redirect issue?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-13T16:22:07.100Z
Comments.Text: Check the last three points in the solution section - http://www.sagepay.co.uk/support/error-codes/5006-unable-redirect-vendors-web-site-vendor-failed-provide-redirectionurl
Comments.UserDisplayName: Luke Pearce
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-07-21T08:42:30.093Z
Comments.Text: I have checked my logs and updated original message above. Spoken to web host provider and Sage Pay regarding the help article above but none the clearer - which makes me think that it is an issue with how I have set up Craft Commerce. I have replaced some of the redirect values in the template with shop/inkjet-flex/ instead of shop/commerce/ - would that be an issue?
Comments.UserDisplayName: Dan Lee
Tags: <plugin-craftcommerce><redirect>
Title: Craft Commerce: Sage Pay - Redirect Required after payment?
ThreadText: # Craft Commerce: Sage Pay - Redirect Required after payment?
  
  (Asked by: username_0 on 2016-07-13)
  
  When I test with my payment gateway (Sage Pay) I get a server error stating Craft Commerce isn't providing a redirect after payment is received:
  
  ```
  Server error 5006: Unable to redirect to Vendor's web site. The Vendor failed to provide a RedirectionURL.
  
  ```
  
  This is what is shown in my error logs:
  
  ```
  195.170.169.29 - - [20/Jul/2016:09:05:17 +0100] "POST /index.php/actions/commerce/payments/completePayment?commerceTransactionId=9&commerceTransactionHash=b965d6bb8ca17ffc475849ab878721d5 HTTP/1.1" 404 50171 "-" "SagePay-Notifier/1.0"
  
  ```
  
  Does anyone know what might be causing the redirect issue?
  
  **Tags:** plugin-craftcommerce, redirect
  
  > **Comments:**
  > **username_1**: Check the last three points in the solution section - http://www.sagepay.co.uk/support/error-codes/5006-unable-redirect-vendors-web-site-vendor-failed-provide-redirectionurl  
  > **username_0**: I have checked my logs and updated original message above. Spoken to web host provider and Sage Pay regarding the help article above but none the clearer - which makes me think that it is an issue with how I have set up Craft Commerce. I have replaced some of the redirect values in the template with shop/inkjet-flex/ instead of shop/commerce/ - would that be an issue?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2016-07-21. Score: 2 | Accepted answer
  
  Looks like your redirect does not contain the full url back to your site.
  
  The error shows:
  
  `195.170.169.29 - - [20/Jul/2016:09:05:17 +0100] "POST /index.php/actions/commerce/payments/...`
  
  But I would expect to see a url starting with `http://sitename.com/` since your gateway needs the full url to redirect you back to your site.
  
  Make sure you have a siteUrl set up in your craft settings: <https://craftcms.com/support/site-url>
  
  > **Comments:**
  > **username_0**: I had the same issue with downloading pdfs on the "My Orders" section. As craft commerce is located in a directory called "shop" example.com/shop "shop" seems to be missing from the URL.   <h4>Receipt (<a href="{{ order.getPdfUrl('receipt') }}">Download</a>)</h4>   This misses the  
  > **username_2**: Not sure what you mean, but yes, it is important to set a siteUrl so that urls perform correctly.  
  
  ---
  
  ### Answer by username_3 on 2017-09-28. Score: 1
  
  We had a similar issue to this recently and found it was caused by CSRF protection being turned on, SagePay is attempting to POST data back to your server but without the CSRF token it becomes an invalid request.
  
  The solution to this is to add a quick check in your `config/general.php`:
  
  ```
  return array(
      'enableCsrfProtection' => !isset($_GET['p']) || $_GET['p'] !== 'actions/commerce/payments/acceptNotification',
  );
  
  ```
  
  
  ---
  
  