const extpay = ExtPay('ureview') 


extpay.startBackground();


extpay.getUser().then(user => {
    console.log(user)
    if (user.paid) {
        console.log('test extension user is paid:', user)
    } else {
        // extpay.openTrialPage()
        extpay.openPaymentPage()
    }
})
extpay.onTrialStarted.addListener(function(user) {
    console.log('trial started!!!!!')
})

extpay.onPaid.addListener(user => {
    if (typeof browser == "undefined") {
        browser = chrome;
    }
    console.log('onPaid callback! heres the user:', user)
    browser.browserAction.setBadgeText({text:'paid'})
    setTimeout(function() {
        browser.browserAction.setBadgeText({text:''})
    }, 5000)
})
