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
- Paypal 4X credit : translated message & currency error in PayPal Payments Standard
- When clicking on a payment button generates error: Unexpected token ... in PayPal Payments Standard
- Error: "Unable to change shipping method. Please try again." in PayPal popup in REST APIs
- Question about the ButtonSource field when converting an integration from SOAP/NVP to REST API v1. in REST APIs
- Simple Paypal button integration results in 404 error in Sandbox Environment