How to remove Stripe payment gateway when promo codes make orders free or for free trials?

Hi all, I'm looking to remove the payment gateway on stripe for when a user has a promo code that reduces the cost to $0, or if they are going to be using a free trial. I found a bit about this in the stripe documentation here:
https://docs.stripe.com/payments/checkout/no-cost-orders

someone has also mentioned it here in stack overflow here:
https://stackoverflow.com/questions/69712718/stripe-checkout-session-in-subscription-mode-with-free-trial-and-without-reques

but I'm not sure where I add the code, I did some searching and it looks like it's done server side when getting to the payment gateway, would that be something that I would need to configure in Memberstack?

if so, where and how would I do this?

I tried adding just this to the sign up form but that didn't do it

Thanks!

Comments

7 comments

  • Comment author
    A J

    Hey Charles Bradford, are you trying to offer a free trial for a paid plan in Memberstack and don't want to collect any payment details from the customer at that point? If yes, I believe this guide will help you out in setting it up

    0
  • Comment author
    Charles Bradford

    Thanks AJ - unfortunately you can't create free versions for team plans, so this wouldn't work in my case, that's why I was looking into the Stripe payment checkout api

    I Believe all I need to add is :

    const session = await stripe.checkout.sessions.create({
    ...
    payment_method_collection: 'if_required'
    });

    But unsure exactly where I can do this

    https://www.youtube.com/live/KZAv4qrDZrA?si=HbuQPyYZHWZctxDA&t=1442
    Here's a live demo from Stripe, they go through what's needed for this in the backend.

    0
  • Comment author
    A J

    Ahh Charles Bradford, got it. This does sound like an interesting use-case, I did explore Stripe API and if its possible to achieve this use-case via adding the relevant parameters to the following code shared in the developer docs:

    // Initiate a Stripe Checkout session
    const response = await memberstack.purchasePlansWithCheckout({
    priceId: "PRICE_ID", // The ID of the price to purchase
    // Optional parameters:
    couponId: "COUPON_CODE",
    });

    if (!response.data.url) {
    // Handle case where autoRedirect is false
    console.log("Checkout session created:", response.data);
    }

    return response;

    While applying the 100% off coupon code won't ask for payment details for one-time plans, recurring plans don't seem to consider the payment_method_collection parameter via Memberstack. I tested if its possible via Stripe API directly and it works accurately via the Stripe API console.

    Duncan Hamra, is there any way via which we can enable this via memberstack DOM package functions as well?

    0
  • Comment author
    Charles Bradford

    thanks A J the reason I was looking into this is that I was considering selling on AppSumo for my team plans, but a requirement for AppSumo is that on sign up, is that we don't ask for card details

    so my next question is - is there a way to add promo codes to the memberstack sign up form that pass through to the stripe gateway - so that in the case that the promo code makes the monthy cost is 0 - don't ask for any card details.

    I'm aware that this is a bit more technical so fair enough if that's out of scope

    0
  • Comment author
    A J

    Yes I understand Charles Bradford, while it is possible to apply a coupon code automatically on checkout, the blocker I am seeing here is, currently if its a recurring subscription, even if the due amount is $0, it still asks for card details. If its a one-time plan with 100% off, the checkout won't ask for card details and just will have the pre-filled email and will allow the user to checkout.

    So I am waiting for Memberstack team to chime in, to see if they have any provision already or plan to include this feature for recurring plans (including team accounts), if we state that only collect the payment method, if its required based on the amount due or if there is any plan to implement this wishlist in the near future. 🤔

    That being said, if you have the bandwidth to custom implement your use-case, you could setup your own database to manage team accounts and not enable paid team accounts via Memberstack if that makes sense. So you could have free plans setup on memberstack and have a custom flow setup to enable admins invite other members on the free plan and have to manage their access level etc. That way there is no requirement to have them go through the checkout if you don't intend to have the team pay for that specific plan.

    0
  • Comment author
    Charles Bradford

    I think I understand what you're saying - but it sounds like a work around to avoid using Memberstack team plans, and have the admin pay with team members joining their team as default / non paid plans - is that correct? I've kind of build my backend around the team ID, and adding that to every team member as a column in my database as that seemed appropriate with how memberstack works. I'd be happy to have a call and go through what I set up if you're interested.

    anyway, I'm not using the Memberstack default plan, because my free plan allows 5 users with a monthly cost of £0 ( Duncan has asked how I've done this, I don't think it's normally an option with single user plans, but as team plans are a new feature, it seems to be possible).

    I've had about 30 people sign up, and then abandon checkout, I assume because they were asked for card details even though it's a free tier plan, so I think if we could include the "payment_method_collection" = "if-required" that would help me get free users that I could convert into paid later, but also help with selling on Appsumo.

    I also think that adding this option would help with other peoples projects who have trials - without having to add all the custom code that you referenced earlier in the thread. just as an additional win for memberstack - these days everyone wants more no-code solutions, even if the code solution is copy paste 😂

    A J I just realised you're a expert and you don't work for memberstack.

    thought it might be worth adding this bit of infoSince launching I've had over 100 sign ups who all stop at the payment screen and don't join the free plan as it asks for card details, so there could be 10x more people using the free version that would have potentially become paid users eventually if they had got access to the free version and wanted to grow their subscription.

    Duncan Hamra any chance the team could look into the above? 

    0
  • Comment author
    Duncan from Memberstack

    Adding all of this to our notes for when we revisit team plans 👍 And we are working on a few major backend changes that could make features like this  "payment_method_collection" = "if-required" easier to implement. TBD... 

    0

Please sign in to leave a comment.