Question

I have integrated paypal sdk for parallel payment, I did everything and made payment to two different receivers. When I make payment I get successful message of payment and also I receive PayKey, my problem is that I am not receiving mail of payment on any other of email I attached to both receivers. Does paypal sends mail to receiver in parallel payment or I have to do something additional in my code. below is the code I used

private PayPalAdvancedPayment exampleParallelPayment() {
  // Create the PayPalAdvancedPayment.
  PayPalAdvancedPayment payment = new PayPalAdvancedPayment();
  // Sets the currency type for this payment.
  payment.setCurrencyType("USD");
  // Sets the Instant Payment Notification url. This url will be hit by
  // the PayPal server upon completion of the payment.
  payment.setIpnUrl("http://www.exampleapp.com/ipn");
  // Sets the memo. This memo will be part of the notification sent by
  // PayPal to the necessary parties.
  payment.setMemo("This sure is a swell memo for a parallel payment.");

  // Create the PayPalReceiverDetails. You must have at least one of these
  // to make an advanced payment and you should have
  // more than one for a Parallel or Chained payment.
  PayPalReceiverDetails receiver1 = new PayPalReceiverDetails();
  // Sets the recipient for the PayPalReceiverDetails. This can also be a
  // phone number.
  receiver1.setRecipient("manishkh92@gmail.com");
//  receiver1.setRecipient("example-merchant-2@paypal.com");
  // Sets the subtotal of the payment for this receiver, not including tax
  // and shipping amounts.
  receiver1.setSubtotal(new BigDecimal("13.50"));
  // Sets the primary flag for this receiver. This is defaulted to false.
  // No receiver can be a primary for a parallel payment.
  receiver1.setIsPrimary(false);
  // Sets the payment type. This can be PAYMENT_TYPE_GOODS,
  // PAYMENT_TYPE_SERVICE, PAYMENT_TYPE_PERSONAL, or PAYMENT_TYPE_NONE.
  receiver1.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);

  // PayPalInvoiceData can contain tax and shipping amounts. It also
  // contains an ArrayList of PayPalInvoiceItem which can
  // be filled out. These are not required for any transaction.
  PayPalInvoiceData invoice1 = new PayPalInvoiceData();
  // Sets the tax amount.
  invoice1.setTax(new BigDecimal("2.20"));
  // Sets the shipping amount.
  invoice1.setShipping(BigDecimal.ZERO);

  // PayPalInvoiceItem has several parameters available to it. None of
  // these parameters is required.
  PayPalInvoiceItem item1 = new PayPalInvoiceItem();
  // Sets the name of the item.
  item1.setName("Laser Show");
  // Sets the ID. This is any ID that you would like to have associated
  // with the item.
  item1.setID("4211");
  // 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(new BigDecimal("7.30"));
  // Sets the unit price.
  item1.setUnitPrice(new BigDecimal("7.30"));
  // 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().
  invoice1.getInvoiceItems().add(item1);

  // Create and add another PayPalInvoiceItem to add to the
  // PayPalInvoiceData.
  PayPalInvoiceItem item2 = new PayPalInvoiceItem();
  item2.setName("Fog Machine");
  item2.setID("6325");
  item2.setTotalPrice(new BigDecimal("4.80"));
  item2.setUnitPrice(new BigDecimal("1.20"));
  item2.setQuantity(4);
  invoice1.getInvoiceItems().add(item2);

  // Create and add another PayPalInvoiceItem to add to the
  // PayPalInvoiceData.
  PayPalInvoiceItem item3 = new PayPalInvoiceItem();
  item3.setName("Fog Liquid");
  item3.setID("2196");
  item3.setTotalPrice(new BigDecimal("1.40"));
  item3.setUnitPrice(new BigDecimal("0.20"));
  item3.setQuantity(7);
  invoice1.getInvoiceItems().add(item3);

  // Sets the PayPalReceiverDetails invoice data.
  receiver1.setInvoiceData(invoice1);
  // Sets the merchant name. This is the name of your Application or
  // Company.
  receiver1.setMerchantName("Laser Shop");
  // Sets the description of the payment.
  receiver1.setDescription("The first of two party guys");
  // Sets the Custom ID. This is any ID that you would like to have
  // associated with the PayPalReceiverDetails.
  receiver1.setCustomID("001813");
  // Add the receiver to the payment. Alternatively, you can create an
  // ArrayList<PayPalReceiverOptions>
  // and pass it to the PayPalAdvancedPayment function setReceivers().
  payment.getReceivers().add(receiver1);

  // Create another receiver for the parallel payment
  PayPalReceiverDetails receiver2 = new PayPalReceiverDetails();
  receiver2.setRecipient("kumawat.rahul10@gmail.com");
  receiver2.setSubtotal(new BigDecimal("16.00"));
  receiver2.setIsPrimary(false);
  receiver2.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);

  // PayPalInvoiceData can contain tax and shipping amounts. It also
  // contains an ArrayList of PayPalInvoiceItem which can
  // be filled out. These are not required for any transaction.
  PayPalInvoiceData invoice2 = new PayPalInvoiceData();
  // Sets the tax amount.
  invoice2.setTax(new BigDecimal("3.40"));
  // Sets the shipping amount.
  invoice2.setShipping(new BigDecimal("5.15"));

  // PayPalInvoiceItem has several parameters available to it. None of
  // these parameters is required.
  PayPalInvoiceItem item4 = new PayPalInvoiceItem();
  // Sets the name of the item.
  item4.setName("Beverages");
  // Sets the ID. This is any ID that you would like to have associated
  // with the item.
  item4.setID("7254");
  // 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.
  item4.setTotalPrice(new BigDecimal("11.00"));
  // Sets the unit price.
  item4.setUnitPrice(new BigDecimal("1.00"));
  // Sets the quantity.
  item4.setQuantity(11);
  // Add the PayPalInvoiceItem to the PayPalInvoiceData. Alternatively,
  // you can create an ArrayList<PayPalInvoiceItem>
  // and pass it to the PayPalInvoiceData function setInvoiceItems().
  invoice2.getInvoiceItems().add(item4);

  // Create and add another PayPalInvoiceItem to add to the
  // PayPalInvoiceData.
  PayPalInvoiceItem item5 = new PayPalInvoiceItem();
  item5.setName("Refreshments");
  item5.setID("1288");
  item5.setTotalPrice(new BigDecimal("5.00"));
  item5.setUnitPrice(new BigDecimal("1.25"));
  item5.setQuantity(4);
  invoice2.getInvoiceItems().add(item5);

  // Sets the PayPalReceiverDetails invoice data.
  receiver2.setInvoiceData(invoice2);
  // Sets the merchant name. This is the name of your Application or
  // Company.
  receiver2.setMerchantName("Drinks & Refreshments");
  // Sets the description of the payment.
  receiver2.setDescription("The second of two party guys");
  // Sets the Custom ID. This is any ID that you would like to have
  // associated with the PayPalReceiverDetails.
  receiver2.setCustomID("001768");
  payment.getReceivers().add(receiver2);

  return payment;
 }
Was it helpful?

Solution

Are you working in the sandbox? If so, it won't send actual emails. Instead, you can check the Notifications link under the sandbox profile in your developer.paypal.com account. Any emails that would typically get sent should show up there for each individual account.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top