Student pricing, inside your own checkout.
Two lines of HTML. We verify the student, issue a code that belongs to them alone, and fill your discount field with it. There is nothing to build and nothing to store.
<script src="https://theunideals.com/sdk/v1.js" data-key="pk_live_YOURKEY" defer></script>
<div data-tud-widget data-tud-input="#discount-code"></div>
Swap pk_live_YOURKEY for the key we issue you, and #discount-code for the selector of your own discount input.
Try it yourself.
The button below is the real widget, loaded from the real script, wired to a demo shop. Claim a code and watch it land in the discount box.
- Cotton hoodie, size M
- Rs 4,500
- Delivery
- Rs 250
- Total
- Rs 4,750
What your page sees
Every claim fires a tud:code event on the widget element, whether or not you pointed us at an input. This panel is listening to it.
Waiting for tud:code
Nothing here is charged, stored or sent anywhere. The demo shop is ours.
The whole surface.
Four things exist. That is the entire API.
| Name | What it does |
|---|---|
data-tud-widget |
Marks an element as a mount point. We render the button inside it. Put as many on a page as you like. |
data-tud-input |
A CSS selector for your discount input, on the same element as data-tud-widget. When a code arrives we set the value, then fire input and change so React, Vue, Shopify and jQuery listeners all pick it up. Optional. |
tud:code |
A bubbling CustomEvent dispatched on the widget element, with detail: { code, offerId }. Fires on every claim, with or without data-tud-input. |
data-tud-custom |
Bring your own button. We render nothing; the element marked data-tud-trigger inside the widget opens the claim window, so the button inherits your design completely. |
data-tud-apply="shopify" |
Shopify stores only: when the code arrives we route it through your store's discount link, so it attaches to the checkout with no typing. An element with class tud-applied inside the widget is revealed on the way back. |
window.TheUniDeals |
Set to { version: '1' } once the script has loaded. Use it to check the widget is present. |
Doing your own thing with the code
document.addEventListener('tud:code', function (event) {
var code = event.detail.code;
var offerId = event.detail.offerId;
applyDiscount(code); // your own cart call
});
On Shopify, in your own code
The app's theme block is the no-code way in. If you would rather place it yourself, in a custom liquid section or an older theme, paste this anywhere in your templates. The button uses your theme's own button class, the discount applies at checkout automatically, and the small applied message takes the button's place afterwards.
<div data-tud-widget data-tud-custom data-tud-apply="shopify">
<button type="button" class="button" data-tud-trigger>Get the student price</button>
<p class="tud-applied" hidden>Student discount applied at checkout</p>
</div>
<script src="https://theunideals.com/sdk/v1.js" data-key="pk_live_YOURKEY" defer></script>
The event bubbles, so you can listen on the widget, on a container, or on the document.
Why a public key is safe.
Your key sits in your page source, in plain sight. It identifies you. It authorizes nothing.
- Codes only go where you said. You register the exact origins that may receive a code. Our claim window checks that list on our server, on our domain, before it hands anything back. A copy of your key pasted on another site claims nothing.
- Every code has a name on it. A student signs in and passes verification before any code is issued, and every reveal is logged against that account with your shop recorded beside it. If a code turns up on a deals forum, we know whose it was.
- Codes do not multiply. A pooled code binds to the first student who reveals it and never moves. Repeat reveals return that same code, and each account is capped at three reveals per offer and fifteen a day across everything on The Uni Deals.
- Your page stays yours. The script sets no cookies, writes nothing to storage, loads no fonts or stylesheets, and makes no network calls from your page. Sign-in happens on theunideals.com, in a window we serve.
Tell us where the widget goes.
Email us your shop name, the offer you want to run, and the exact origins the button will live on, like https://shop.yourbrand.pk. We issue the key and you are live the same day.