智能付款按钮服务器集成

我正在按照以下示例将Paypal与我的Java Webapp集成: https://developer.paypal.com/docs/checkout/reference/server-integration/set-up-transaction/ 有点不同,我想向服务器发送几个值

在javascript函数中,我想发送多个值,并使用body属性将其发送到服务器: 我在服务器端尝试了所有操作: request.getParameter(“ action”)

request.getattribute(“ action”)

request.getReader()

但是一切正常。

<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>

我需要恢复在body属性中定义的值,以便使用此信息生成新订单。

kshsc 回答:智能付款按钮服务器集成

您可能会发现此骨架演示更加有用:http://www.embeddedadventures.com/datasheets/BME280.pdf

但是根据您的标签,您的问题似乎与如何在Java中访问POST变量有关?

对于实际的Java,也许这样的事情会有所帮助:https://developer.paypal.com/demo/checkout/#/pattern/server

或者对于node.js,如果您偶然使用了该服务器端:Get the POST request body from HttpServletRequest

本文链接:https://www.f2er.com/3163101.html

大家都在问