I know Knack doesn't support Subscriptions through Stripe. Is there a way to work around this? Right now, a user can buy a subscription to my Knack database via my Stripe checkout page. When their purchase goes through successfully with Stripe, they are shown a URL that lets them setup a Knack membership. My memberships are recurring with 6 month or 12 month terms. I would like Knack to change the User Status from "active" to "inactive" after the membership term has expired unless the proper payment is received from Stipe. If a user buys a 6 month membership, then can I set the "Timer" field to "180 days" when the Timer gets to 0, can I change the User Status to "Inactive" and show a message that says, "To continue, please insert coins"?
We're tracking this feature request here: https://support.knack.com/hc/en-us/community/posts/115000718312-Recurring-Payments-
Please add any feedback / requests in that thread. Thanks!
As we ramp up our development for subscriptions, we'd love to hear about your subscription use cases to better align our features with your needs. If you're planning on using subscriptions in your Knack app we would appreciate it if you could fill out this short survey: https://www.knack.com/knackstars#subscriptions-survey/
And if you haven't done so yet, sign up for the Knackstars program so you can join the beta when it's ready: https://www.knack.com/knackstars#register/
I have the same issue, but I want to do a 30-day free trial and then charge them if they don't cancel. The short answer is there isnt' a way around it...yet.
I noticed last week when I was building a form, on the Option section where you enable ecommerce, it said "Create customer to charge later". I reached out to Knack Support asking what this meant (other than the obvious), because I'd never seen it before. They said, "Yeah it's something that's in beta at the moment. Should release by next week. It integrates with Stripe Customers..so you don't store the cc info in Knack.. it's stored in your Stripe account. You can use those stored details to make a payment, or even charge a customer on their behalf."
Sounds like what we need!
@Nic Curious to know if adding subscriptions to e-commerce has been abandoned or is just not-yet. We have requests to add autorenewals to our annual membership renewal process and would like to implement that in the next month.
Currently only see that Stripe has added their own subscription functionality and could move those members over to Stripe and out of Knack e-commerce.
Searching on subscription
in the KB or here in the Community Forum turn up just this one old-ish post. Thanks in advance for any news or ideas for workarounds!
Jenna Dixon
hello@istvs.org
@ISTVS Hi Jenna,
I implemented Stripe subscriptions in a Knack app.
Here’s how to do it.
(Note: This requires custom JavaScript on the frontend and backend, so you’ll need to be comfortable coding—if not I’d be happy to assist you with that.)
The steps are:
- Create a Stripe Customer for each Knack account. You can do this manually by logging in to your Stripe account on the Stripe website and creating the customer. Or you can automate this by triggering an Integromat scenario when the Knack acccount is created, and making an HTTP request to the Create Stripe Customer endpoint. Then save the Stripe Customer ID as a field in the Knack account.
- Create an endpoint on your backend (see code here). Let’s name this endpoint Create Portal Session. This endpoint receives a Stripe Customer ID and a return URL, then creates a Portal Session, then returns that Portal Session URL to the frontend.
- Create a button to Manage Subscription. For example, add this to your frontend html:
<button id="manage-subscription" class="kn-button">Manage Subscription</button>
- In your frontend JS, call your endpoint when the user clicks the Manage Subscription button. The code looks like this:
$('button#manage-subscription').on('click', async () => {
$('button#manage-subscription').addClass('is-loading')
const returnUrl = encodeURIComponent(location.href)
const stripeCustomerId = Knack.getUserAttributes().values.field_123;
const url = `https://example.com/.netlify/functions/create-portal-session?return_url=${returnUrl}&stripe_customer_id=${stripeCustomerId}`;
const data = await callEndpoint(url);
window.location.href = data.portalSession.url;
})
Now your customers will be able to manage their subscriptions, add/remove payment methods, and see their payments history.
Finally, to allow your customers to purchase the subscription, the steps are almost identical. You would follow steps 2-4 again, except you create a Checkout Session instead of a Portal Session, and you create a buy-subscription
button instead of manage-subscription
button. (Basically, Stripe uses two separate interfaces for buying the subscription and managing it). Checkout Sessions are very similar to Portal Sessions but have slightly different parameters, as seen in the Stripe API docs.
Hope this helps! If not, feel free to reach out.
Ian
Knack Pros