I am creating a PHP form which takes the customer's information and the amount they want to spend and when the submit button is hit the details are sent to my email address.
This is where I have the problem. I want to then send them a link to the PayPal account to complete the purchase. However I want the amount to be pre-populated based on the amount they selected from the forum.
Simply, can this be done?
You need to change the action parameter of the form from https://www.paypal.com/cgi-bin/webscr to www.someurl.com/page-that-you-can-edit.php
You then need to code your script to email you whatever information you want, and then silently redirect the buyer to PayPal (you do this by setting the header) with the appropriate paypal variables: cmd=_donations&business=yourpaypal#email.com&amount=xx.xx&item_name=your items name&[any other website payment standard variables ]
Related
When you are setting up a PayPal Buy Now Button, you can take customers to the URL when they finish checkout.
Is there a way to retrieve their PayPal email immediately after PayPal checkout using $_GET?
Does PayPal append some kind of ?email=email#address.com at the end of your thankyou page?
Or is there any variable I could add at the end of my thankyou page when typing a success URL inside the PayPal?
Basically I want to store their PayPal email address that they used on deposit, so that when they would cash out, the same PayPal email address will be used.
Just wanted to let you know why I'm interested in storing their real PayPal email address in the first place.
Any help from someone who have knowledge in this would be appreciated.
With a legacy HTML Buy Now button that redirects away from your page, there is never any guarantee the payer will return to your site after a successful transaction. With such an old integration, the only reliable way to get the email address of the payer and record this information in your database is to implement the old IPN service.
Instead, you should do a server-side integration of the current Standard Checkout.
Follow the Set up standard payments guide and make 2 routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. Both routes should return only JSON data (no HTML or text). Inside the 2nd route, when the capture API is successful you should store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, which is the PayPal transaction ID -- as well as the payer object's email address, in your case) and perform any necessary business logic (such as sending confirmation emails or reserving product) immediately before forwarding your return JSON to the frontend caller.
Pair those 2 routes with the frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
I've got a 2 item gift shop where people can send gifts to other people and pay via paypal. My issue is that its annoying for customers to have to change their address on the paypal checkout screen.
Is there a way I could make it so that they enter their address on the same page as the checkout button and that is then sent to the paypal page and autofills the address stuff. I'm currently only using HTML but could use PHP if needed
Thanks.
If you've already let your useres fill in an address on your website, why would you create a paypal button where they again have to fill in an address? Simply fill out the address in your paypal form automatically using these submit HTML variables:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HI0J0VU
And set 'address_override' to 1 as stated on:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
I'm trying to develop a checkout system for a customer site, and I want to know the best way to do this. Please let me know of any alternatives to what I've tried below.
Currently I have:
1) Items in cart saved to $_SESSION variable
2) When a user presses 'checkout', they are taken to a page with an invisible form that POSTs the information saved in $_SESSION to https://www.paypal.com/cgi-bin/webscr
3) When payment is confirmed, they are redirected to confirm.php on the site that triggers an email to the client and the store containing the information from the cart (stored in $_SESSION) and the address data passed back (as I cannot pass all of the attribute information in the cart to paypal in the first POST) from PayPal.
The issue with my solution is that it doesn't appear to work on mobile safari, iPads, iPhones or older systems. So I'm looking for an alternative, or for a way for the data to remain persistent, as the emails sent out at the end contain no data when performed from one of these devices.
Using a database you can store the entire cart as temporal or incomplete before calling the PayPal payment, and then get all the info via confirm.php, modify the state of the cart, etc.
Also in your PayPal account you can activate automatic IPN upon every payment.
An IPN is a listener that runs on your site and makes calls to paypal. You can find a lot of examples of these on the web.
The idea is that you pass all the fields you want on the PayPal form, and paypal will send it back using the IPN call.
In the PayPal form you can add a custom hidden input:
<input type="hidden" name="cart_id" value="<?php echo $id ?>">
And in the IPN listener you will get cart_id = 4, so you can automatically know which cart payment is done, and which user the cart belongs, change the cart status and email user.
Hope this helps you.
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.
I need to create dynamic 'Pay Now' buttons on my site, and PayPal says the way to do this is via an HTML FORM with preset variables for the price, currency, and item of the purchase. I use PayPal IPN to notify me when a payment has complete.
However, what's to stop someone from modifying the query parameters of the Pay Now button to change the price? Some people have told me to redirect the button through a PHP file that sends you to a PayPal payment page with the parameters in place, but the price could just as easily be manipulated in the Web browser's address bar. My question is, how can I deny a payment if the information I receive from PayPal's IPN service is invalid (if the price doesn't match our records)?
I'm quite confused and couldn't find any documentation on what I'm looking for. Hopefully, you guys can help.
Thanks!
In your IPN listner, check all your variables you sent to paypal. In paypal response, all the variables which are related to the transaction will be sent back to you (i.e., the amount, receivers email, payment status, etc.).
So, what you can do is check all the values of those variables with expected values and do the appropriate task.
See this for more details .
I think you want to enable Encrypted Website Payments. I haven't done this before, but you can read more here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_encryptedwebpayments