【问题标题】:PayPal Adaptive Payment (Chained Payment) Integration in AndroidAndroid 中的 PayPal 自适应支付(链式支付)集成
【发布时间】:2014-04-10 16:23:52
【问题描述】:

我正在我的应用程序中集成 PayPal 自适应支付并寻找我的问题的解决方案。如果有人在 android 中实现了链式支付,请提供帮助。

问题:-

当使用 PayPal_MPL.jar 在我的应用程序中集成链式支付时。它对我来说工作正常,但存在一个问题,即贝宝对话框中没有信用卡支付选项。

谢谢

我指的是link

【问题讨论】:

标签: paypal-sandbox paypal-adaptive-payments


【解决方案1】:

请找到以下链接并检查您的答案...

https://github.com/paypal/PayPal-Android-SDK

 PayPal pp = PayPal.getInstance();
             launchChainedPayment = pp.getCheckoutButton(this, PayPal.BUTTON_194x37, CheckoutButton.TEXT_PAY);
             launchChainedPayment.setOnClickListener(this);




private void initLibrary() {
              PayPal pp = PayPal.getInstance();
              if(pp == null) {
                     pp = PayPal.initWithAppID(this, Constant.PAYPAL_APP_ID, Constant.server);
                     pp.setLanguage("en_US"); // Sets the language for the library.
                     pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); 
                     pp.setShippingEnabled(true);
                     pp.setDynamicAmountCalculationEnabled(false);
              }
             }
         private PayPalAdvancedPayment makeChainedPayment(double priceDouble,double pricePrimary,String primary_email,JSONObject jsonObject) {
                PayPalAdvancedPayment payment = new PayPalAdvancedPayment();
                payment.setCurrencyType("USD");
                payment.setMerchantName("PushND");
                BigDecimal bigDecimalPrimary=new BigDecimal(String.valueOf(priceDouble));
                PayPalReceiverDetails receiverPrimary = new PayPalReceiverDetails();
                receiverPrimary.setRecipient(primary_email);
                //receiverPrimary.setRecipient("adaptive_receiver_1@pushnd.com");
                receiverPrimary.setSubtotal(bigDecimalPrimary);
                receiverPrimary.setIsPrimary(true);
                payment.getReceivers().add(receiverPrimary);
            try {
                    JSONObject jsonObjectSecondary = jsonObject;
                    Iterator<Object> keys = jsonObjectSecondary.keys();
                    while (keys.hasNext())
                    {
                        String Key=String.valueOf(keys.next());
                        PayPalReceiverDetails receiverSecondary= new PayPalReceiverDetails();
                        receiverSecondary.setRecipient(jsonObjectSecondary.getJSONObject(Key).get("email").toString());
                       //   receiverSecondary.setRecipient("adaptive_receiver_2@pushnd.com");
                        double priceSecondary=priceDouble*((Double.parseDouble(jsonObjectSecondary.getJSONObject(Key).get("profit_percent").toString()))/100);
                        BigDecimal bigDecimalSecondary=new BigDecimal(String.valueOf(priceSecondary));
                        receiverSecondary.setSubtotal(bigDecimalSecondary);
                        receiverSecondary.setIsPrimary(false);
                        payment.getReceivers().add(receiverSecondary);
                    }
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
          return payment;
     }

【讨论】:

  • 虽然理论上这可以回答这个问题,it would be preferable 在这里包含答案的基本部分,并提供链接以供参考。
【解决方案2】:
first implement method
   private void initLibrary() {
        PayPal pp = PayPal.getInstance();
        if(pp == null) {
            pp = PayPal.initWithAppID(this, PAYPAL_APP_ID, PayPal.ENV_SANDBOX);
            pp.setLanguage("en_US"); // Sets the language for the library.
            pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER);
//            pp.setShippingEnabled(true);
            pp.setDynamicAmountCalculationEnabled(false);
        }
    }    



**paypal button click event code**

     double secondary_payment = 0;
    double primary_payment = 0;

      PayPalAdvancedPayment advPayment = makeChainedPayment(secondary_payment,primary_payment,"primary_email","secondary_email");

      Intent checkoutIntent = PayPal.getInstance().checkout(advPayment, your_current_activity);
                    startActivityForResult(checkoutIntent, 1); 

    =============================================
    private PayPalAdvancedPayment makeChainedPayment(double priceSecondary, double pricePrimary, String primary_email, String secondary_email) {
            PayPalAdvancedPayment payment = new PayPalAdvancedPayment();
            payment.setCurrencyType("USD");
    //        payment.setMerchantName("PushND");
            BigDecimal bigDecimalPrimary=new BigDecimal(pricePrimary);
            PayPalReceiverDetails receiverPrimary = new PayPalReceiverDetails();
            receiverPrimary.setRecipient(primary_email);
            //receiverPrimary.setRecipient("adaptive_receiver_1@pushnd.com");
            receiverPrimary.setSubtotal(bigDecimalPrimary);
            receiverPrimary.setIsPrimary(true);
            payment.getReceivers().add(receiverPrimary);

            PayPalReceiverDetails receiverSecondary= new PayPalReceiverDetails();
            receiverSecondary.setRecipient(secondary_email);
            BigDecimal bigDecimalSecond=new BigDecimal(priceSecondary);
            receiverSecondary.setSubtotal(bigDecimalSecond);
            payment.getReceivers().add(receiverSecondary);

            return payment;
        }

【讨论】:

    猜你喜欢
    • 2021-08-04
    • 2014-01-23
    • 2011-11-11
    • 2013-03-20
    • 2016-04-02
    • 2016-09-14
    • 2017-11-04
    • 2012-10-23
    相关资源
    最近更新 更多