PHP form validation and submit to paypal for payment - php

can someone please help me on this :)
I have a form to submit a classified ad. The form uses PHP for validation.
In the form there is a drop down menu where one can select its payment according to the display time of the ad.
I don't know how to keep the validation in place and only send to Paypal if everything is ok.
Is it possible to do it in one step?
Or do I have to redirect the user to a confirmation page and there place my buy now button?
Also I would like to use IPN to update the info in the DB.
Thanks
Max

The PayPal IPN document describes how you should do it.

Related

Joomla - ChronoForm: Submit action based on user selection

I am new to Joomla and Chronoform.
Site is integrated with chronoform 5 and it accepts payment via paypal pro and check. User has option to select paypal or check for payment as shown below
I have completed payment through paypal onsubmit. But if use selects check it should not process payment and also it should give different display message. How I can integrate both ? Please suggest.
You can use an Event Switcher action after the form submits to redirect to different pages for the different payment methods.
Please see this FAQ for an example of using the Event Switcher.

Collecting user data before PayPal purchase

I've ran into a problem. Basically, I have a website that users can hire someone to tutor them. Each tutor has a small profile with a video, bio and rating. The user fills out a form with information such as their name, email and the most important one which is the date and timeslot (Dropdown) they want. When they fill out this information they can then click "Buy Now" which is a PayPal button I've setup. There are no variables here, each time slot is the same price all round.
The problem I'm having is I don't know how to collect the user information when the PayPal button is clicked. Can I pass this timeslot to PayPal who then return it to me? I can set up simple form that will send this information to me in an email, however I don't know how I can trigger that PHP script when the PayPal buy now button is pressed.
Any help? I've been Googling for a while, I can't seem to find anything! Maybe I'm wording it wrong. Anyway, hope you guys can assist.
I would save all of the info in your database prior to sending the user over to PayPal. That way you can include the invoice number (or record ID) in the invoice parameter in payment requests.
If you're working with Payments Standard the parameter is called invoice. If you're working with the Express Checkout API it's called INVNUM.
Hi you can use Ajax in this situation. The ajax will prevent the redirect of the form to paypal for awhile but executes another process in which you will save and capture the information of the form to your database. After the process the redirection to paypal payment method will continue.
You can view this good tutorial in here.
http://anytch.com/save-html-form-post-to-database-before-redirect-to-paypal/

How online shopping works in this case?

I would like to create a web form for the buyer to fill and then a direction to Paypal to pay the item, then comeback to the page and if the purchase is approved it submits the form and wait send me an email with its details.
I know how to create the form but front-end, and also I know how to send a php email to submit the form. But what about the payment part ?!
Can someone explain me how it works.
Is it possible to create something like this?
Any tutorial or similar example, links would be useful.
Look into the Paypal API
https://www.paypal.com/cgi-bin/webscr?cmd=_dcc_hub-outside
When the user successfully completes the transaction the result is sent back to the page, you then check if the result was successful, if so onwards with whatever code.

Form autosubmit for online payment: bad practice?

Context:
I have to add an online payment system, on a quite old PHP 4 website (Yay !).
As usual, an external payment platform/gateway will be used.
After preparing an order on the website, that payment platform expects to be called with POST data, then displays its online payment page if everything is Ok.
Question:
Would it be a bad practice to autosubmit a form with a bunch of hidden fields, in order to switch to the payment platform?
It seems that I don't have the choice but I would like to know if someone sees a better way for that online payment platform integration.
Current workflow:
... last ordering step: order summary
user clicks on "order" (that button is already part of a form which action is an internal page)
results page (generally: order successfully saved, will be quickly processed, etc.)
The new detailed workflow would be:
... last ordering step: order summary
user clicks on "order" (that button is already part of a form which action is an internal page)
after existing internal processing, redirection to the "autosubmitted form" page
the autosubmit form submits itself (its action being the payment platform URL)
online payment...
result page
NB. I would add some "please click to order" button for users having Javascript disabled.
Thanks for any suggestions / thoughts. Or even telling that there should be no problem with this :)
Autosubmit a form with a bunch of hidden fields, in order to switch to the payment platform is ok. But you should pay much attention to security here, because intuder can modify those hidden fields.

how to send and retrieve custom form info through paypal IPN?

It seems that Paypal limits what what information can be retrieved by the paypal IPN php file after the user pays. I want users to be able to make an username and password that they will use to log in to my website before they click the paypal checkout button. After they pay, my paypal IPN php file will retrieve their username and password and place them into my mysql database. Is this possible? I want to make registration as easy as possible for the users.
Thanks in advance
there are a couple of custom fields that you can add to your form that paypal will return no matter what you sue them. however i would recommend saving the data locally, before sending the rest of to paypal, to do this you either nee to use AJAX to submit part of the form to a php script or pre-possessing the form data before sending to paypal via curl.

Categories