I am working on a Free Trial landing page for my company, and we want to be able to include Promo Codes that people will receive from different marketing campaigns.
However, I don’t know how to go about this so that if someone enters an incorrect Promo code, we can display a “Not a valid promo code” error message. Likewise, we would need to maintain an up-to-date database of the valid promo codes to allow for a successful form submission.
Has anyone done this before? I assume it can only be done with custom code.
I would love to hear your experience and insights!
hi @sarahmmmiller it is fairly complex task to build with lots of preparations such choosing suitable DB, create DB design (tables, functions, queries etc. to be this system suitable to handle many different cases etc. You will need DB to make it work as IMO CMS is not suitable for such system to build.
Are you just trying to verify the promo code, and then ( if valid ) submit the form normally using Webflow’s form submit?
If so, I’d probably build this as-
Airtable to store the promo codes
Make/Integromat to provide a simple webhook-based API
Client-side JS to call the webhook, process the response, and manage the form UX ( submit, error message, etc. )
There are a lot of other details here, like are the promo codes one-off, or do they have expiry dates, etc. But otherwise, this isn’t hugely complex to build.
check if promo code from input field from client exist
check if promo code has been used
add client to DB and mark code as used
3.1 manage scenarios when client already exist in DB but would like to use promo code from another campaign
3.2 manage scenarios to avoid user use several promo codes for identical campaign
check if promo code is still valid (access period is not over date)
4.1. you need to make a decision on how to manage access_end when the user signs eg. the last day of the campaign etc.
4.2. this should be run every day at noon (considering you have to deal with TZ and DTS if campaigns will be runinin internationally)
You would need to consider proper error handling, data validation, and securing the database to prevent malicious activities. Additionally, you may need to adjust the queries based on the specific database system you are using (e.g., MySQL, PostgreSQL, etc.).
on paper, it looks simple but in reality, it is IMO a bit more complex to make it correctly (security - expenses - speed) than we think.
using Meta or Zappier can become quite expensive depending on how many codes and campaigns you will run at the same time.