Skip to main content

PayPal Community

  • Dashboard
  • Send and Request
  • Wallet
  • Business
  • Help
Log in

Le Forum de la communauté n’est pas disponible pour les nouveaux messages ou les réponses; les articles précédents restent disponibles pour vérification. Afin de connaître les options d’assistance complètes, rendez-vous sur PayPal.com/HelpCenter

Si vous souhaitez signaler du contenu illégal et contraire au Règlement sur les services numériques de l’Union Européenne (DSA), veuillez cliquer ici.

since ‎Aug-07-2019
Country: Spain
Type: Business
adharaww
adharaww Contributor
Contributor
3
Posts
0
Kudos
0
Solutions
Your PayPal Anniversary
The Return
Active
View all
Latest Contributions by adharaww
  • Topics adharaww has Participated In
  • Latest Contributions by adharaww

Smart Payment Buttons server integration

by adharaww Contributor in PayPal Payments Standard
‎Nov-04-2019 03:36 PM
‎Nov-04-2019 03:36 PM
Hi all, I'm following this example to integrate paypal with my java webapp: Smart Payment Buttons with server integration   In javascript function I want to send several values and I use the body attribute to send it to server:     <script> paypal.Buttons({ createOrder: function() { return fetch('${pageContext.request.contextPath}/createOrder', { method: 'post', headers: {'content-type': 'application/json'}, body: JSON.stringify({ action: 'paypal', page: 'paypal' }) }).then(function(res) { return res.json(); }).then(function (data) { return data.id; }); }, style: { color: 'blue', shape: 'rect', label: 'paypal', height: 40 } }).render('#ppBtn'); </script>     But I'm unable to get the parameters I defined in the body attribute. I tried everything: request.getParameter("action") request.getAttribute("action") request.getReader()   But anything worked. Could you help me to find the best way to achieve this?   Thank you very much   ... View more

Smart Payment Buttons custom integration problem

by adharaww Contributor in SDKs
‎Oct-14-2019 08:05 AM
‎Oct-14-2019 08:05 AM
Hi all, I'm facing an integration with smart payment buttons with server-side setup because my data is filled dynamically and also I want to store the payment in my own database.   If I try this code it works successfully: <script> paypal.Buttons({ createOrder: function(data, actions) { // Set up the transaction return actions.order.create({ purchase_units: [{ amount: { value: '0.01' } }] }); }, style: { color: 'blue', shape: 'rect', label: 'paypal', height: 40 } }).render('#ppBtn');</script>   But when I try to define a server method call to achieve what I need I got an error: client-side   <script> paypal.Buttons({ createOrder: function() { return fetch('${pageContext.request.contextPath}/createOrder', { method: 'post', headers: {'content-type': 'application/json'} }).then(function(res) { return res.json(); }).then(function(data) { return data.orderID; // Use the same key name for order ID on the client and server }); }, style: { color: 'blue', shape: 'rect', label: 'paypal', height: 40 } }).render('#ppBtn'); </script>    server-side   public HttpResponse<Order> createOrder(boolean debug) throws IOException { OrdersCreateRequest request = new OrdersCreateRequest(); request.prefer("return=representation"); request.requestBody(buildRequestBody()); //3. Call PayPal to set up a transaction HttpResponse<Order> response = client().execute(request); if (debug) { if (response.statusCode() == 201) { System.out.println("Status Code: " + response.statusCode()); System.out.println("Status: " + response.result().status()); System.out.println("Order ID: " + response.result().id()); System.out.println("Intent: " + response.result().intent()); System.out.println("Links: "); for (LinkDescription link : response.result().links()) { System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); } System.out.println("Total Amount: " + response.result().purchaseUnits().get(0).amount().currencyCode() + " " + response.result().purchaseUnits().get(0).amount().value()); } } return response; }     And the error message is the following: unhandled_error Object { err: "JSON.parse: unexpected character at line 26 column 1 of the JSON data\ncreateOrder@http://localhost:8081/ROOT/:437:8\nhr/</</</<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:55387\nw</n.dispatch@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:5429\nw</n.then@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:6172\nhr/</</<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:55000\n@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:60279\nw</e.try@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:7915\n@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:59991\nNr@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:62261\n_r/</</<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:66869\n_r/</<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:66647\n\n\nor[er.ERROR]@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:50112\nCr/</<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:56841\nCr/<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:56695\nCr@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:56635\nNr/l<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:61935\nNr@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:61889\n_r/</</<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:66869\n_r/</<@https://www.paypal.com/sdk/js?client-id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&currency=EUR&disable-funding=sofort:1:66647\n", timestamp: "1571062868630", referer: "www.sandbox.paypal.com", uid: "19a7b17404_mti6mjg6mdu", env: "sandbox" }   It does not make any sense for me and it never gets method in server side.   Could you kindly help me with something that can be useful to solve this problem?   Thank you to all. ... View more

Custom paypal payment button

by adharaww Contributor in Merchant Products and Services Archives
‎Aug-07-2019 08:58 AM
‎Aug-07-2019 08:58 AM
Paypal has the following page: https://developer.paypal.com/demo/checkout/#/pattern/radio where you can set buttons with radio buttons.   The button payment when paypal is choosen works as expected, open the popup paypal to pay.   What I want to achieve is to make a similar payment button when credit card payment is choosen, but I don't know how to set the button to display the card payment in paypal.   I found that the button generated code contains a parameter named data-funding-source.   If you view the responsive feature in the page I shared at the beginning, you can see the button VISA, working like I would like the button I want to create works.   Is that possible?   Thank you ... View more
Labels:
  • Labels:
  • PayPal Buttons
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