2011-10-13 27 views
1

我在android工作。我正在设计一个程序从我的http服务器下载文件。在下载文件付款之前应该完成。下载前支付宝功能

这是我的第一个布局: - enter image description here

当我点击在PayPal按钮此PayPal网站被打开: -

enter image description here

,所以我想知道,后付款是这个网站返回的东西的基础上,我可以允许或不允许用户下载。

我想知道用户付了些东西吗?请帮助我在android的这个paypal概念。

预先感谢您...

+0

你看看PayPal API文档吗? https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_gateway_payflowgateway –

回答

0

我已经通过从一本书中获得帮助完成了这项工作。

这是用于我的问题解决方案的代码: -

@覆盖

public void onActivityResult(int requestCode, int resultCode, Intent data) { 

switch(resultCode) { 

case Activity.RESULT_OK: 

//The payment succeeded 



Toast.makeText(this,"Payment has done successfully",Toast.LENGTH_SHORT).show(); 

//Tell the user their payment succeeded 

休息;

case Activity.RESULT_CANCELED: 


    Toast.makeText(this,"Payment has cancled",Toast.LENGTH_SHORT).show(); 
break; 

case PayPalActivity.RESULT_FAILURE: 

    flag=false; 
    Toast.makeText(this,"Sorry Payment failed",Toast.LENGTH_SHORT).show(); 
    }