Hi,
Just trying to find the best way to do this...
I have a request form that included a $$$ amount. What I want to do is send the $$ amount to paypal and if the payment is actually made, take all of the fields from the form and save it. But, how do I get the form fields after the redirect back from paypal?
I've got the code to do the saving, I'm just not sure what plugins I should be using so that paypal returns back to me all of the form data that I collected prior to redirecting to it.
Make sense? Any clues?
Thanks
Hi wmena,
You could possibly do this with IPN but I wouldn't even try to do things this way round.
Save the data when the form is submitted marked as 'unpaid'. When payment is confirmed switch the status to 'paid'; you can do the housekeeping every week or so and delete the old 'unpaid' entries if you need to.
Bob
Yea, that's certainly one way... but I'm actually saving the data to a phpBB3 post.
Maybe I can save the data somewhere temporarily, then read it and write it out to phpBB3 when it's verified. I just need a way to add an ID to match the form data with the paypal info.
Ideas?
Hi wmena,
OK, that makes sense.
You could create a ChronoForms table for the form to save the data temporarily and create a unique identifier to pass to PayPal in the return_url. I'd probably use a random string.
Bob
OK... this is starting to sound promising. I can save the data.
I'm just trying to work out the flow of control.
I assume I use the redirect plugin to send info to paypal... but how do I send the random id to paypal... somehow using the Target URL field?
Do I have to use any additional plugins after flow comes back from paypal?
Thanks!
Hi wmena,
Not quite, add it as a variable in the return_url parameter then read the value when control is returned to you.
Bob
OK. Got all the code written.
I call a php program which does the following:
Save data to database (creating a unique ID)
Call paypal sending it unique ID.
paypal comes back, says verified (or not)
If verified, I read the record from database and stamp it verified
I do some post processing (add data to a phbb3 forum)
All this works fine when I put it in the Submit URL field.
But what doesn't happen is the email getting sent. I guess control never comes back to chronoforms.
Is there a better place to put this code?
Hi wmena,
You really want to do the ReDirect as the las thing so it will be important to manage the run-order. Some code may need to go into the OnSubmit After box.
The easiest way to manage a reDirection is to use the ReDirect Plugin which will set the ChronoForms ReDirect URL which is executed after everything else.
Bob
Well, I've got most things working. The only thing not working is sending email... because I'm not using the redirect. I'll try it.
But I want the email to only send if the paypal transaction comes back verified. IS that possible to do??
Hi Mike 11,
You've more or less described it yourself.
Store the data in a database table when the form is submitted including (a) a column for the unique ID and (b) a status column set to 'waiting'.
Add the unique ID to the information passed to PayPal, I usually set it as the invoice number but be sure that it is included in the IPN Notify URL.
When the IPN request is received look up the saved data using the unique ID and update the status depending on the info from PayPal.
Remember that there can be several IPN notices - if the user is paying by e-cheque then they can happen several days later so your IPN code has to be able to complete the transaction.
Bob
Great... Thank you for your reply...
Is there anyone that could show me the code that would implement this?? I am not a programmer by any means (but with these amazing forums and tutorials, somehow I am able to do most everything)...
Thanks to all... 😀