我已经整合了paypal sdk用于并行支付,我做了所有事情并向两个不同的接收者付款。当我付款时,我得到了付款的成功信息,而且我收到了PayKey,我的问题是我没有收到我附加到两个收件人的任何其他电子邮件的付款邮件。 paypal是否以并行付款方式向收件人发送邮件,或者我必须在我的代码中执行其他操作。 下面是我使用的代码
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;
}
答案 0 :(得分:1)
你在沙箱工作吗?如果是这样,它就不会发送实际的电子邮件。相反,您可以在developer.paypal.com帐户中的沙箱配置文件下查看通知链接。通常会发送的任何电子邮件都应显示在每个帐户中。