Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
Results 1 to 3 of 3
-
01-28-2016, 05:42 PM #1New to the CF scene
- Join Date
- Jan 2016
- Posts
- 2
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Paypal in-context and ajax integration
Hi all,
I have spent loads of time looking at the paypal documentation and website examples that all the code is just blending into a mass of squiggles and dots...
The website I am building has a registration form which is submitted via an ajax call to a php script. The script stores the information in a db and returns a success message which is displayed inside the form.
What I want to do then is open the paypal in-context cart automatically to allow payment of the registration fee (site is for a charity fundraising event).
I can use the code from the paypal documentation to handle the cart, but how do I get it to trigger?
Also, I am assuming the cart will return a status. Would I then need a new ajax call to send this to the database and update the original form?
I don't do a lot with js and this is the first time I have used ajax. Please be gentle
-
01-28-2016, 06:38 PM #2Master Coder
- Join Date
- Jan 2011
- Location
- Washington
- Posts
- 6,251
- Thanks
- 30
- Thanked 859 Times in 857 Posts
Just a thought: Don't do that. Have your registration page get an email address [you will need that to ask for more donations in the future-believe me I've work on charity stuff before] That email has a conformation code to a page and the user must get the email and click on the link and hit a button that says he have successfully registered. Then you go to the paypal page.
How?
Code:<!DOCTYPE html> <html> <head> <title>title</title> </head> <body> <button onclick="new_page();">You have been registared</button> <script type="text/javascript"> function new_page(){ window.open("http://www.w3schools.com/jsref/met_win_open.asp"); } </script> </body> </html>Evolution - The non-random survival of random variants.
Physics is actually atoms trying to understand themselves.
-
01-31-2016, 11:35 AM #3New to the CF scene
- Join Date
- Jan 2016
- Posts
- 2
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Thanks for the suggestion, but not what I am after. We run a fundraising event which others charities use to raise money. I need the Paypal in-context checkout to open immediately after saving the walkers details.
This is because the registration fee is how we fund the event so registration cannot complete until the fee has been paid. In addition, once a walker registers we pass details to the charity they are walking for. Any delay in this process reduces the time they have to contact the walker and for them to collect sponsorship.
I have since manged to get an automatic redirect to paypal working using a js click event (document.getElementById('t1').click()
in the 'success' part of the of the ajax call which saves the form, but I cannot get the in-context checkout to work.
Any advice would be very much appreciated.



Reply With Quote
