PaddleHQ / paddle-js-wrapper

Wrapper to load Paddle.js as a module and use TypeScript definitions when working with methods.
Apache License 2.0
28 stars 4 forks source link

[Bug]: Profitwell doesn't load during development #30

Closed ACPixel closed 3 months ago

ACPixel commented 4 months ago

What happened?

I'm not 100% sure if this is intended or not, but we wanted to get Retain setup and use the retain cancelation flow. However we're having a really hard time testing this as profitwell.js doesn't seem to be injected/loaded when in development mode at all. This means that both the initCancelationFlow and the Retain.demo functions simply error out. If I manually replace our token and pwCustomer in the initialization with production values however it does load, and I am able to use the demo and cancelation flow.

I do want to note that we use wildcard localhost domains for local development, so in this situation our dashboard is on ak.localhost when in development mode if this might have anything to do with this.

However if this is intended, is there any way to "correctly" test profitwell/retain features while in development mode?

I've also noticed that even on our staging domain, the profitwell script won't be loaded unless a pwCustomer ID is passed on the first call to initializePaddle, even though from my understanding the docs say to pass an empty pwCustomer object for any customer that is not signed in(which I would expect to load the profitwell/retain script)

Steps to reproduce

  1. Initialize paddle via npm or script
  2. Try to run any retain function
  3. ...

What did you expect to happen?

No response

How are you integrating?

Tried @paddle/paddle-js as well as the paddle script

vijayasingam-paddle commented 4 months ago

Hi @ACPixel,

This is intentional as Retain internally uses data from the production environment. Unfortunately testing it with Sandbox data is not possible at the moment.

Please read through our testing guide to see if it helps.

I've also noticed that even on our staging domain, the profitwell script won't be loaded unless a pwCustomer ID is passed on the first call to initializePaddle, even though from my understanding the docs say to pass an empty pwCustomer object for any customer that is not signed in(which I would expect to load the profitwell/retain script)

We do not use pwCustomer to determine if the retain script should be injected. It relies only on the environment to be production and a valid token or pwAuth is passed to Paddle.Setup function