Answers.Body: <p>I'm the developer of Charge.</p>
  
  <p>I've never directly observed that behaviour, but it sounds like it's most likely hitting a redirect failure and falling back to some base success/fail responses. </p>
  
  <p>The most likely cause of that, is that you've not specified the default success route in the Charge settings. You'll find that under <strong>Charge > Settings > General > Success URL</strong>. </p>
  
  <p>In there, you can specify the exact redirect route to push a user to after a successful transaction. </p>
  
  <p>A common format would be something like <code>thanks/{slug}</code>, and load up your receipt template, on a path like <code>payments/receipt</code> etc..</p>
  
  <p>Alternatively you can supply a hidden input on the form called <code>redirect</code> with the url you'd want the user redirected to after the transaction completes. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-10T17:12:54.890Z
Answers.Text: Thanks, Joel! I don't seem to have the option to set the Success URL (http://imgur.com/xftdNSV). I do have the hidden redirect input, though - `{% if charge is defined %} %<input type="hidden" name="redirect" value="/thanks/{{charge.hash}}">{% endif %}`. But still no luck.
Answers.UserDisplayName: anguiac7
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-10T17:15:52.323Z
Answers.Text: PS, I just noticed the extraneous `%` in there. I removed it and it doesn't seem to make a difference.
Answers.UserDisplayName: anguiac7
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-11T00:02:02.720Z
Answers.Text: It seems like the redirect hidden input is being ignored. No matter what I change the value to, the page I'm directed to is the donate page with the "1" on it.
Answers.UserDisplayName: anguiac7
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-13T13:05:10.133Z
Answers.Text: You explicitly shouldn't be putting that redirect hidden input within an {% if defined ..%} block. It needs to be just a hidden input on the form. Looking at the "Success URL" I mentioned above, the wording has changed for the full release, so I actually mean just the "Charge URL Format". Just set that and the template path if you'd prefer.
Answers.UserDisplayName: Joel Bradbury
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-14T01:04:15.133Z
Answers.Text: Well, when I add it just as a hidden input, Craft freaks out because the charge variable is undefined. However, if I remove the hidden input and set the preference in Charge, I'm still redirected to the "1" upon form submission.
Answers.UserDisplayName: anguiac7
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-14T08:27:08.743Z
Answers.Text: The hidden input should have a value of 'thanks/{hash}' or similar. Not including the {{ charge.hash }} part.
Answers.UserDisplayName: Joel Bradbury
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-14T12:31:02.083Z
Answers.Text: Switching the redirect hidden field to have a value of "thanks/{hash}" didn't seem to make a difference. Still being directed to /donate after the form submission. `<input type="hidden" name="redirect" value="thanks/{hash}">`
Answers.UserDisplayName: anguiac7
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-21T09:41:45.783Z
Answers.Text: Has anyone has any success on this one? We're trying to set a custom redirect based on the current page. `<input type="hidden" name="redirect" value="{{ craft.request.getPath() }}/success/{hash}">` but `{hash}` isn't being parsed/rendered into the form.
Answers.UserDisplayName: Brendan Underwood
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-21T12:53:42.793Z
Answers.Text: @BrendanUnderwood the `{hash}` explicitly isn't rendered in the form. It should be passed through to the submit unaltered. It only get's rendered at the point the Charge has actually been created, which is at the end of the request.
Answers.UserDisplayName: Joel Bradbury
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-21T16:24:16.267Z
Answers.Text: @JoelBradbury I still haven't been able to find a solution for this. Nothing I do seems to change the result.
Answers.UserDisplayName: anguiac7
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-22T10:19:53.090Z
Answers.Text: @anguiac7 can you send me some details directly (to support@squarebit.co.uk) and I'll look at what you're actually doing on the page. It's going to be something specific with your setup that you've got misconfigured.
Answers.UserDisplayName: Joel Bradbury
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-23T00:54:16.337Z
Answers.Text: @JoelBradbury thanks mate, we have it working on our end. Although we're not using the `{hash}` in our case unless you have a reason to.
Answers.UserDisplayName: Brendan Underwood
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-10T16:12:01.323Z
Answers.LastActivityDate: 2016-06-10T16:12:01.323Z
Answers.UserDisplayName: Joel Bradbury
Answers.Body: <p>I have seen this before - yesterday in fact, with this plugin. But I was messing about trying to get it to report errors back to the calling template from a plugin I was writing. I still don't know what caused it, but there might be a clue in that :/</p>
  
  <p>Currently I have an issue with it where the redirect to success url never actually completes. Just hangs there. No errors in the logs, all successful. I'm in testing mode for Stripe though; have you remembered to change your Account mode to Live?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-10T13:46:44.830Z
Answers.Text: Hmm... I'll have to investigate that further. I've been wracking my brain trying to find anything that could be causing it. Craft logs are ok, Charge logs say successful, Apache logs are fine. It just seems to be ignoring the part where Charge intercepts the form and directs it to the thank you page.
  
  I'm still in testing mode, but it completes successfully on my Vagrant box I'm developing on. Pushing to staging is when the issue happens. Can't find any differences between staging and Vagrant though...
