I used to have a "Buy Now" button that would go through PayPal, and then, through the button's advanced option, I redirected the users to a "Success" page that would give the serial for the product they purchased.
Obviously, this page had to get confirmation from PayPal, through the variables PayPal gave it, in order to know that a payment had actually been processed, and not only some person typing the page's URL in his browser to get a serial.
I did this only in PHP, without downloading any API, using, as far as I can remember, $_POST or $_SERVER variables from PayPal. There were a couple of nested "if"s, but in the end, it worked fine.
Now I've been Googling for an hour trying to find the code I used. All I find is framework downloads and bloated APIs, while I really only need to know these things:
Did the order process?
What is the email of the buyer?
I have a blank PHP file waiting for suggestions. In dummy-pseudo-code, it would go around the lines of:
<?php
$serial = ...;
if ($paypal_succeeded)
{
echo($serial);
}
?>
Please don't tell me this is impossible, I know I already did it, I just lost my old code.
Thanks!
I don't have any experience with this sort of thing, but google showed me a few possible relevant links here, here, and here.
The main page for this was https://www.paypal.com/ipn
Related
I've been reading up on how to return transaction information once a user checks out and reaches the confirmation page. For example, I would like to receive the time/date, order total, and product information along with the campaign info, using the user's cookies possibly to see what campaigns are being used and which ones aren't.
So far, I've found a couple methods that are close to what I want to do. But between all the different documentation and deprecated methods, I'm a little overwhelmed.
I think the best way for me to go about this is just grab a custom variable from the URL or from the cookie once the user reaches the confirmation page.
Is this so? And how do I actually go about this? Please, if you link to Google documentation, can you explain it in a simpler way for me?
This isn't a real code problem but more a where and how to start problem.
So I hope you can give me some creative ideas, examples or share your thoughts !
After login in to a website, I can change my product details, this is done by HTTP POST forms.
Because we have over 1000 products I somehow want to customise / easyify.
My idea was, make a PHP form on my own server which submits to the supplier url(s).
However when doing this, it forwards us to the customer login.
If I temper my submitted data in firefox, I see this is because after login a cookie is been set and obvious our system does not have this.
Anyone an idea how to automate this process ? In other words, how can I set this cookie in my php form in order to submit it succesfully.
Or Im I thinking about the wrong solution ?!
You cannot post to another server unless you use cURL or something like that. Maybe I am not understanding your question.
I want to get the details form the paypal form. I redirect my clients to this form after they select a certain amount. Can i get the details of the form below?
I am not sure. Since paypal is asking for the creditcard number and all that, for security purposes it should not allow to get this form data. But again, just wondering, is it possible?
Short answer: no.
Certainly not using PHP (going by your tags here), which is server side, and this would be a javascript hack. The way that immediately leapt to mind would be to invoke Javascript in a child iframe that contained the Paypal form, but there are two immediately apparent problems with that:
I doubt Paypal would allow that page to be opened in an iframe
You can't invoke javascript in an iframe if the page in that frame is not on the same domain as the calling page.
The best way I can think of to achieve this would be to make a Greasemonkey/Chrome/whatever extension using javascript to fish the data and send it off, but then there's this: No-one will willingly install something that they know to steal credit card information on their computer. Why on earth do you want to do this?
On a related, though unhelpful note, if you are interested in trying this for a purpose that is less illegal and immoral, one thing you might want to look at is this. It shows how to do cross-domain communication using frames if you have permission to write javascript on both pages (or have found an unsanitised field to inject it with)...
i'm a newbie to web dev and what I need to do is create a form where a user inputs something into a field lets just call it name for now.....then when they go to paypal they donate $1 (predetermined) then from when paid to paypal, they are redirected to a success page and what I want that success page to do is say "confirmed" and the action for it to do is grab the "name" that was given and input it into a txt file on the server
Is there a way I can do this securely...i've never had to do anything with paypal before that wasn't a premade script.
(would be using php)
(if there is a script in wordpress/joomla (haven't decided which i'll use yet i'd probably use it)
As long as I can somehow get that variable "name" and do what I want with it at the end.
It's called the paypal IPN and there are a number of implementations and tutorials on it, try googling for it...
I have a form were a user enters information, and then I have a PayPal button that the user will click once the fields have been filled in. The problem I'm having is how to you capture the user information when the paypal button is clicked, if the form has action="http://paypl.com/something/something".
Do I have to make this a 2 page process - one for me to capture the user information and then one to have the user click the paypal button?
By the way - the PayPal button directs the user to paypal.com to actually make the payment.
Guys, there's an easier solution here. Paypal allows you to pass those values through to it, then it will spit them back to you. There's actually two methods of getting the data back--a return URL that posts upon completion with return values (I've not been terribly lucky making that work) then a separate function that sends you a post upon completion of a transaction to a separate page on your site, where you can collect back all the variables you posted to the site. I suggest the latter because on a buy it now page there's a possibility of the user not being returned to the site because the return button UI is pretty weak on PayPal's end.
To set it up you'd log in to your PayPal account, click on myaccount > profile > website payment preferences. Enabling the "payment data transfer" will do the trick. Once you've got it setup correctly, upon completion of a transaction it'll send to the page of your choice a post of everything you sent it....remember, you can send in variables such as Name, Address, etc just by defining them properly in the form. All the variables available are found here
Sure, you could go through grabbing the elements from the form via Jquery or the like, then do an onclick save to DB, but why fight it? It's a heck of a lot more work and may have issues if Javascript is off.
Don't forget to build a sandbox site to test! Good Luck.
You have a few options here. You could make two forms, one which submits to your server where you capture the user information, and then display a second form with a "Pay Now" button. As a second option, you could extract the information from the form using JavaScript and submit it to your server using AJAX, then submit the form to PayPal when the AJAX request completes. This may or may not be more complicated, but it will not alter the existing user interface, which may be desirable.
I would make the action the current page, catch the button click and store the user information, then use header: Location("http://paypl.com/something/something");. Its something like that anyway. Hope this helps.
Edit: Also see the other answer by Josh. They are equally good possibilities. Note that the Ajax option would require JavaScript to be switched on - so safeguards would have to be put in place in case it is switched off.
My recommendation would be to add all of your user/order data into your own local database so that you can generate an order ID of some kind. You can then pass this order ID into your PayPal button code in a field named invoice.
This value will then come back in PDT/IPN as $_POST['invoice'] so you can easily pull all of that data back out and handle it within your application accordingly.
Another alternative would be to use Express Checkout instead of Payments Standard. It's a little bit more involved, but it has fewer limitations.
Even with EC, though, I still recommend sending an order ID of some sort along with the payment request so you can relate everything back and forth easily.