πŸ”Basic License Validation

Now that you’ve created a project and issued your first license, it’s time for the real moment: validating that license inside your application.

This single step is what locks down your product, ensures paid users get access, blocks unauthorized copies, delivers injectables, and makes DevPayr… well, DevPayr.

Don’t worry β€” validation is simple. No complex ceremony. No mystical knowledge. Just a single call to the SDK or API, and you're done.

Let’s walk through everything properly.

🧠 How License Validation Works (In Plain English)

Every time your application starts (or on whatever schedule you choose):

  1. Your app sends the license key to DevPayr

  2. DevPayr checks:

    • Is the license valid?

    • Has it expired?

    • Is the domain allowed?

    • Has the usage limit been exceeded?

    • Is the environment correct?

    • Is the project fully paid?

  3. DevPayr responds with:

    • has_paid: true/false

    • injectables (if paid)

    • metadata

    • any restrictions

If everything checks out β†’ the app continues normally. If not β†’ DevPayr triggers your chosen behavior (modal, redirect, log, silent).

That’s the entire magic.

🎯 Two Ways to Validate a License

There are two possible approaches:

1. License Key Only (most common)

Perfect for:

  • Frontend apps

  • Themes/plugins

  • Client dashboards

  • SaaS boot-time checks

  • Templates or installable software

No API key required.

2. License Key + API Key (advanced)

This unlocks:

  • Project management

  • Domain modifications

  • License creation/suspension

  • Payment checks

  • Injectable uploads

  • Admin-like access from your backend

Use this ONLY on a secure backend β€” never in frontend code.

πŸ§ͺ OPTION 1 β€” Validate Using License Key Only

This is the simplest and most common method. Examples below for Node.js, PHP, Python, and Browser (Frontend).

🟦 Node.js Example

🐘 PHP Example

🐍 Python Example

🟨 Frontend Example (Highly Flexible)

The frontend SDK lets you name your config anything you want. DevPayr auto-detects it.

All of the following examples work:

πŸ’‘ Tip: The frontend SDK is intentionally flexible. You can hide it, disguise it, or embed it inside your existing JS. Great for making it harder for non-technical users to β€œedit out” licensing.

πŸ§ͺ OPTION 2 β€” Validate Using License Key + API Key

(Advanced, Backend Only)

When you combine an API key with your license key, DevPayr turns into a full backend client.

You can now:

  • Manage domains

  • List or create licenses

  • Upload injectables

  • Fetch project data

  • Check payment history

  • Access advanced endpoints

πŸ” Node.js Example

πŸ’‘ Tip: Think of the API key as β€œfull DevPayr power mode.” Only use it in secure backend servers.

🌐 Validating via Raw HTTP (cURL)

If you’re not using an SDK (embedded systems, Go, Rust, etc.), you can validate with plain HTTP.

πŸ”‘ Validate Using License Key Only

Endpoint:

Header Example

Body Example

πŸ” Validate Using API Key

Endpoint:

πŸ“„ Example Response

🧭 Summary

Method
Best For
Requires API Key?

License Key Only

Frontend, SaaS runtime checks, themes, plugins

❌ No

License + API Key

Backend systems, dashboards, automation

βœ”οΈ Yes

Raw HTTP

Custom environments, servers without SDKs

Optional

πŸŽ‰ You Just Validated Your First License

At this point:

  • Your project is set up

  • Your license is issued

  • Validation is working

  • Injectables are delivered (if any)

  • DevPayr is officially connected to your app

Last updated