Hi,
PayPal has free solutions that work:
https://www.paypal.com/us/cgi-bin/webscr?cmd=_profile-comparison
I use "Website Payments Standard" with an IPN back-end without
trouble for over 5 years on Tomcat 4s, no trouble with recent upgrade
to 5.5/
We save the shopping cart on the server side and cause the client
side to go to PayPal.
window.location.replace(
"https://www.paypal.com/cgi-bin/webscr?
cmd=_xclick&business=<%=ppvsite%>&invoice=<%=invoice%>"+
"&item_name=<%=URLEncoder.encode(document_name)%>"+
"&item_number=<%=document_id%>&amount=<%=document_price%>"+
"&no_shipping=1&no_note=1"+
"&image_url=<%=URLEncoder.encode("our logo gif")%>"
);
Once the payment has cleared by PayPal they send server to server
messages back through the IPN process. This includes chargebacks
echeck clearing, and other exceptions. It is all well documented with
sample code. Maybe they have better approaches now, but I've no
reason to change.
Regards,
Dave
On Mar 20, 2008, at 8:58 AM, John Pedersen wrote:
Hi,
At least with Google checkout, I have found a better solution. I
have a form
with just their button image as a submit, and in my handler I do:
String xmlCart = cart.createXML();
MerchantInfo mi = GoogleMerchantInfoFactory.createMerchantInfo(
EnvironmentType.Sandbox);
CheckoutShoppingCartRequest cscr = new CheckoutShoppingCartRequest
( mi,
xmlCart);
CheckoutResponse checkoutResponse = cscr.send();
String redirectUrl = checkoutResponse.getRedirectUrl();
It turns out that GC has some java code already that uses the
HttpURLConnection class - it posts the data in the shopping cart, the
retrieves a forwarding url that takes the user to their payment page.
Google's CheckoutShoppingCartRequest contains the HttpURLConnection
code
which posts the data - server to server.
Thanks for the heads up.
Unfortunately, I don't think Paypal have an equivalent, unless I
sign up for
their £20/month Paypal Pro ( I am not sure if their code makes this
functionality available - for that price, I won't even look - I'll
just
stick to using javascript onLoad(submit()) in a page conatining
nothing but
the Paypal button form.
John
On 20/03/2008, Christopher Schultz <[EMAIL PROTECTED]>
wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John,
John Pedersen wrote:
| Can anyone suggest how I can forward a post using servlets?
[snip]
| Then, depending on which button the user clicks, I want to
forward the
user
| on to google/paypal using POST, adding the parameters such as cart,
| signature.
This is typically called a "man-in-the-middle attack". ;)
Seriously, though, you'll have to build the POST manually. Look at
the
java.net.HttpURLConnection class. You could also look at HttpClient
(http://hc.apache.org/httpcomponents-client/index.html), which
encapsulates a lot of what you want to do.
Just remember that if you decide to act as a proxy like this, you
will
have top handle a lot of things like cookie-passing, etc. in order
to do
it properly.
Perhaps there's a better API for you to use than their user-facing
web-based one... such as a SOAP or REST API where a lot of those
issues
are removed.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkfiaE8ACgkQ9CaO5/Lv0PAAVgCffK5ZwvwMZwMVXcDsF295MqjJ
GC0AoKJOK1s4TMfT/fUDUatijBn9c/OB
=mlDx
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]