Good Morning,

Got a question regarding using CURL to automate the submission of a form.

What I'm trying to accomplish is to avoid someone submitting a paypal payment more than one time for a purchase through my shopping cart.
I can do it by submitting the form to paypal and have it open in the same window that it originates from, but I would also like to keep the dealer logged into their back office at the same time.

To keep them on their website, I send the form to paypal designating a new window, but that leaves the dealer on the page with the paypal button, so if they click on it again, there is the possibility of them making the payment a second time...

So, what I thought was I could use an interim page to sent them to when they click the pay now button, and that page could check the status of the shopping cart... If it shows as ordered (meaning payment was made), then it would just redirect them to their back office, but if it isn't ordered, I thought I could us CURL possibly to submit the form to Paypal automatically.

Does anybody know whether that would work, and take them to the paypal site to make the payment?

I know I can go through the process to figure it out, but figured someone in here may already have the answer and save me some time in coding a test script.

Thanks in advance for your feedback.

Douglas

Recommended Answers

All 3 Replies

could you not use a pop out window?

Not sure how that would work, or if it would even address the core issue.

Im not sure how the generic buttons work, but you could put a "disabled" class (or attribute if it's an actual submit button) on the button, and wait for your callback to determine what happened...

Im not sure that's even a possibility for you...

You could do something like...

var page = window.open(paypalurl);
disableClickFunction(); //change it's class, click handler, etc...
page.onbeforeunload = allowClickFunction; //set class/click handler/etc.. back to original state.

Again, Im not sure if you will be able to keep reference to the child window since it's cross domain... but it's worth a shot?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.