kousar Rahman
kousar Rahman

Reputation: 11

caught TypeError: Cannot read properties of undefined (reading 'profitwellSnippetBase') in paddle.js

I have intrgrated paddle billing api in Laravel , It working fine in sandbox but in live it return errors. enter image description here

This is my code

 <script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script>
    <script>
        Paddle.Environment.set("live"}");
        Paddle.Initialize({
            token: "{{ $data['client_key'] }}",
            eventCallback: function(data) {
                switch (data.name) {
                    case "checkout.completed":
                        let success_url = "{{ $data['return_url'] }}?paddle_order_id=" + data.data
                            .transaction_id;
                        window.location.href = success_url;
                        break;
                    case "checkout.closed":
                        window.location.href = "{{ $data['cancel_url'] }}";
                        break;
                }
            }
        });

        let settings = {
            displayMode: "overlay",
            theme: "light",
            locale: "en",
            showAddDiscounts: false
        };

        Paddle.Checkout.open({
            settings: settings,
            transactionId: "{{ $data['transaction_id'] }}",
        });
    </script>

How to fix this issue ?

Upvotes: 1

Views: 78

Answers (1)

m6120
m6120

Reputation: 21

Paddle.Environment.Set() takes parameters "sandbox" or "production". Not "live".

Upvotes: 0

Related Questions