How online shopping works in this case? - php

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.

Related

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/

Paypal subscription integration php

I have spent all day on something that should only take a couple of minutes.
I need to add a subscription service onto a website, the user needs to enter their full name and email address as part of the subscription, paypal should then take the payment and redirect back to the site while passing the full name and email so accounts can be created.
I am at a loss here as their documentation is all over the place and conflicts with itself. How do I create a subscription button with the additional fields and get it all working.
And how the hell do I test it? I have attempted creating one with the subscription button on the paypal site but when the checkout is completed it doesn't go back to the site to create the fields unless you press the button and when you do there is nothing no post data no get data nothing!
You could try using PHP-Payment it allows you to redirect to a page upon success. https://github.com/phpfour/php-payment/tree/master/src/php/Rbs

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.

PHP form validation and submit to paypal for payment

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.

Flow for: fill form, make paypal payment, create account

I've implemented a paypal transaction before but this one has a twist that I'm not quite sure what's the best way to handle it.
The basic idea is I want to create an account for the user when he provides some details and makes a payment via PayPal. Until BOTH the user details are filled out correctly AND the payment is made correctly, I shouldn't create an account for the user.
The setup I've done before was simply a paypal button that the user clicks, makes a payment, and gets forwarded back to just a generic page "your order will be processed and shipped" so there was no pre-order form involved.
This one is different though because
before PayPal, I need to collect initial user data
after PayPal, I need to create the new user account and use in it the user data collected from the pre-paypal form
I'm sure there's a logical way to implement this, but I'm not quite sure what's the flow I should follow to do it.
I use the Zend framework by the way, which shouldn't matter but just in case Zend has an easier way to help me with what I'm trying to do.
I do the following (though I do this in ASP.NET):
User fills out form
Info is saved in Order table in db with a unique invoice number
Invoice number is passed to PayPal, along with the IPN Notify URL, when you do the redirect
User is sent to Paypal to pay and then comes back to a generic Success page
Behind the scenes, Paypal makes a call to the IPN Notify url once processing is complete. This page receives your invoice number which PP returns with its call, and then does the account creation processing for that order after retrieving the details from the db. [This is a page with no UI, since only PP is hitting it.]
An email is sent from that process which notifies the customer that their account has been created and gives them the details.
This is a simplified version of the process, but hits the highlights. You can check out PayPal's page about IPN, and do a search on google for IPN integration with PHP.

Categories