AnsweredAssumed Answered

Web viewer not redirecting (JavaScript and FileMaker)

Question asked by ishowedup on Feb 19, 2019
Latest reply on Feb 26, 2019 by fmpdude

I'm really new to FileMaker. So basically I'm trying to work on web viewer (using this idea: FileMaker Web Viewer and Javascript: An Introduction ) to integrate the PayPal checkout button.

It's basically this: Smart Payment Buttons Integration

 

Below is the script I have right now. When clicking the "PayPal button", it should redirect the user to the PayPal website but it's not doing so right now.

 

"data:text/html,

<head>

    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">

    <meta http-equiv='X-UA-Compatible' content='IE=edge' />

</head>

 

<body>

    <div id=\"paypal-button-container\"></div>

    <script src=\"https://www.paypal.com/sdk/js?client-id=key&currency=USD\"></script>

    <script>

        paypal.Buttons({

            createOrder: function(data, actions) {

                return actions.order.create({

                    purchase_units: [{

                        amount: {

                            value: '0.01'

                        }

                    }]

                });

            },

 

        onApprove: function(data, actions) {

                return actions.order.capture().then(function(details) {

                    

                    alert('Transaction completed by ' + details.payer.name.given_name + '!');

                });

            }

        }).render('#paypal-button-container');

    </script>

</body>"

Outcomes