How to fetch plan ID and plan type for authenticated users with custom code in Memberstack? Answered

Post author
Josef Eines

How can i get planID of current logged in user with custom JS?

Comments

7 comments

  • Comment author
    Yannick Caron
    window.$memberstackDom.getCurrentMember().then((member) => {console.log(member.data.planConnections[0].id)})
    0
  • Comment author
    Josef Eines

    you rock!

    0
  • Comment author
    Yannick Caron

    You can try something like this!

    Don't know if this works for your use case specifically, but if I run this in the console, it logs the plan id.

    0
  • Comment author
    Josef Eines

    Yannick Caron, gonna test now b

    looks like it work, but i think i need to get plan type (free/paid) and write to console

    You know any way to do this?

    Trying to build a custom script, but need to figure out if user is on paid plan or free plan first

    0
  • Comment author
    Yannick Caron
    window.$memberstackDom.getCurrentMember().then((member) => {console.log(member.data.planConnections[0].type)})
    window.$memberstackDom.getCurrentMember().then((member) => {console.log(member.data.planConnections[0])})

    If u use this one you can see all properties you can access regarding your users' plans

    window.$memberstackDom.getCurrentMember().then((member) => {console.log(member.data)})
    This one gives you access to all data that is available from users.
    0
  • Comment author
    Josef Eines

    works like a charm Yannick

    thanks bro

    0
  • Comment author
    Yannick Caron

    No problem!

    0

Please sign in to leave a comment.