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控制器,以便我可以在服务器上保存付款详细信息。
用于在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控制器URL。
必须使用您的网站主机名替换Localhost,否则PayPal会尝试打开它自己的服务器。