首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未显示PayPal payment页面

未显示PayPal payment页面
EN

Stack Overflow用户
提问于 2012-09-26 16:25:02
回答 2查看 243关注 0票数 2

我正在创建测试目的贝宝应用程序。我已经创建了测试paypal帐户,并在我的按钮点击活动中编写了下面的代码。但没有显示和获取异常:

代码语言:javascript
复制
09-26 13:52:51.908: E/NetworkHandler(540): postXML caught exception doing I/O, mobileclient.sandbox.paypal.com

代码:

代码语言:javascript
复制
float ammount = Float.parseFloat(_details.get(_G_no)
            .get_product_price());
     PayPalPayment newPayment = new PayPalPayment();
     newPayment.setSubtotal(BigDecimal.valueOf(ammount));
     newPayment.setCurrencyType("USD");
     newPayment.setRecipient("account@gmail.com");
     newPayment.setMerchantName("Merchant");
    PayPal pp = PayPal.getInstance();
     if(pp==null)
     pp = PayPal.initWithAppID(this, id, PayPal.ENV_SANDBOX);

    final Intent paypalIntent = pp.checkout(newPayment, this);
        this.startActivityForResult(paypalIntent, 1);

我的应用程序中有互联网权限。请帮帮我。

EN

回答 2

Stack Overflow用户

发布于 2013-07-03 17:01:53

我不知道,这是对还是错。但是我找到了解决方案,在你的代码之前创建互联网连接,然后连接到Vikalp patel来识别Have you found the solution of NetworkHandler Error

代码语言:javascript
复制
public void PayPalButtonClick_ ( View v )
{
    class asynctaskToInitLibrary extends AsyncTask<String, Integer, String >
    {
        @Override
        protected String doInBackground(String... params) 
        {

            URL actualUrl = null;
            try 
            {
                actualUrl = new URL("http://www.google.com") ;
            } 
            catch (MalformedURLException e) 
            {
                e.printStackTrace();
            }
            try 
            {
                HttpURLConnection cn = (HttpURLConnection)actualUrl.openConnection();
                Log.i(cn.getResponseMessage(),"tushar:connectionResponse") ;
            } 
            catch (IOException e) 
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            PayPal pp = PayPal.getInstance();

            // If the library is already initialized, then we don't need to initialize it again.
            if(pp == null) 
            {
                // This is the main initialization call that takes in your Context, the Application ID, and the server you would like to connect to.
                pp = PayPal.initWithAppID(Paypal_MPL.this, "APP-80W284485P519543T", PayPal.ENV_SANDBOX );

                // -- These are required settings.
                pp.setLanguage("en_US"); // Sets the language for the library.
                // --

                // -- These are a few of the optional settings.
                // Sets the fees payer. If there are fees for the transaction, this person will pay for them. Possible values are FEEPAYER_SENDER,
                // FEEPAYER_PRIMARYRECEIVER, FEEPAYER_EACHRECEIVER, and FEEPAYER_SECONDARYONLY.
                pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); 
                // Set to true if the transaction will require shipping.
                pp.setShippingEnabled(true);
                // Dynamic Amount Calculation allows you to set tax and shipping amounts based on the user's shipping address. Shipping must be
                // enabled for Dynamic Amount Calculation. This also requires you to create a class that implements PaymentAdjuster and Serializable.
                pp.setDynamicAmountCalculationEnabled(false);
                // --
            }

            if (pp.isLibraryInitialized()) 
            {
                return "initialized" ;
            }
            else 
            {
                return "not-initialized" ;
            }
        }
        protected void onPostExecute(String result)
        {
            initializationStatus ( result ) ;
        }
    }

    asynctaskToInitLibrary object = new asynctaskToInitLibrary() ;
    object.execute("") ;
}
票数 0
EN

Stack Overflow用户

发布于 2013-11-11 01:12:59

我已经从MPL库(已被弃用)更新到新的PayPal Android SDK。我已经解决了这个错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12597526

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档