Smart Payment Buttons server integration
adharaww
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
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
0 REPLIES 0

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Is it possible to make payments in RON (Romanian Leu) through PayPal? in REST APIs
- p is not a function error using the example downloaded from Paypal in SDKs
- How do you create subscriptions with PayPal Advanced Checkout? in SDKs
- How to integrate PayPal during user signup to avoid re-entering credentials for future payments? in REST APIs
- Create Pay Links using PayPal API in REST APIs