🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Keygen Premium Add-on Setup Guide

Updated 6 min read Gravity Forms Integrations A–Z
On this page
  1. Video walkthrough
  2. What you need
  3. Get your Keygen account id and token
  4. The settings page
  5. Add a feed to a form
  6. Licence metadata
  7. Create a user (optional)
  8. Conditions
  9. The licence key and merge tags
  10. What is stored, and privacy
  11. When something goes wrong
  12. Safe to retry
  13. A typical setup

Video walkthrough

Gravity Forms Keygen Add-On Setup Guide: Issue Software Licences from Entries (WordPress Side)
Video setup guide: Gravity Forms Keygen Watch on YouTube

The Gravity Forms Keygen Premium Add-on turns each form submission into a Keygen software licence. It issues the licence under the policy you choose, stores any metadata you map from your form fields, and can optionally create a Keygen user and attach the licence to them. This guide walks through connecting your Keygen account, choosing a policy, adding a feed to a form, and understanding exactly what the add-on sends and stores.

What you need

You need Gravity Forms 2.9 or newer, a WordPress site running PHP 7.4 or newer, and a Keygen account. Keygen is a software-licensing API: you define policies (how a licence behaves — expiry, machines, the key scheme) and your forms issue licences under those policies. You will need three things from Keygen: your account id, an admin or product API token, and the id of at least one policy. The add-on works with hosted Keygen at api.keygen.sh or with a self-hosted Keygen instance at your own base URL.

Get your Keygen account id and token

In Keygen, your account id is shown in your dashboard URL and in the API base path /v1/accounts/{account}. Generate an admin or product API token from the Tokens area of your account. Treat the token like a password: you paste it into the add-on once, and from then on it is stored encrypted on your own site. While you are there, copy the id of the policy you want to issue licences under; you can set it as the default and override it per feed.

The settings page

In WordPress go to Forms → Settings → Keygen, activate your GravityExtra license key, then enter your Keygen account id and paste your API token into the token field. The token field is a password field, the token is encrypted before it reaches the database, and it is never shown again in clear. Enter a default policy id so feeds can issue licences without repeating it. Leave the self-hosted base URL blank to use hosted Keygen (api.keygen.sh), or enter your instance’s base URL if you run Keygen yourself. Use the Test connection button to confirm your account id and token work together: it reads your Keygen policies and reports success, without issuing a licence or creating anything.

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

If your site cannot encrypt secrets (the PHP openssl extension is missing), the add-on tells you, and you can instead define the token with the GFKGN_API_KEY constant in wp-config.php (and the account with GFKGN_ACCOUNT, the base URL with GFKGN_BASE_URL). When that constant is set, the token field is replaced with a short note and nothing is stored in the database.

Add a feed to a form

Open a form, go to Settings → Keygen, and add a feed. Give the feed a name so you can recognise it later, and set the policy id — the Keygen policy the licence is issued under. Leave it blank to use the default policy from the settings. The policy field accepts merge tags, so a form field can even choose the policy, for example to issue a trial or a full licence based on what the person selected.

The Keygen feed in Gravity Forms: the policy id, licence metadata mapping and the optional user fields
A feed chooses the policy, maps licence metadata, and can create a user.

Every value field accepts merge tags, so you pull data straight from the submission, for example an order id from a field with {Order id:3} or an email with {Email:2}.

Licence metadata

You can store up to three metadata values on each licence. Give the metadata name and map its value from a form field. Metadata is handy for keeping the buyer email, an order id, a plan name or a campaign with the licence, so you can find and filter licences in Keygen later. Metadata is optional; a licence can be issued with none.

Create a user (optional)

Turn on Create a user to create a Keygen user from the submission and attach the licence to them. Map the user’s email (required), and optionally a first and last name. When this is on, the add-on first creates the user, then issues the licence attached to that user, so the licence is owned by a real Keygen user rather than being unassigned. Leave it off to issue an unassigned licence that you can attach to a user later.

Conditions

A conditional-logic rule at the bottom of the feed lets you issue a licence only when a rule is met, for example only when a payment field marks the order as paid, or only for a certain plan. You can also run several feeds on one form — for instance one feed that issues a trial licence for everyone and another that issues a full licence only when a condition is met. Each feed is evaluated on its own.

The licence key and merge tags

When a licence is issued, Keygen returns the licence key and a licence id. The add-on stores both with the entry and makes them available as merge tags: {keygen_license_key}, {keygen_license_id} and {keygen_status}. The most common use is to email the buyer their key: add a notification to the form and put {keygen_license_key} in the message, so the person receives a working licence the moment they submit. For privacy, the issued key is shown only masked in the entry notes (the last four characters, like XXXX-XXXX-XXXX-AB12); the full key lives only in the entry meta that backs the merge tag.

A front-end Gravity Form whose submission issues a Keygen software licence
The form the visitor fills in; the licence is issued the moment they submit.

What is stored, and privacy

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 add-on only ever contacts the Keygen API at the base URL you set — hosted api.keygen.sh or your self-hosted host — and nothing else. 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 issued licence key is stored with the entry so the merge tag works, but it is only ever shown masked in the entry notes.

When something goes wrong

If a submission is missing what a licence needs — no policy id anywhere, or Create a user is on but there is no email — the add-on leaves a clear note on the entry and issues nothing, so an incomplete submission never produces a broken licence. If Keygen returns an error, the add-on records a readable note (with the token and key stripped out) and sends the failed-event notification, while the form submission itself still succeeds for the visitor.

A Gravity Forms entry screen showing the Keygen note with the issued licence key masked
The entry screen records a note with the issued licence key masked to its last four characters.

Safe to retry

The add-on is safe to retry. A licence is issued once per entry and feed: a built-in done marker and a short-lived lock mean that resending a notification, a retry, or a double submission never mints a second licence. If a first attempt failed because Keygen was briefly unavailable, resending the feed after the problem is fixed issues the licence exactly once.

A typical setup

A common setup is a purchase or sign-up form with the buyer’s name, email and order id. Map the email to the user (with Create a user on) and the order id to a metadata value, set the policy to your product’s policy, and add a notification that emails the buyer their {keygen_license_key}. From then on, every completed form issues a licence under that policy, attaches it to a Keygen user, keeps the order id with the licence, and sends the buyer their key automatically — with your token kept encrypted and the key kept masked in your records.

Still need help?

Our support team answers tickets every day, usually within a few hours.

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