Paypal Form Integration - php

I am trying to integrate Paypal payment with a form registration. For example, a user would enter their information into form fields, press "register" and then they would be taken to Paypal where they pay a fee, upon payment the information they've submitted is posted in a file. I already have the information posting successfully into a file using a php, but now I want the process to wait for payment validation before posting. Is that possible?

Related

Retrieving payment confirmation from Paypal

I have a membership application form that collects basic demographic data. Once the form is submitted, I use PHP to insert the data into a database and then redirect the user to Paypal for membership payment. I would like to add a field to each user record that indicates whether or not a payment has been posted. Is there a way Paypal can pass back a confirmation that I can use to update each membership record?
Yes, check this out is called IPN is provided by paypal, this is how it works

Submit a form before redirecting to paypal

I have a site that provides guide tours. Each tour has it owns price depending the people that will participate.
The user has to fill the form, then the server has to validate the form and then sent an email to the client and to the agent office with the details of the booked tour (preferred day, how many people etc) and then redirect the user to paypal to pay.
The problem is that the Buy now button that paypal provides has his own form with some hidden fields so two forms on same page.
I found tree solutions but I don't know what is best.
When user press submit, do the validation , send the emails and then redirect the user to a page that has a button that says something like 'Proceed to paying' that submits the paypal form with the giver price in the hidden fields
When the user press the submit button an ajax call been made at server to validate the form and send the emails and then on success submit the paypal form.
When user press submit, do the validation , send the emails and then the server submits the form to paypal
I am reading a couple of hours finding the best solution to this problem. What is the most secure , efficient and won't create problems to the user.
Sorry for my English
Assuming you have a fair knowledge of web development (since you are talking about forms, sessions, etc.), I'd recommend using PayPal Express Checkout APIs. What you are trying to do is very common. And here's how I would do it:
User enters tour information in a form on page-1, and hits the "submit" button.
Your server receives the call, validates the form and calls SetExpressCheckout with PAYMENTACTION set to "Authorization". This is just like "booking a hotel room" or a "rental car". You are just asking the user to authorize payment at this moment; not charging him yet.
The API returns you a token. You store this token along with tour information in your backend database; and mark this particular "booking" as say "booking request received".
You redirect the user to paypal.com (and pass that token in the URL) to "authorize" the payment.
Once the user completes authorization, paypal redirects the user to your website (the "success page" or the "return URL" as it's called in paypal terminology).
You update your database entry with the status say "payment authorized". At this point you email the user and the agent.
Agent validates and makes sure that there is still room available in the tour, etc. and let's you know that the user is all set.
At this point you call the DoCapture API using that token. This actually "captures" the payment. And you update the database entry with the status "payment processed". You can also send another email to the user confirming the payment and the booking.
At any stage if there's a drop off (say the user never completed authorization), you'd know from your database, and you can send a follow up email to the user. Or if he authorized but later the agent says there's no space on that particular tour, you could again follow up with the user for next available date, or void the payment, etc.
Yes, this means that it's "more coding"... but then you get "more flexibility" and hopefully you'll be able to reduce drop offs.
Hope this helps. Here's the documentation for express checkout: https://cms.paypal.com/cms_content/CA/en_US/files/developer/PP_ExpressCheckout_IntegrationGuide.pdf. There are Java, PHP, etc. SDKs available for this to help merchants integrate quickly.
You'd create sort of a confirmation page with all the values of the PayPal form but using <input type="hidden" balal /> rather than <input type="text" balal />
Try to break up the process instead of having the whole transaction sitting on that "Buy Now" button. Perhaps create a basic cart system on your website, then allow users to checkout which then will send the contents of their cart using hidden inputs to PayPal.
This way will allow you to match users to bookings.

Prefilling login to paypal system

I`m using PayPal standard and buynow button. Exists any possibility how to pre-fill login e-mail into PayPal system after button submit? For example any hidden field, like "bussines"? This is helpfull in case, if i know users e-mail using as login to paypal.
You can use a hidden field called "email", but that's only used if the customer doesn't already have a PayPal account. Otherwise, the email field will be prefilled with the customer's login info.
https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_xclick_prepopulate_outside

Receive form only if Paypal payment is complete

I'm looking for a way to receive a form result by email only if the payment has been completed on Paypal.
I have a form next to my shopping cart.
I want people to fill the form, then they can browse in the shopping cart.
Once they click on "Checkout" in the shopping cart, they are redirected on Paypal.
The form I talked before is still on hold...not sent yet.
When the guy fills his credit card information, click Proceed on Paypal, and THEN...
When the payment is complete, the form he filled on my website will be submited.
But if he decide to close the paypal window and stop shopping, I won't receive it.
I need your help guys/girls.
I'm not sure what language I need to make this work.
I'm guessing PHP and Javascript.
Thanks a lot,
This function is very important for us.
Check out the IPN (Instant Payment Notification).
https://www.paypal.com/ipn/
It will send a message to your server after a payment has been made, sounds like what you are looking for. You can write the listener in PHP and they provide example code.

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