In addition to the JavaScript Buy Button API, Freemius also supports hosted checkouts. Hosted checkouts are simple links to the Checkout that you can share anywhere, including:
- Your own website
- Social media platforms
- Emails and in-app notifications
Here is an example.
Generating Checkout Links
Start by going to the Plans page and clicking the Get Checkout button. From there, you’ll find several links depending on how you’ve configured your plan.
You can also set different pricings inside an individual plan page. If you want a link to a specific pricing option, click the Checkout Link button next to that pricing.
Hosted Checkout URL Schema
If you want to programmatically generate Checkout URLs for your product, here is the URL schema
https://checkout.freemius.com/product/{product_id}/plan/{plan_id}/[licenses/{number|'unlimited'}/[currency/{'usd'|'eur'|'gbp'}]]
Given your product ID is 1234
and plan ID is 5678
, here are some valid examples:
- https://checkout.freemius.com/product/1234/plan/5678/ – Pre-select the single license pricing.
- https://checkout.freemius.com/product/1234/plan/5678/licenses/10/ – Preselect the 10 licenses pricing.
- https://checkout.freemius.com/product/1234/plan/5678/currency/eur/ – Preselect the EUR pricing of single license.
- https://checkout.freemius.com/product/1234/plan/5678/licenses/10/currency/eur/ – Preselect the EUR pricing of 10 licenses.
Additionally every configuration you see in the Buy Button API can be passed as URL query parameters. For example:
https://checkout.freemius.com/product/1234/plan/5678/?title=Awesome%20Product
Please do make sure to url-encode the parameter values.
Configuring the Back Button
A back button can be shown to a hosted Checkout. Here’s how it works:
- If a valid
cancel_url=...
is set in the URL query parameters, Checkout will use that URL. - If the above is not present but there’s a valid HTTP referrer, it will be used.
- If neither of the above is available and you’ve set a Website / Marketing Page URL under your product settings, that URL will be used instead.
The button’s icon is generated automatically from the favicon of the website. However, you can customize it by passing a valid image URL using the cancel_icon
parameter.
Here’s an example of a Checkout URL with both parameters:
https://checkout.freemius.com/product/{product_id}/plan/{plan_id}/?cancel_url=https%3A%2F%2Fexample.com&cancel_icon=https%3A%2F%2Fexample.com%2Flogo.png
Redirection After a Successful Purchase
For SaaS products only, you can configure a redirection URL after a successful purchase. This setting is available in the Developer Dashboard.
Go to Plans → Customization and enable the Redirect Checkout to a custom URL toggle. Then, enter a valid HTTPS URL in the input field.
After a successful purchase (including license or payment method updates), buyers will be redirected to the specified URL. The following purchase data will be appended as query parameters:
user_id
– ID of the buyerplan_id
– ID of the purchased planemail
– Buyer’s email addresssubscription_id
– ID of the subscription (not present for one-off purchases)billing_cycle
– Subscription billing frequency (not present for one-off purchases)payment_id
– ID of the one-time payment (only for one-off purchases)license_id
– ID of the associated licenseexpiration
– License expiration date (not present for one-off purchases)quota
– Quota associated with the license
Verifying the Data
When redirecting to the success URL, Freemius Checkout appends a signature
query parameter that allows you to verify the authenticity of the request. Here’s how:
const FS_PRODUCT_SECRET_KEY = 'sk_productSecretKey'; // Get the current absolute URL $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http"; $host = $_SERVER['HTTP_HOST']; $current_url = $protocol . "://" . $host . $_SERVER['REQUEST_URI']; // Remove the "&signature=..." part using string slicing $signature_pos = strpos($current_url, '&signature='); $clean_url = substr($current_url, 0, $signature_pos); // Calculate the HMAC hash $calculated_signature = hash_hmac('sha256', $clean_url, FS_PRODUCT_SECRET_KEY); // Compare the calculated signature with the provided one $signature = $_GET['signature'] ?? null; if ($signature && hash_equals($calculated_signature, $signature)) { echo "✅ Signature is valid."; } else { echo "❌ Invalid signature."; }
Verification algorithm:
- Take the full absolute URL.
- Remove the
&signature=...
from the end of the URL. - Calculate the SHA-256 hash of the resulting string.
- Compare it with the value of the signature parameter.
Please make sure the URL you enter does not redirect in your server. Otherwise the signature validation will fail following the algorithm. Also if you want to redirect to the root of the server, kindly add a
/
, for examplehttps://example.com/
, as browsers will do that when URL parameters are added.
Next Steps
You’re now ready to start sharing your hosted checkout links!
To go further:
* Learn how to customize the Checkout style to match with your brand
* Integrate the JavaScript Buy Button for an embedded purchase flow
* Explore Webhooks for post-purchase automation
If you run into any issues or have questions, don’t hesitate to contact our support by clicking the Help button on the bottom right of the screen.