...

View Full Version : PHP, PayPal, and Custom Ordering Information



Tilus
01-07-2010, 11:08 PM
I'm the web designer for a small company that is providing classes in Continuing Education for social workers, nurses, and other organizations. I would like to be able to offer a means of allowing potential attendees to these classes to register for them online, through a PHP form script and accepting payments via PayPal.

However, being a small company who presently lacks the resources to create and maintain a suitably secure online database solution, I'm keeping all attendee records in an offline DB, and the online registration solution would need to send email(s) to us whenever a new user registers for a class and completes a payment through PayPal.

Now, normally I would use the PayPal IPN to integrate the PHP form with the PayPal payment transaction, but attendees will need to submit additional information above and beyond what PayPal needs to complete the transaction (such as your licensing board's license number and expiration date), and this additional information would be lost once the user jumps to the PayPal site and back to complete the payment. I won't be able to store this temporary information in a database, and there are far too many problems with cookies to use them to store this information in.

Presently I cannot think of any means of handling the registration process besides splitting the user registration for the class and the completion of the necessary payments into fully separate operations, which is unacceptable.

Is there any other way I can integrate a PHP form containing this additional ordering information with PayPal? If not, would I be able to do so using a different scripting language and/or payment service?

JAY6390
01-08-2010, 01:47 AM
I think this would be better done as a simple e-commerce site. You could add those fields to the fields required by the checkout, and could have each class registration as a product (with full details of the class in the description) and the price. As far as I'm aware you can't send all that info to paypal directly. There might be a custom value for the NVP but I'm not sure if it sends that value back to your script or not

Rebbu
01-08-2010, 01:52 AM
I've done quite a lot of work with PHP integration with paypal, but I always had the option of using a database to store information. Are you sure that you can't use paypal's pass-through variables to pass the extra details you need to your IPN script?

I know for a fact that you can send at least one custom pass-through variable, but unsure if you can send more than one. If you can't send more than one, you could serialize (or implode) the variables, and explode them in the IPN script. Custom variables are not shown to the buyer (I'm pretty sure), but they must be a max. of 255 characters.

Regards,
Rebbu

JAY6390
01-08-2010, 01:56 AM
could base64 encode them also I guess

Tilus
01-08-2010, 09:34 PM
There's quite a bit of information stored in several variables that I might need to pass through, depending on the organization the attendee belongs to (and they might not all fit in that single custom variable), but after thinking it over, I'll probably be able to figure out some sort of workaround.

Thanks for the assistance, it was a big help.

whizard
01-09-2010, 12:45 AM
What about sending an email with most of the data before you send the user to the paypal page, and then just pass the transaction ID to the paypal page, and send a second email after the paypal is completed, with the rest of the info? I know its not ideal, but it might work for you in this situation.

:thumbsup:
Dan

JAY6390
01-09-2010, 01:46 AM
What about sending an email with most of the data before you send the user to the paypal page, and then just pass the transaction ID to the paypal page, and send a second email after the paypal is completed, with the rest of the info? I know its not ideal, but it might work for you in this situation.Thats a good idea in theory Dan. The only problem will lie in thhe fact that when you move to paypal, you actually directly post to paypal instead of to your script, so you would need to either catch the send via javascript, send the data to a script in paypal with the info and email address, then post the form as originally intended.

Rebbu
01-09-2010, 01:57 AM
It is possible to make a button using forms which will send the intended POST data to a page with a script to send an email, then, using PHP, re-send headers to redirect the user to the intended paypal form (simple tutorials of how to post headers to send POST data are easy to find). I use a method like this to ensure authenticity of paypal requests etc, but it could be used for sending emails.

But you could do the same thing with JS, as JAY suggested.

But as stated, this wouldn't be ideal.

JAY6390
01-09-2010, 01:59 AM
I don't think it's possible to redirect and send POST/GET data is it? I've not seen it done anywhere before

sea4me
01-09-2010, 03:33 AM
I don't think it's possible to redirect and send POST/GET data is it? I've not seen it done anywhere before

Do something like this:


<form action='paypal.com/....' method='post' name='frm'>
<?php
foreach ($your_vars as $a => $b) {
print("<input type='hidden' name='".$a."' value='".$b."'>");
}
?>
</form>
<script language="JavaScript">
document.frm.submit();
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum