accessing stripe in CSUI

I'm trying to mount a content panel that checks if the user is on a paid subscription before accessing certain page details. I've got auth working, but not a way to check the Stripe API (following the dangers of injecting script direct to browser like this tutorial mentions) https://www.propelauth.com/post/chrome-extension-authentication-with-plasmo the with-stripe example on Github only works in the popup, I'm now trying to get the customer info by email from a background script using sendToBackground but it hangs after logging the email. any tips?
import type { PlasmoMessaging } from "@plasmohq/messaging"
import Stripe from 'stripe';

const stripe = new Stripe(process.env.STRIPE_PRIVATE_KEY, {
apiVersion: "2023-08-16"
})

const handler: PlasmoMessaging.MessageHandler = async (req, res) => {

let email = req.body.email


console.log('_log email', email)


const c = await stripe.customers.list({
email,
limit: 10
})


console.log('_log c', c)


return c
}

export default handler
import type { PlasmoMessaging } from "@plasmohq/messaging"
import Stripe from 'stripe';

const stripe = new Stripe(process.env.STRIPE_PRIVATE_KEY, {
apiVersion: "2023-08-16"
})

const handler: PlasmoMessaging.MessageHandler = async (req, res) => {

let email = req.body.email


console.log('_log email', email)


const c = await stripe.customers.list({
email,
limit: 10
})


console.log('_log c', c)


return c
}

export default handler
PropelAuth Blog
Chrome Extension Authentication with Plasmo
Chrome extensions can be an incredibly powerful medium for a product. With over two billion active Chrome browsers in the world, an extension can help a brand reach a large audience with ease. They can provide additional functionality, improve user experience, and streamline tasks. The only problem, however, is they
1 Reply
terraboom
terraboom•14mo ago
I suggest you to develop the backend for it
Want results from more Discord servers?
Add your server