You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The onPaid callback works well, however, the onTrialStarted callback is usually not called.
For context, I have started many free trials (which show up on ExtensionPay's website) with my developer account in test mode.
Normal scenario where the callback is not called:
Install the extension
Sign up for a free trial (dev email in test mode)
Callback is not called
Strange scenario where it is called:
Install the extension
Sign up for a free trial (dev email in test mode)
Callback is not called just yet
Pay for the extension (dev email in test mode) and keep the popup open
Uninstall the extension
Reinstall the extension
Sign up for a free trial again (dev email in test mode)
Callback is still not called
Click on the popup from earlier (the one where the dev can switch between user statuses)
Reload the popup with F5
The onTrialStarted callback is called
I have noticed that ExtPay doesn't receive the trial-start message. However, it does receive the fetch-user message.
I suspect that refreshing the popup triggers the poll_user_paid function which in turns calls the fetch_user function and that it will trigger the onTrialStarted callback from there.
I think that the onTrialStarted callback does not work otherwise because ExtPay does not (seem to) receive the trial-start message from ExtensionPay's server, even though it does receive fetch-user.
To check which messages it received, I simply added breakpoints in key places in:
startBackground: function(){runtime.onMessage.addListener(function(message,sender,send_response){console.log('service worker got message! Here it is:',message);if(message=='fetch-user'){// Only called via extensionpay.com/extension/[extension-id]/paid -> content_script when user successfully pays.// It's possible attackers could trigger this but that is basically harmless. It would just query the user.poll_user_paid();}elseif(message=='trial-start'){// no need to poll since the trial confirmation page has already set trialStartedAtfetch_user();}elseif(message=='extpay-extinfo'&&management){// get this message from content scripts which can't access browser.managementreturnmanagement.getSelf()}});
Would anybody know where to go from there? What am I doing wrong?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I can trigger the callback in a strange way, but it does not seem to work under normal conditions.
I have set up event listeners in the service worker like so:
The onPaid callback works well, however, the onTrialStarted callback is usually not called.
For context, I have started many free trials (which show up on ExtensionPay's website) with my developer account in test mode.
Normal scenario where the callback is not called:
Strange scenario where it is called:
I have noticed that ExtPay doesn't receive the
trial-start
message. However, it does receive thefetch-user
message.I suspect that refreshing the popup triggers the
poll_user_paid
function which in turns calls thefetch_user
function and that it will trigger the onTrialStarted callback from there.I think that the onTrialStarted callback does not work otherwise because ExtPay does not (seem to) receive the
trial-start
message from ExtensionPay's server, even though it does receivefetch-user
.To check which messages it received, I simply added breakpoints in key places in:
and
Would anybody know where to go from there? What am I doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions