Reputation: 5933
I am using this code to pass my values to paypal. Now my problem is that, that after the payment is complete I should be on my page so that I can manipulate some of the things like I should save the Token for future reference and so. Again I comes back to my page when user implicitly clicks the link formed in the page of paypal after the payment is done.But here the problem is I cant just rely on user to click or do so.I want that it should be implicit without any user intervention. Thanks in advance,please shed some light.....
<%
String apiusername="USERNAME";
String apipassword="PASSWORD";
String truePath="http://localhost:8080/Befundo/xtraFiles/paypal/paypalResponse.jsp";
String falsePath="http://localhost:8080/PaypalGS/paypalResponseCancel.jsp";
String itemName="Computer Laptop";
String quantity="2";
String amount="100";
%>
<body >
<form name="paypalForm" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="text" name="cmd" value="_xclick" />
<input type="text" name="business" value="<%=apiusername %>" />
<input type="text" name="password" value="<%=apipassword %>" />
<input type="text" name="custom" value="1123" />
<input type="text" name="item_name" value="<%=itemName%>" />
<input type="text" name="amount" value="<%=amount%>"/>
<input type="hidden" name="quantity" value="<%=quantity %>" />
<input type="text" name="rm" value="1" />
<input type="text" name="return" value="<%=truePath %>" />
<input type="text" name="cancel_return" value="<%=falsePath %>" />
<input type="text" name="cert_id" value="API Singature" />
<input type='submit' value='Pay'>
</form>
</body>
Upvotes: 0
Views: 1540
Reputation: 25650
Yes you can do this by configuring the auto return url in paypal profile.
To set up Auto Return:
1. Log in and click the Profile subtab under My Account.
2. Click the Website Payment Preferences link under Selling Preferences.
3. Click the On radio button to enable Auto Return.
4. Enter the Return URL.
When you'll log into merchant's profile, you'll see:
and after clicking website payment preferences link, you'll see:
Here you can give the autoreturn url.
This will enable the auto return , which means that after payment being successful, paypal will automatically redirect to your website, without user intervention.
Here's paypal guide for enabling auto return: https://www.paypal.com/cgi-bin/webscr?cmd=p/mer/express_return_summary-outside
Hope this helps.
Upvotes: 1