paypal api send money code example

Example: send money to payal account using api

private OrderRequest buildRequestBody() {
    OrderRequest orderRequest = new OrderRequest();
    orderRequest.intent("CAPTURE");

    ApplicationContext applicationContext = new ApplicationContext();

    List<PurchaseUnitRequest> purchaseUnitRequests = new ArrayList<>();
    PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest()
            .amount(new AmountWithBreakdown().currencyCode("USD").value("220.00"));
    Payee payee = new Payee();
    payee.emailAddress("[email protected]");
    purchaseUnitRequest.payee(payee);        
    purchaseUnitRequests.add(purchaseUnitRequest);
    orderRequest.purchaseUnits(purchaseUnitRequests);
    return orderRequest;
}copy

Tags:

Misc Example