private String makePayment(String accessToken) {
    Map<String, String> sdkConfig = new HashMap<String, String>();
    sdkConfig.put("mode", "sandbox");

    // String accessToken = "Bearer A015XqgSXpttQxsNdAzq6DiMBx8oWx8p3Jt2wEyK-OmExEA";
    APIContext apiContext = new APIContext(accessToken);
    apiContext.setConfigurationMap(sdkConfig);

    Amount amount = new Amount();
    amount.setCurrency("USD");
    amount.setTotal("25");

    Transaction transaction = new Transaction();
    transaction.setDescription("Creating a payment for $" + amount.getTotal());
    transaction.setAmount(amount);

    List<Transaction> transactions = new ArrayList<Transaction>();
    transactions.add(transaction);

    Payer payer = new Payer();
    payer.setPaymentMethod("paypal");

    Payment payment = new Payment();
    payment.setIntent("sale");
    payment.setPayer(payer);
    payment.setTransactions(transactions);
    RedirectUrls redirectUrls = new RedirectUrls();
    redirectUrls.setCancelUrl("https://devtools-paypal.com/guide/pay_paypal?cancel=true");
    redirectUrls.setReturnUrl("https://devtools-paypal.com/guide/pay_paypal?success=true");
    payment.setRedirectUrls(redirectUrls);

    String redirectLink = null;
    try {
      Payment createdPayment = payment.create(apiContext);
      List<Links> links = createdPayment.getLinks();

      for (Links link : links) {
        if ("redirect".equals(link.getMethod().toLowerCase())) {
          redirectLink = link.getHref();
        }
      }

      System.out.println();
    } catch (PayPalRESTException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return redirectLink;
  }