How to assign a Memberstack plan to users after purchase with better alternatives to REST API? Answered

Post author
Michał

I need to assing a plan to member after purchase (probably inject some script from order confirmation page). I tried to use rest call to assign specific plan from python's request lib. works fine. but restapi of memberflow is pretty weak. Any ideas?
Edit: webpage in workflow, plans and users in memberstack.

and just fyi, I'm aware of c, cpp and python. not even close to js 😬 and next question - is there any easier and faster way to test potential script rather than publish and go to the certain page?

The thing is I do not need to add any additional plans, but the one that was purchased. Right now, I need to assign it manually to the member in memberstack after I receive confirmation email from memberflow.
 
The scenario is - I'm a newbie to js and DOM package (whatever it is) and i want to experiment putting the code after some section in webflow page settings. Do I need to deploy it and check if the action is really performed, or I can stop it for a while and injecct some code on page. Like a 'debugger'

Comments

3 comments

  • Comment author
    Raquel Lopez

    You can use plan logic to assign (or cancel) an additional plan after a plan purchase.

    Here are the docs for this feature https://docs.memberstack.com/hc/en-us/articles/14084137149339-Plan-Logic

    Do I need to deploy it and check if the action is really performed, or I can stop it for a while and injecct some code on page. Like a 'debugger'
    That's a Webflow limitation. You always need to publish the site to see the latest changes. You could use your browser devtools to assign any piece of code to the page. The changes will only be applied locally to you and when you refresh, the changes would be reseted. Here's an example https://youtu.be/ueozQ9Hagbc?si=I6islvnXslAVVc8h
     
    The thing is I do not need to add any additional plans, but the one that was purchased.
    What are you using to purchase the plan? Memberstack allows you to create premium plan where users go to checkout natively integrated with Stripe and after a successful payment the plan would get assigned to the user. Plan managment comes out of the box, if the user stops payment the plan would get automatically cancelled. You wouldn't need to use any additional library or custom code for that.
     
    If you know programming, and want to use a different payment method to handle plan management, assuming you have a live backend server like you said with Python, you could hit a REST endpoint to assign a FREE plan to a user. Here's the curl example.
     
    curl --location --request POST
    'https://admin.memberstack.com/members/mem_abc123/add-plan' \
    --header 'x-api-key: sk_sb_your_secret_key' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "planId": "pln_free123"
    }'
     
    Dev documentation for plan management can be read here https://developers.memberstack.com/admin-rest-api/member-actions#plan-management
     
    Heres a workable example of how to setup paid plans it with just Memberstack. No additional code needed https://www.youtube.com/watch?v=51hxXnctZ_0
     
    You have mentioned Memberflow, could you link that technology or explain how are you integrating it with Webflow + Memberstack to get some context and better orient you? 🤔
    0
  • Comment author
    Michał

    Oh, sorry Raquel Lopez - obviously its Webflow + Memberstack. I've Stripe integrated with Webflow. When I'll integrate it with Membestack as well, the transaction fee will double. how to solve this?

    0
  • Comment author
    Raquel Lopez

    Memberstack has a transaction fee for all your member's payment transactions depending on the plan and the frequency you choose to pay. If they are charging you something different than what you agreed when subscribing I'd would suggest you to create a support ticket so the Support team can evaluate it and fix it on their end

    0

Please sign in to leave a comment.