0

I'm setting up Subscriptions and keep running into an issue where, on the subscription page shown here: http://d.pr/i/1jWCX, if the user fills out the form in a way that results in an error (say, a bad credit card), when they click back to this page from the error message page, they see something like this: http://cl.ly/image/3o0v3Y3w041t

The URL is the issue.

In the working page, the url is /join/membership-payment/premier - with segment_3 being the trigger for different plans they can buy. In this case, premier.

In the page they are returned to, the url is /join/membership-payment/dev.augi.com/join/membership-payment and segment_3 is the domain name.

This makes me think that Subscriptions is creating its return URL value incorrectly. It works just fine if there are no errors in the form.

This is my subscriptions tag:

{exp:subs:subscribe 
  payment_method="authorizenet_cim"
  plan="{embed:plan}" 
  return="join/create-profile/step-1/%SUBS_HASH%"
}
0

Chad,

I make sure the the error is embedded into the {exp:subs:subscribe ....} subscription form that way an error doesn't leave the page. You could test with variables as seen below:

       <!-- Errors Section -->
        <div class="row"> 
            {if subs:no_results}
            <div class="alert alert-danger">This plan does not exists</div>
            {/if}

            {if subs:no_access}
            <div class="alert alert-danger">You don't have access to this resource</div>
            {/if}

            {if subs:total_errors}
            <div class="alert alert-danger">
                <ul>
                    {subs:form_errors}
                    <li>{subs:error}</li>
                    {/subs:form_errors}
                </ul>
            </div>
            {/if}
        </div> 
        <!--/ End Errors Section -->

The other thing I noted while looking at your code is that the return for me always starts with a slash as seen below:

return="/membership/thank_you_gift/%VOUCHER_HASH%

Let me know if that helps.

| improve this answer | |
0

After a heck of a lot of searching and trial and error, resulting in a lot of malformed URLs along the lines of my original problem description, I began to look at the url_cancel field in the exp_subs_requests table after each failed test transaction that was sending me to a junk URL. I finally got it to send me to the correct URL upon subscription error by changing line 39 in /subs/src/model/Request.php:

//$charge->url_cancel = ee()->functions->fetch_current_uri();
$charge->url_cancel = ee()->config->item('site_url').'/'.ee()->session->tracker['1'];

it appears that this line is setting the url_cancel after the URI has already changed in some manner. Setting it to the last page in the tracker array was the only way I could get it to send me back to the page with the sub form upon error. Not sure why this is but for me its now working.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.