How do I let the custumer change the quantity of a product in the payment form in android app

  • Profile Image
    Limor 
    Asked on June 14, 2015 at 04:23 AM

    HI

    I'm writing an android app.

    I succeed adding a paypal button to it, but I don't know how to make two fields configurable by custumer:

    * product quantity

    * costumer address

     

    this is my  code so far:

     

    public void PayPalButtonClick(View v) {
    PayPalPayment newPayment = new PayPalPayment();
    newPayment.setCurrencyType("ILS");
    newPayment.setRecipient("momilk.israel@gmail.com");
    newPayment.setMerchantName("Picasso and PayPal");

    PayPalInvoiceData invoice = new PayPalInvoiceData();
    PayPalInvoiceItem item1 = new PayPalInvoiceItem();
    // Sets the name of the item.
    item1.setName(milk_bags_name[_value]);
    // Sets the total price which should be (quantity * unit price). The total prices of all PayPalInvoiceItem should add up
    // to less than or equal the subtotal of the payment.
    item1.setTotalPrice(milk_bags_cost[_value]);
    // Sets the unit price.
    item1.setUnitPrice(milk_bags_cost[_value]);
    // Sets the quantity.
    //item1.setQuantity(1);
    // Add the PayPalInvoiceItem to the PayPalInvoiceData. Alternatively, you can create an ArrayList<PayPalInvoiceItem>
    // and pass it to the PayPalInvoiceData function setInvoiceItems().
    invoice.getInvoiceItems().add(item1);

    invoice.setShipping(shipping_cost[_value]);

    BigDecimal st = milk_bags_cost[_value];
    st.add(shipping_cost[_value]);
    newPayment.setSubtotal(st);


    newPayment.setInvoiceData(invoice);

    Intent checkoutIntent = PayPal.getInstance().checkout(newPayment, this /*, new ResultDelegate()*/);



    // Use the android's startActivityForResult() and pass in our
    // Intent.
    // This will start the library.
    this.startActivityForResult(checkoutIntent, REQUEST_PAYPAL_CHECKOUT);


    //Intent paypalIntent = PayPal.getInstance().checkout(newPayment, this);
    //this.startActivityForResult(paypalIntent, 1);

    }
  • Profile Image
    Mike_G
    Answered on June 14, 2015 at 01:46 PM

    I would like to apologize, but I'm sure I am not understanding what you want here. Well, I understand that you would like to create an Android App that has a Payment form and you would like to include a Quantity field for customers to select the quantity of the product they are purchasing.

    I'm not sure what the codes(included in your post) are for. I think this is what you would like to know: How-to-add-options-to-Payment-Forms

    You can create a Form here with JotForm and integrate Paypal with it. You can then open that form using your Android device's web browser.

    Setting-Up-Your-First-Order-Form

    Let us know how else we can be of assistance to you. Looking forward to your response. Thank you.