cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

Who Me Too'd this topic

Options
adharaww
Contributor
Posted on

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

 

Who Me Too'd this topic