Forums

Paypal redirect - 302 found

johnoathome 15 Sep, 2015
Hi,

I'm getting a 302 found in firebug when using the Paypal redirect, and the Paypal site fails to load.

The demo paypal form works fine. If I link my form to the load event of the demo paypal form this also works. If I link it to the submit event of the demo form it fails with 302 found.

If I copy the post url from firbug directly into the browser address bar it fires the event in my form and loads the paypal site. Similarly the debug url is good and brings up paypal if entered directly.

Most of the pages in the form submit via ajax so my first thought was to disable the ajax submit for the call to the paypal redirect. What is strange is that disabling ajax on any but the first page does not turn it off! No matter how I set the submit, it still loads pages through ajax. I suspect this may have something to do with it. As far as I'm aware you can't do cross domain ajax calls. Notable the POST url includes tvout=ajax.

I am now also getting an error in the console => "ReferenceError: chronoforms_validation_signs is not defined". I'm not sure its related but it is suspicious. I'm not currently using CF validation in the form.

I've done quite a bit of testing but I can't track this down. I could work around this in the worst case scenario by shelling out to a separate form for the paypal stuff but its a bit untidy. Any thoughts would be appreciated.

John
johnoathome 16 Sep, 2015
Well I've worked around it and in the process learned a couple of things that I thought I'd share.

1. "Shelling out" to another form is not a bad thing. The form I was building was monolithic. It had about 20 pages and had got to the stage where even I found it hard to understand. I went back to basics and drew it up again in a flow chart and ended up breaking it into 4 separate forms - Introduction, venue selection, payment processing and finalisation (its for appointment booking). This modular design is a lot easier to follow and provides a lot more flexibility. So for example,depending on which payment option the user selects, a different payment processor form is loaded. The great thing about this is that I can reuse the payment "modules" for other forms and its easy to add a new payment processor. The only down side is that you have to pass parameters around between forms but overall this modular architecture is way better than monolithic for complex forms (in my view).

2. I like Ajax, but in many scenarios its just not practical. Because it doesn't fire document ready it can cause all sorts of things to break. The second lesson I have learned is to develop my forms without Ajax first. Once they are all working, test them with Ajax and see how they go.

In the end I'm pretty sure that Ajax was the problem, thought I never really did pinpoint it.

Hope this helps someone.
GreyHead 17 Sep, 2015
Hi John,

Like you I suspect that the Ajax was the problem - or at least a contributory factor. And I agree that breaking forms into simpler chunks is often helpful both for the developer and the user.

You can use the Session to Data and Data to Session actions to pass data between forms - just make sure to add a Session ID to all the actions in the same set.

Bob
This topic is locked and no more replies can be posted.