开发者

Android PayPal adaptive payment integration

Hello everyone,

    I need 开发者_JS百科to integrate paypal guest payment via credit card.

The android paypal sdk as far as i know, allows you to pay via paypal account.

So what I searched, I will be needing adaptive payments to achieve it, but I didn't got any success with it.

So can anyone of you provide any help of some kind.......... ?


Paypal give access to pay via credit card .but now its depricated .If you want to use it remove exclude creditcard.io from your app gradel in android


Android PayPal adaptive payment integration

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;
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