perfect money api code example

Example 1: rates api

GET https://api.ratesapi.io/api/latest{
  "base": "EUR",
  "date": "2020-09-11",
  "rates": {
    "GBP": 0.92408,
    "HKD": 9.1871,
    "IDR": 17772.61,
    "ILS": 4.1004,
    "DKK": 7.4402,
    "INR": 87.2431,
    "CHF": "..."
  }
}

Example 2: 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:

Java Example