Answers.UserDisplayName: anguiac7
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-10T10:32:42.127Z
Answers.LastActivityDate: 2016-06-10T10:32:42.127Z
Answers.UserDisplayName: Matt Wilcox
Body: <p>I've been trying to figure this out for a couple days now and haven't been able to. I'm using the Squarebit Charge plugin to accept donations on a website. </p>
  
  <p>I have everything working fine on my local Vagrant machine. However, when I push it to my staging server, the redirect to the "thank you" page never works. Instead of redirecting to the thank you page, the Donate page is reloaded and displays a single "1".</p>
  
  <p>Does anyone have any ideas? I do get a TypeError in console because the card expiry date field had to be changed. Stripe would complain that the card exp_month field wasn't present so I had to create that field. I get the error on my Vagrant box too so I don't think it's causing the process to fail.</p>
  
  <p>My staging link is here: <a href="http://kb.topsdev.net/donate" rel="nofollow">kb.topsdev.net/donate</a></p>
  
  <p>Any help is really appreciated.</p>
  
Tags: <plugins><redirect><plugin-charge>
Title: Charge plugin redirecting to page with "1" on it
ThreadText: # Charge plugin redirecting to page with "1" on it
  
  (Asked by: username_0 on 2016-06-10)
  
  I've been trying to figure this out for a couple days now and haven't been able to. I'm using the Squarebit Charge plugin to accept donations on a website.
  
  I have everything working fine on my local Vagrant machine. However, when I push it to my staging server, the redirect to the "thank you" page never works. Instead of redirecting to the thank you page, the Donate page is reloaded and displays a single "1".
  
  Does anyone have any ideas? I do get a TypeError in console because the card expiry date field had to be changed. Stripe would complain that the card exp\_month field wasn't present so I had to create that field. I get the error on my Vagrant box too so I don't think it's causing the process to fail.
  
  My staging link is here: [kb.topsdev.net/donate](http://kb.topsdev.net/donate)
  
  Any help is really appreciated.
  
  **Tags:** plugins, redirect, plugin-charge
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-06-10. Score: 4
  
  I'm the developer of Charge.
  
  I've never directly observed that behaviour, but it sounds like it's most likely hitting a redirect failure and falling back to some base success/fail responses.
  
  The most likely cause of that, is that you've not specified the default success route in the Charge settings. You'll find that under **Charge > Settings > General > Success URL**.
  
  In there, you can specify the exact redirect route to push a user to after a successful transaction.
  
  A common format would be something like `thanks/{slug}`, and load up your receipt template, on a path like `payments/receipt` etc..
  
  Alternatively you can supply a hidden input on the form called `redirect` with the url you'd want the user redirected to after the transaction completes.
  
  > **Comments:**
  > **username_0**: Thanks, username_1! I don't seem to have the option to set the Success URL (http://imgur.com/xftdNSV). I do have the hidden redirect input, though - `{% if charge is defined %} %<input type="hidden" name="redirect" value="/thanks/{{charge.hash}}">{% endif %}`. But still no luck.  
  > **username_0**: PS, I just noticed the extraneous `%` in there. I removed it and it doesn't seem to make a difference.  
  > **username_0**: It seems like the redirect hidden input is being ignored. No matter what I change the value to, the page I'm directed to is the donate page with the "1" on it.  
  > **username_1**: You explicitly shouldn't be putting that redirect hidden input within an {% if defined ..%} block. It needs to be just a hidden input on the form. Looking at the "Success URL" I mentioned above, the wording has changed for the full release, so I actually mean just the "Charge URL Format". Just set that and the template path if you'd prefer.  
  > **username_0**: Well, when I add it just as a hidden input, Craft freaks out because the charge variable is undefined. However, if I remove the hidden input and set the preference in Charge, I'm still redirected to the "1" upon form submission.  
  > **username_1**: The hidden input should have a value of 'thanks/{hash}' or similar. Not including the {{ charge.hash }} part.  
  > **username_0**: Switching the redirect hidden field to have a value of "thanks/{hash}" didn't seem to make a difference. Still being directed to /donate after the form submission. `<input type="hidden" name="redirect" value="thanks/{hash}">`  
  > **username_2**: Has anyone has any success on this one? We're trying to set a custom redirect based on the current page. `<input type="hidden" name="redirect" value="{{ craft.request.getPath() }}/success/{hash}">` but `{hash}` isn't being parsed/rendered into the form.  
  > **username_1**: @username_2 the `{hash}` explicitly isn't rendered in the form. It should be passed through to the submit unaltered. It only get's rendered at the point the Charge has actually been created, which is at the end of the request.  
  > **username_0**: @username_1 I still haven't been able to find a solution for this. Nothing I do seems to change the result.  
  > **username_1**: @username_0 can you send me some details directly (to support@squarebit.co.uk) and I'll look at what you're actually doing on the page. It's going to be something specific with your setup that you've got misconfigured.  
  > **username_2**: @username_1 thanks mate, we have it working on our end. Although we're not using the `{hash}` in our case unless you have a reason to.  
  
  ---
  
  ### Answer by username_3 on 2016-06-10. Score: 2
  
  I have seen this before - yesterday in fact, with this plugin. But I was messing about trying to get it to report errors back to the calling template from a plugin I was writing. I still don't know what caused it, but there might be a clue in that :/
  
  Currently I have an issue with it where the redirect to success url never actually completes. Just hangs there. No errors in the logs, all successful. I'm in testing mode for Stripe though; have you remembered to change your Account mode to Live?
  
  > **Comments:**
  > **username_0**: Hmm... I'll have to investigate that further. I've been wracking my brain trying to find anything that could be causing it. Craft logs are ok, Charge logs say successful, Apache logs are fine. It just seems to be ignoring the part where Charge intercepts the form and directs it to the thank you page.  I'm still in testing mode, but it completes successfully on my Vagrant box I'm developing on. Pushing to staging is when the issue happens. Can't find any differences between staging and Vagrant though...  
  
  ---
  
  