Add user's Stripe-purchases to accessToken

I’m setting up a Gatsby SPA. The user can pay to access online courses, using Stripe. I’d like to make it so that when the user logs in, he receives a list of all the courses he has paid for.

Ideally, I’d have Stripe webhook into Auth0 upon payment to add a key to that user’s info to signal he has paid for that course. If the user doesn’t exist yet, it does nothing. Upon user registration, I’d like to query Stripe to check for every course this newly registered user has purchased.

I’ve written the code to query Stripe’s API and get a list of all the products this user has paid for, but then realised Auth0’s rules don’t allow external calls.

I can’t find a way to make this work with Auth0’s rules. Is this possible? If not, any suggestions on a workaround?