2012-05-02 43 views
0

我使用此代码将我的价值传递给贝宝。 现在我的问题是,付款完成后,我应该在我的页面上,以便我可以操纵一些事情,如我应该保存令牌供将来参考等。当我再次回到我的页面时用户隐式点击页面形成的链接支付宝付款完成。但这里的问题是我不能只依靠用户点击或做。我想它应该是隐含的,没有任何用户干预。 在此先感谢,请一些启发.....付款后返回我的网站的贝宝

<% 

    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> 

回答

1

是的,你可以通过配置在贝宝的个人资料自动返回URL做到这一点。

要设置自动返回:

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. 

当你登录到商户的个人资料,你会看到:

preferences1

,并点击网站支付偏好链接后,你会看到:

preferences2

在这里你可以给autoreturn网址。

这将启用自动返回,这意味着付款成功后,贝宝将自动重定向到您的网站,无需用户干预。

下面是启用自动回贝宝指南:https://www.paypal.com/cgi-bin/webscr?cmd=p/mer/express_return_summary-outside

希望这有助于。

+0

这是可以在沙箱a/c?.... –

+0

,因为我没有得到任何**链接**说你指定的选项 –

+0

是的,Ofcourse .. :-)你可以在沙箱中做到这一点并通过登录到卖家的账户进行配置。 – AlphaMale