|
Rank: Starting Member
Groups: Registered
Joined: 9/21/2003 Posts: 2 Location: ,
|
i am getting a page titled PayPal - Abort with a message saying "You have requested an outdated version of PayPal..." as the response to my _notify_validate request.
what causes this page to display. here is the initial test jsp i am using to try the buy button:
<html>
<body>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="smelzer@euclidsoftware.com">
<input type="hidden" name="item_name" value="IPN Test">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="return" value="http://4.33.7.212:8080/storefront/support.do">
<input type="hidden" name="notify_url" value="http://4.33.7.212:8080/storefront/paypal.do">
<input type="image" src="http://images.paypal.com/images/x-click-butcc.gif" name="submit">
</form>
</body>
</html>
then here is the https request in my servlet:
private String postVerification(PayPalIPNForm IPNForm) {
URL url = null;
HttpsURLConnection con = null;
StringBuffer sb = new StringBuffer();
try {
sb.append("custom" + "=" + URLEncoder.encode(IPNForm.getCustom(), "UTF-8"));
sb.append("&first_name" + "=" + URLEncoder.encode(IPNForm.getFirst_name(), "UTF-8"));
sb.append("&item_name" + "=" + URLEncoder.encode(IPNForm.getItem_name(), "UTF-8"));
sb.append("&item_number" + "=" + URLEncoder.encode(IPNForm.getItem_number(), "UTF-8"));
sb.append("&last_name" + "=" + URLEncoder.encode(IPNForm.getLast_name(), "UTF-8"));
sb.append("&mc_currency" + "=" + URLEncoder.encode(IPNForm.getMc_currency(), "UTF-8"));
sb.append("&mc_gross" + "=" + URLEncoder.encode(IPNForm.getMc_gross(), "UTF-8"));
sb.append("¬ify_version" + "=" + URLEncoder.encode(IPNForm.getNotify_version(), "UTF-8"));
sb.append("&payer_email" + "=" + URLEncoder.encode(IPNForm.getPayer_email(), "UTF-8"));
sb.append("&payer_id" + "=" + URLEncoder.encode(IPNForm.getPayer_id(), "UTF-8"));
sb.append("&payer_status" + "=" + URLEncoder.encode(IPNForm.getPayer_status(), "UTF-8"));
sb.append("&payment_date" + "=" + URLEncoder.encode(IPNForm.getPayment_date(), "UTF-8"));
sb.append("&payment_gross" + "=" + URLEncoder.encode(IPNForm.getPayment_gross(), "UTF-8"));
sb.append("&payment_status" + "=" + URLEncoder.encode(IPNForm.getPayment_status(), "UTF-8"));
sb.append("&payment_type" + "=" + URLEncoder.encode(IPNForm.getPayment_type(), "UTF-8"));
sb.append("&quantity" + "=" + URLEncoder.encode(IPNForm.getQuantity(), "UTF-8"));
sb.append("&receiver_email" + "=" + URLEncoder.encode(IPNForm.getReceiver_email(), "UTF-8"));
sb.append("&txn_id" + "=" + URLEncoder.encode(IPNForm.getTxn_id(), "UTF-8"));
sb.append("&txn_type" + "=" + URLEncoder.encode(IPNForm.getTxn_type(), "UTF-8"));
sb.append("&verify_sign" + "=" + URLEncoder.encode(IPNForm.getVerify_sign(), "UTF-8"));
sb.append("&cmd" + "=" + "_notify_validate");
} catch (UnsupportedEncodingException e3) {
e3.printStackTrace();
}
try {
url = new URL(PAYPAL_VERIFY_URL);
con = (HttpsURLConnection) url.openConnection();
} catch (MalformedURLException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
// set up url connection to post information and
// retrieve information back
try {
con.setRequestMethod("POST");
} catch (ProtocolException e2) {
e2.printStackTrace();
}
con.setDoInput( true );
con.setDoOutput( true );
con.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
// add url form parameters
DataOutputStream ostream = null;
try {
ostream = new DataOutputStream(con.getOutputStream());
System.out.println( "adding post parameters: " + sb.toString() );
ostream.writeBytes( sb.toString() );
} catch(IOException ioe) {
ioe.printStackTrace();
} finally {
if(ostream != null) {
try {
ostream.flush();
ostream.close();
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
}
StringBuffer buf = null;
try {
Object contents = con.getContent();
InputStream is = (InputStream) contents;
buf = new StringBuffer();
int c;
while( ( c = is.read() ) != -1 ) {
buf.append( (char) c );
}
} catch (IOException e) {
e.printStackTrace();
} finally {
con.disconnect();
}
return buf.toString();
}
thoughts?
thanks,
steve
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/21/2003 Posts: 2 Location: ,
|
never mind. i figured it out. i have "_notify_validate" instead of "_notify-validate". i cannot tell you how many times i overlooked that. maybe there is something to be said for agile programming's pair programming concept.
|
|
Rank: Starting Member
Groups: Registered
Joined: 8/10/2004 Posts: 2 Location: ,
|
hi bro im making tool for PAYPAL, login and managent data of paypal account by JAVA Swing GUI tool ! i done it with www.sms.acbut when i do with PAYPAL and EBAY and some HTTPS page i got prob, its doesnt work with HTTPS i see ur Code demo but not full can u plz post full of this code that allow me login to https (such as paypal like that)! MANY THANKS
|