Skip to main content

PayPal Community

  • Dashboard
  • Send and Request
  • Wallet
  • Business
  • Help
Log in
  • Welcome
    • Guidelines
    • News and Events
    • Suggestions for PayPal
    • General Discussions
  • PayPal Help Community
    • Managing Account
    • Transactions
    • Wallet
    • Security and Fraud
    • Products & Services
    • Reporting
  • MTS Community
    • PayPal Upgrade Community
    • PayPal Payments Standard
    • REST APIs
    • NVP/SOAP APIs
    • SDKs
    • Sandbox Environment
    • PayPal Reporting
    • Payflow
    • Ideas for MTS
    • Client-side Integration
    • Server-side Integration
  • The Archives
    • PayPal Help Community Archives
      • Managing Account Archives
      • Transactions Archives
      • Wallet Archives
      • Security and Fraud Archives
      • Products & Services Archives
      • Reporting Archives
    • Help Community
      • PayPal Basics Archives
      • Payments Archives
      • My Money Archives
      • My Account Archives
      • Disputes and Limitations Archives
      • Products and Services Archives
      • PayPal Credit Archives
    • Merchant Community
      • Merchant Products
      • Business Tools Archives
      • Reporting Archives
      • Managing Risk and Fraud Archives
    • Help Archives
      • About Business (Archive)
      • About Payments (Archive)
      • About Settings (Archive)
      • About eBay (Archive)
      • About Protections (Archive)
      • About Products (Archive)
    • Social and Your Voice Archives
      • Off Topic (Archive)
      • My Feedback for PayPal (Archive)
    • About PayPal Archives
      • Watercooler (Archive)
      • Tax Information (Archive)
      • Fees (Archive)
      • eBay and PayPal (Archive)
      • Coupons and promotions (Archive)
    • My Account Archives
      • My account settings (Archive)
      • Account limits and verification (Archive)
      • Account balance (Archive)
      • Bank accounts and credit cards (Archive)
    • Payments Archives
      • Sending money (Archive)
      • Receiving money (Archive)
      • Refunds (Archive)
      • Donations and Fundraising (Archive)
    • Disputes and Security Archives
      • Disputes and claims (Archive)
      • Fraud, phishing and spoof (Archive)
    • My Business Archives
      • Merchant services (Archive)
      • Reporting and tracking (Archive)
      • Shipping (Archive)
    • PayPal Products Archives
      • PayPal Debit Mastercard (Archive)
      • PayPal Extras MasterCard (Archive)
      • PayPal Mobile & Other Services (Archive)
      • Student Accounts (Archive)
      • Bill Me Later (Archive)
    • Getting to know PayPal
      • My PayPal account
      • Security and protection
    • Receiving and sending money
      • Buying with PayPal
      • Selling with PayPal
    • PayPal Here UK
      • PayPal Here News and Events
      • PayPal Here Community
      • Chip and Pin Card Reader
      • PayPal Here App

The Community Forum will no longer be available starting June 30, 2025. Please note that the forum is now closed for new posts and responses, but previous posts will remain accessible for review until June, 30 2025. For comprehensive support options, please visit PayPal.com/HelpCenter
Merchant Technical Support: For technical support and related questions, please visit our Technical Support Help Center or Developer Central

If you want to report illegal content under the EU Digital Services Act, please do so here

since ‎Sep-21-2018
Country: Nepal
Type: Personal
manjiltamang
manjiltamang Contributor
Contributor
1
Post
0
Kudos
0
Solutions
Your PayPal Anniversary
Organized
Ice Breaker
The Return
View all
Latest Contributions by manjiltamang
  • Topics manjiltamang has Participated In
  • Latest Contributions by manjiltamang

Re: PayPal Community Chat - September 21, 2018 - O...

