Display Expiration Date in my Dashboard Answered

Post author
Juanca López

Hi! I'm trying to find a way to show display a membership renewal date to my recurring members, like the example image I post. Is there an attribute or a custom code to do this? 

I've seen a code for a one-time-date, but doesn't work in my case.

Comments

4 comments

  • Comment author
    Josh Lopez

    Hey Juanca López

    We do not currently have a data attribute for this but you can upvote this feature request here.

    1
  • Comment author
    Duncan from Memberstack

    Hey Juanca López 👋

    I'm afraid we don't have a way to display this information yet. We have a project in our roadmap to display a member's plan information, but we have not begun yet. 

    1
  • Comment author
    Stefan Lakovic

    Hey, I need to show the expiration date of plan to the member. I saw that that is something on the roadmap. But is there any solution? I found this: https://es.memberstack.com/scripts/set-one-time-date-on-signup

    It is possible to do something similar?
    ChatGPT gave me this code:

    const express = require('express');
    const bodyParser = require('body-parser');
    const app = express();
    const PORT = process.env.PORT || 3000;

    // Configure Stripe
    const stripe = require('stripe')('your_stripe_secret_key');

    // Middleware to parse JSON bodies
    app.use(bodyParser.json());

    // Define webhook endpoint
    app.post('/stripe-webhook', async (req, res) => {
    const sig = req.headers['stripe-signature'];
    let event;

    try {
    event = stripe.webhooks.constructEvent(req.body, sig, 'your_stripe_webhook_secret');
    } catch (err) {
    console.error('Webhook Error:', err.message);
    return res.status(400).send(Webhook Error: ${err.message});
    }

    // Handle the event
    if (event.type === 'payment_intent.succeeded') {
    // Retrieve relevant information from the event
    const paymentIntent = event.data.object;
    const customerId = paymentIntent.customer;

    // Trigger your code here to update Memberstack user with one-time date // You can call a function or directly execute the code here // Make sure to replace this with your actual code // Example: // await updateMemberWithOneTimeDate(customerId); console.log('Payment succeeded:', paymentIntent.id);

    }

    // Return a response to acknowledge receipt of the event
    res.json({ received: true });
    });

    // Start server
    app.listen(PORT, () => {
    console.log(Server is running on port ${PORT});
    });
    0
  • Comment author
    Raquel Lopez

    Uhm, I'm not sure if that script is going to work out for you. Basically chatGPT taught you to set up a backend server in a NodeJS environment, and log the result to the terminal. So unless you're planning to create a custom server I don't think that's the solution for you 😓

    Assuming you already are saving the date in a custom field in memberstack, you could show the date using the data-ms-member="value" value being the id of the custom field in MS in an attribute of a text tag.

    In case you want to show the expiry date of a premium plan, you can use this script as a base. But instead of the plan name, replace it by the expiration date found on the member object

    https://docs.memberstack.com/hc/en-us/community/posts/24415455732251-Displaying-the-members-current-Plan?page=1#community_comment_24415673060891

    0

Please sign in to leave a comment.