PayPal button in program?
Hi,
I have written a small program in Java upon which I would like to put a Donate button. There are plenty of instructions on how to add a Donate button on a web page, but I specifically want to add it to the program instead. Are there any known references on how to do this.
Some links would be appreciated.
Regards,
David
[355 byte] By [
dmbocsa] at [2007-10-3 4:34:49]

Wow. You couldn't have made this description much more vague, even if you tried...
JButton donateButton = new JButton();
donateButton.add(new DonateActionListener());
somethingThatsSupposedToHaveADonateButton.add(donateButton):
Assuming that's Swing and not AWT or SWT.
A suppose it was a question for those who have had Java programming experience with the PayPay API.
To explain the question further:
The PayPal site has examples of how to add a 'Donate/Pay now' button to html code so that others can click on it and send you money. But this requires a webpage of some description. I would like to have a 'donate' button directly on my program bypassing the fact that I do not have a domain name and hence web presence (not to mention that a button is always there as apposed to a website that has to be intentionally visited). I am looking for clues on how to affect this.
Thankyou CeciNEstPasUnProgrammeur for you brilliant code snippet. I am sure if you really thought that the answer was going to be that simple, you would have metioned something about there being a "New To Java" forum where the question would be better suited. But on hindsite, maybe my question was a bit vauge.
So... for anyone that knows of a good PayPal Java reference/code example, I would greatly appreciate the link.
> Thankyou CeciNEstPasUnProgrammeur for you
> brilliant code snippet. I am sure if you really
> thought that the answer was going to be that simple,
> you would have metioned something about there being a
> "New To Java" forum where the question would be
> better suited.
The description of the New To Java Forum:
If you are new to the Java platform and wondering about all the features, tools, APIs, and downloads, this forum is for you. Discussions center around getting acquainted with Java platform programming.
Whereas Java Programming says:
Use this forum to discuss general topics related to the Java programming language.
Strictly, neither is appropriate. :) What you actually are looking for is a PayPal support forum which we don't have. Which other forum would be appropriate, I can't yet determine - but since everybody posts everything in here, it's irrelevant anyway. So you're at the right place. :)
> But on hindsite, maybe my question was a bit vauge.
Youre question was "how do I add a Donate button". A question like "how do I connect my Swing Desktop application to a PayPal service" - which is what you actually want to do - would have resulted in a different answer.
Something like:
Please tell me what this PayPal API is about. Do they offer a web service or a library? If the former, you could use whatever mechanisms Java offers for web services (I don't know them, I only work with servlets), if the latter, you'd need to read the library's docs. If the HTML demo for PayPal calls certain scripted websites from HTML forms, you might want to look into UrlConnection or maybe Apache's HttpComponents for emulating HTTP GET or POST requests from an HTML form.
It really depends on the interfaces PayPal offers - and maybe the simplest way is to use a library like JDIC (or a system-specific call to Runtime.exec()) to open a web browser and show the PayPal site.
> Strictly, neither is appropriate. :) What you
> actually are looking for is a PayPal support forum
I had no joy their either. But unlike here, I would have thought that the question would have made more sence.
> Youre question was "how do I add a Donate button". A
> question like "how do I connect my Swing Desktop
> application to a PayPal service" - which is what you
> actually want to do - would have resulted in a
> different answer.
I did think that the heading:
PayPal button in program?
might have given a few clues to someone in the know.
> Please tell me what this PayPal API is about. Do they
> offer a web service or a library? If the former, you
> could use whatever mechanisms Java offers for web
> services (I don't know them, I only work with
> servlets), if the latter, you'd need to read the
> library's docs. If the HTML demo for PayPal calls
> certain scripted websites from HTML forms, you might
> want to look into UrlConnection or maybe Apache's
> HttpComponents for emulating HTTP GET or POST
> requests from an HTML form.
PayPal offer a Java based API and some examples that do not seem to be relevant to what I am after.
I still need a Java style tutorial on how to connect a PayPal created 'Donate' type button to a Java Program. I was hoping that Java experts as are found here may be able to point me to some turorial type web site. API's are great but instruction on how to use them are sometimes better.
Looks like I will have to work this one out for myself.
https://www.paypal.com/en_US/pdf/PP_SDK_Java_Guide.pdfIt is VERY relevent to what you are doing.
Connecting your Swing button to whatever API is not dependent on the API.
So if you don't know how to use the API then talk to them
If you don't know how to use Swing post in the Swing forum.
Your problem has these two steps. "Pay Pal button" is a misnomer. You are going to have a button that does something with the API in it's ActionListener.
Another quest for the mythical doMagic() method...I know the first grade students are expected to ask questions like "which method do I have to call to make my program send a diamond of asterisks via Bluetooth to my website", but this falls about in line with them. :)
> PayPal offer a Java based API and some examples that
> do not seem to be relevant to what I am after.
If you don't understand an API, you don't understand it at all. Any documentation would not cover all the infinite possible way an API could be used. You are plainly being lazy.
> I still need a Java style tutorial on how to connect
> a PayPal created 'Donate' type button to a Java
> Program. I was hoping that Java experts as are found
> here may be able to point me to some turorial type
> web site. API's are great but instruction on how to
> use them are sometimes better.
People here deal with Java... not any specific APIs. If you need to use an API, you need to be ready to experiment it yourself.