🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!
Guides & Tutorials October 28, 2026

How to Issue Keygen Software Licences from Gravity Forms Submissions

GravityExtra
How to Issue Keygen Software Licences from Gravity Forms Submissions

If you sell or distribute software, there is a moment that matters more than almost any other: the instant someone buys, signs up, or asks for a trial. That is when they want their licence key — and if they have to wait for you to create one by hand, the experience stalls right where it should feel instant. If you run your licensing in Keygen, that key should be minted automatically the moment a Gravity Form is submitted. The Gravity Forms Keygen Premium Add-on does exactly that: every submission issues a Keygen software licence under the policy you choose, with the metadata you map, optionally attached to a Keygen user — no manual steps, no delay.

Why connect Gravity Forms to Keygen

Keygen is a software-licensing and distribution API. You define policies — the rules a licence follows, such as how long it lasts, how many machines it allows, and how the key is generated — and you issue licences under those policies. The hard part is not Keygen itself; it is wiring the right trigger to it. For a huge number of software businesses, that trigger is a form: a purchase, a sign-up, a trial request, a beta invite, an upgrade. This add-on connects the two, so the licence is created and the key returned the instant the form is submitted, straight from your own site, with your own Keygen account.

What the add-on does

On each submission, the add-on issues a licence under a Keygen policy. You choose the policy per feed, or set a default policy once and let every feed use it. You can store up to three metadata values on the licence — a buyer email, an order id, a plan name, a campaign — each mapped from a form field with a merge tag. And you can optionally create a Keygen user from the submission and attach the licence to them, so the licence belongs to a real user in your Keygen account rather than sitting unassigned. The issued licence key and licence id come back and are kept with the entry, ready to email to the buyer.

A note on your Keygen account

To be clear up front: this add-on connects to Keygen with your own account. You need a Keygen account, an admin or product API token, and at least one policy. It does not include a Keygen subscription and does not work around it. If you already run Keygen, this add-on puts it to work directly from your forms. It also supports both deployment models: hosted Keygen at api.keygen.sh and a self-hosted Keygen instance at your own base URL — the same add-on, pointed wherever your Keygen lives.

What you need before you start

You need Gravity Forms 2.9 or newer, a WordPress site on PHP 7.4 or newer, and a Keygen account. From Keygen you need three values: your account id (shown in your dashboard URL and the API base path /v1/accounts/{account}), an admin or product API token, and the id of the policy you want to issue licences under. The add-on only ever contacts the Keygen API at the base URL you set, and nothing else.

Step 1: get your Keygen account id and token

In Keygen, copy your account id and generate an admin or product API token from the Tokens area. Treat the token like a password: you paste it into the add-on once, and it is stored encrypted on your own site from then on. Note the id of the policy you will issue licences under; you will set it as the default in the next step.

Step 2: connect on the settings page

In WordPress go to Forms → Settings → Keygen, activate your license key, then enter your account id, paste your API token, and set a default policy id. Leave the self-hosted base URL blank for hosted Keygen, or enter your instance’s base URL if you host Keygen yourself. The token field is a password field; the token is encrypted before it is stored and never shown again. Then click Test connection — it reads your Keygen policies to confirm your account id and token work, without issuing a licence.

The Keygen settings page in Gravity Forms: license key, account id, API token, default policy and a Test connection button

Step 3: add a feed and map your fields

Open a form, go to Settings → Keygen, and add a feed. Set the policy id (or leave it blank to use the default), then map your licence metadata from the form fields. If you want the licence owned by a Keygen user, turn on Create a user and map the user’s email. Every value field accepts merge tags, so you pull data straight from the submission — the email from your email field, an order id from a text field, a plan from a drop-down.

The Keygen feed in Gravity Forms: the policy id, licence metadata mapping and the optional user fields

Step 4: deliver the key with a merge tag

When a licence is issued, the key and id come back and are stored with the entry as merge tags: {keygen_license_key}, {keygen_license_id} and {keygen_status}. The usual next step is to email the buyer their key: add a notification to the form and put {keygen_license_key} in the message. The buyer receives a working licence the instant they submit. You can also show the key on the confirmation page, or pass the id to another system, using the same merge tags.

Security: the token and the key

Two secrets deserve care, and the add-on treats both carefully. Your Keygen API token is encrypted on your own site with AES-256-GCM before it is stored, it is never shown again, and it is never written to an entry, a note or a log. The issued licence key is stored with the entry so the merge tag works — but in the entry notes it is always shown masked, with only the last four characters visible (like XXXX-XXXX-XXXX-AB12). Requests go over HTTPS with certificate verification on, a redirect is never followed, and the token travels only in the Authorization header, never in the URL or the request body. The add-on contacts only the Keygen API at the base URL you set.

A Gravity Forms entry screen showing the Keygen note with the issued licence key masked

Conditions and multiple feeds

A conditional-logic rule lets you issue a licence only when it should be: only when a payment field marks the order paid, or only for a chosen plan. Because the policy and the condition are set per feed, one form can issue a trial licence for everyone on one feed and a full licence on another when a condition is met. Each feed is evaluated independently, so the same submission can drive several outcomes.

Safe to retry

Minting a duplicate licence is exactly the kind of mistake you do not want in a licensing flow, so the add-on is built to be safe to retry. A licence is issued once per entry and feed: a done marker and a short-lived lock mean that resending a notification, a retry after a hiccup, or a double submission never creates a second licence. If a first attempt failed because Keygen was briefly unreachable, you can resend the feed after the problem is fixed and the licence is issued exactly once.

Hosted or self-hosted

Whether you use hosted Keygen at api.keygen.sh or run Keygen on your own infrastructure, the add-on works the same way: leave the base URL blank for hosted, or enter your instance’s base URL for self-hosted. The licence flow, the metadata mapping, the user creation and the merge tags are identical — only the host changes.

Get started

If you issue software licences and run them through Keygen, this add-on removes the last manual step between a sale and a working key. Map your form once, point it at a policy, and every submission issues a licence automatically — with your token encrypted, your key masked in your records, and the buyer’s key on its way the moment they submit. The full setup is in the Keygen add-on setup guide. Ready to automate your licensing? Get the Gravity Forms Keygen Premium Add-on and issue your first licence from a form today.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr