gpt4 book ai didi

使用 REST 的 Java PayPal 客户端快速结帐(redirect_urls 不工作)

转载 作者:太空宇宙 更新时间:2023-11-03 15:49:57 25 4
gpt4 key购买 nike

   Client Side Express Checkout using REST to integrate PayPal in java to do transaction by PayPal account or by using credit/debit cards.

我希望 paypal 在成功付款后在我的 java Controller 上重定向,以便我可以在服务器上保存付款详细信息。

在 jsp 页面中调用 REST API 的代码

<script>
paypal.Button.render({
env : 'production',
client : {
sandbox : 'YYY',
production : 'XXX'
},
commit : true,
payment : function(data, actions) {
return actions.payment.create({
payment : {
transactions : [ {
amount : {
total : 1.2,
currency : 'JPY'
}
} ],
redirect_urls: {
return_url : "http://localhost:8080/tpoint-jaxrs/web/success_redirection",
cancel_url : "http://localhost:8080/tpoint-jaxrs/web/cancel_redirection"
}
}
});
},
onCancel : function(data, actions) {
},
onAuthorize : function(data, actions) {
return actions.payment.execute().then(
function(payment) {

});
}

}, '#paypal-button-container');
</script>

但是在 Paypal 支付成功/取消之后, Paypal 不会调用提供的java controller url

最佳答案

Localhost 必须替换为您的网站主机名,否则 PayPal 会尝试打开自己的服务器。

关于使用 REST 的 Java PayPal 客户端快速结帐(redirect_urls 不工作),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51396965/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com