by manjiltamang Contributor in Announcements and Events
‎Sep-21-2018 09:19 AM
‎Sep-21-2018 09:19 AM
Hi, I created a very simple program with the help of paypal's api docs. The code is fairly simple. Program works correctly as it should, it even shows the success response when payment is executed through return url. But the amount is not being added from seller account to the merchant account. Any help would be appreciated. Thanks!   Here's my code.   @Configuration public class PaypalConfig { @Value("${paypal.client.app}") private String clientId; @Value("${paypal.client.secret}") private String clientSecret; @Value("${paypal.mode}") private String mode; @Bean public Map<String, String> paypalSdkConfig(){ Map<String, String> sdkConfig = new HashMap<>(); sdkConfig.put("mode", mode); return sdkConfig; } @Bean public OAuthTokenCredential authTokenCredential() { return new OAuthTokenCredential(clientId,clientSecret,paypalSdkConfig()); } @Bean public APIContext apiContext() throws PayPalRESTException{ @SuppressWarnings("deprecation") APIContext apiContext = new APIContext(authTokenCredential().getAccessToken()); apiContext.setConfigurationMap(paypalSdkConfig()); return apiContext; } } @Autowired private APIContext apiContext;   @GetMapping() public String paypalPay(HttpServletRequest req) { // Set payment details Details details = new Details(); details.setShipping("1"); details.setSubtotal("5"); details.setTax("1");   // Payment amount Amount amount = new Amount(); amount.setCurrency("USD"); // Total must be equal to sum of shipping, tax and subtotal. amount.setTotal("7"); amount.setDetails(details);   // Transaction information Transaction transaction = new Transaction(); transaction.setAmount(amount); transaction.setDescription("This is the payment transaction description.");   // ### Items Item item = new Item(); item.setName("Ground Coffee 40 oz").setQuantity("1").setCurrency("USD").setPrice("5"); ItemList itemList = new ItemList(); List items = new ArrayList(); items.add(item); itemList.setItems(items);   transaction.setItemList(itemList);   // The Payment creation API requires a list of // Transaction; add the created `Transaction` // to a List List transactions = new ArrayList(); transactions.add(transaction);   // ###Payer // A resource representing a Payer that funds a payment // Payment Method // as 'paypal' Payer payer = new Payer(); payer.setPaymentMethod("paypal");   // Add payment details Payment payment = new Payment(); payment.setIntent("sale"); payment.setPayer(payer); // payment.setRedirectUrls(redirectUrls); payment.setTransactions(transactions);   // ###Redirect URLs RedirectUrls redirectUrls = new RedirectUrls(); String guid = UUID.randomUUID().toString().replaceAll("-", ""); redirectUrls.setCancelUrl(req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath() + "/paypal/payment/cancel?guid=" + guid); redirectUrls.setReturnUrl(req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + req.getContextPath() + "/paypal/payment/success?guid=" + guid); payment.setRedirectUrls(redirectUrls);   // Create payment try { Payment createdPayment = payment.create(apiContext);   // ###Payment Approval Url Iterator links = createdPayment.getLinks().iterator(); while (links.hasNext()) { Links link = links.next(); if (link.getRel().equalsIgnoreCase("approval_url")) { // System.out.println(link.getHref()); // System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); // req.setAttribute("redirectURL", link.getHref()); return "redirect:" + link.getHref(); } }   } catch (PayPalRESTException e) { System.err.println(e.getDetails()); return "redirect:/paypal/error"; } // System.out.println("Success url: " + redirectUrls.getReturnUrl()); // System.out.println("Payment id"+ createdPayment.getId()); // return createdPayment; return "redirect:/paypal/error";   }   @GetMapping("/payment/success") @ResponseBody public String executePayment(HttpServletRequest req) { APIContext apiContext = new APIContext(clientID, clientSecret, mode);   Payment payment = new Payment(); payment.setId(req.getParameter("paymentId"));   PaymentExecution paymentExecution = new PaymentExecution(); paymentExecution.setPayerId(req.getParameter("PayerID")); try {   Payment createdPayment = payment.execute(apiContext, paymentExecution);   System.out.println(createdPayment);   return "Success"; } catch (PayPalRESTException e) {   System.err.println(e.getDetails());   return "Failed"; } }  ... View more
Paypal Logo
  • Help
  • Contact Us
  • Security
  • Fees
  • © 1999-2025 PayPal, Inc. All rights reserved.
  • Privacy
  • Legal
  • Cookies
  • Policy Updates

The money in your balance is eligible for pass-through FDIC insurance.

The PayPal Cash Mastercard is issued by The Bancorp Bank pursuant to a license by Mastercard International Incorporated. The Bancorp Bank; Member FDIC.

Powered by Khoros
Welcome to the PayPal Community!