Every item sold here comes with a purchase code. Your shipped script exchanges it for a
signed token and enforces the licence itself. Call the API directly from any language,
or drop in the PHP SDK and let it do the work.
Base URLhttps://ourcodemarket.com/api/v1Format JSONAuth API key header
Activate. The script sends the purchase code and its domain. We return a signed token holding what the licence grants.
Verify. On the interval you set, the script re-checks and a fresh token comes back.
Enforce. The token is signed with our private key and verified inside your script against the public key, so a normal check needs no network call at all.
Why the token matters. Because it is verified offline, a buyer whose server briefly
loses connectivity keeps working. Only a revoked licence, or one past its grace window, stops.
Authentication
Two kinds of key, from your dashboard. They are not interchangeable.
PUB
Publishable dmz_pk_…
Safe to ship inside the script you sell. It only identifies you, and can do nothing beyond activating and verifying licences.
SEC
Secret dmz_sk_…
For calls from your own server. It can read your sales and revoke licences, so it must never appear in distributed code.
Send the key in a header, never in the query string. Keys in URLs end up in server logs and browser history.
Either header works
X-Domzivo-Key: dmz_pk_your_key
# or
Authorization: Bearer dmz_pk_your_key
Quick start
Ship domzivo-license.php alongside your script and add this to your entry file:
PHP
<?php
require __DIR__ . '/domzivo-license.php';
$license = new DomzivoLicense(
'dmz_pk_YOUR_PUBLISHABLE_KEY', // Dashboard > API keys. Same for everything you sell.
'YOUR_ITEM_ID' // The item's own page. Different for each item.
);
// Shows an activation screen if the buyer has not entered their code yet,
// and stops the script if the licence is not valid.
$license->guard();
echo "Licensed and running.";
Both values are required. Your publishable key says who you are; the item id says which of your items this is. Without the item id, a buyer of your cheapest item could use that code to unlock your most expensive one, because a single key covers everything you sell. Copy the id from the Licensing panel on the item's page rather than typing it: one wrong character and no buyer can activate.
Where the item id comes from
The id belongs to the item, so the item has to exist before there is an id to copy. That
catches people out, because the id then has to go inside the zip you upload to
that same item. Do it in this order and it is straightforward:
Create the item and save it as a draft. A draft needs only a title, so this takes a moment. You do not need the description, price, screenshots or the zip yet.
Open the Licensing panel on that item in your dashboard and press Copy. The id looks like 7c3f21a8-4d55-4e0b-9a1e-2f77b0c9d431.
Paste it into your script as the second argument, next to your publishable key.
Zip your script with the id already in it and upload that zip to the same item.
Finish the listing and submit for review.
The id never changes. Paste it once and it keeps working through every version you
release, so an update does not mean touching it again. A different item gets a different
id, so do not carry one across when you duplicate a listing: a code bought for one item
will not activate another, which is the whole point of it.
To switch features on or off by tier, read what the licence grants:
PHP
$status = $license->check();
if (!empty($status['features']['branding_removal'])) {
hide_footer_credit(); // Extended buyers can white-label it.
}
Writing in something other than PHP? Every endpoint below is plain HTTP and JSON, so any language can integrate. The SDK is a convenience, not a requirement.
Errors & limits
Errors come back with the matching HTTP status and a readable message. The licensing endpoints are rate limited per IP.
Code
Meaning
400
Something in the request body is missing or malformed. Activation also returns this as product_required when the request does not say which item it is for.
401
The API key is missing, wrong, or revoked.
403
The licence is revoked or refunded, the key is the wrong kind for this endpoint, or the purchase code belongs to a different item (wrong_product).
404
No such purchase code.
409
Every domain slot on the licence is already in use.
429
Too many requests. Back off and retry.
Licensing API
Authenticated with your publishable key. These are the calls your shipped script makes.
POST/licenses/activate
Redeems a purchase code for a domain and returns a signed token.
A domain that was never activated answers 200 with valid: false and status not_activated, so your script can show the activation screen rather than crash.
product_id is optional here but checked when you send it, so a code moved to a different item is caught on the next check-in. The SDK always sends it.
POST/licenses/deactivate
Releases the domain slot so the buyer can install elsewhere.
Revokes a licence. The buyer keeps working until their grace window closes.
GET/vendor-api/sales
Your sales, with the commission split on every line.
Statuses
Status
Meaning
Should the script run?
active
Everything is in order.
Yes
not_activated
This domain has no activation yet.
No, show the activation screen
not_found
The purchase code does not exist.
No
suspended
Temporarily paused by you or an admin.
Until grace ends
revoked
Pulled, usually a refund or abuse.
Until grace ends
refunded
The buyer got their money back.
No
invalid_token
The token was tampered with or has expired.
No, re-activate
Offline & grace
Two values you set per product, on the item form in your dashboard:
Check-in interval is how often the script revalidates. Between check-ins it verifies the token offline, with no network call.
Offline grace is how long it keeps working when our API is unreachable, and how long a buyer keeps working after a licence is revoked.
Sensible defaults are a 48 hour interval with 10 days of grace. A short grace window is harsher on buyers with flaky hosting; a long one delays enforcement after a refund.
PHP SDK methods
Method
What it does
activate($code, $domain)
Redeems a purchase code and caches the token.
check()
Returns the current status, re-validating over the network only when the token is due.
isValid()
A plain boolean, for your own branching.
guard()
Activation screen plus enforcement, in one line.
deactivate()
Frees the domain slot so the buyer can move the script.
Ready to sell?
Create your keys, upload your item, and the licensing is handled for you.