使用REST的Java PayPal客户端快速结账(redirect_urls无法正常工作)

问题描述 投票:2回答:1
   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。

java paypal paypal-sandbox express-checkout
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.