Hise with Gumroad licensing system
-
Hi all, I scripted this License-Test in my Plugin and it works fine:
// ------------------------- // GUMROAD / TEST LICENSING // ------------------------- const var LicenseField = Content.getComponent("Label7"); const var ActivateButton = Content.getComponent("Button2"); const var Keyboard = Content.getComponent("FloatingTile1"); const var LockOverlay = Content.getComponent("Panel2"); // Overlay-Panel var pluginUnlocked = false; // -------- Plugin beim Start SPERREN -------- pluginUnlocked = false; // Overlay aktiv → blockt alle Klicks LockOverlay.set("visible", true); LockOverlay.set("enabled", true); // Keyboard zusätzlich sperren Keyboard.set("enabled", false); // Aktivierungs-UI aktiv lassen LicenseField.set("enabled", true); ActivateButton.set("enabled", true); // ---------------- Button: Aktivieren ---------------- inline function onActivateButton(c, v) { if (!v) return; local key = LicenseField.get("text"); if (key == "") return; local TEST_KEY = "TEST-1234"; if (key == TEST_KEY) { Console.print("Local test activation OK"); pluginUnlocked = true; // Overlay weg → Plugin wieder benutzbar LockOverlay.set("visible", false); LockOverlay.set("enabled", false); // Keyboard wieder freigeben Keyboard.set("enabled", true); // --- ALLE Controls wieder aktiv --- Category.set("enabled", true); Variant.set("enabled", true); Attack.set("enabled", true); Hold.set("enabled", true); Decay.set("enabled", true); Sustain.set("enabled", true); Release.set("enabled", true); SaveButton.set("enabled", true); // Lizenz-UI verstecken ActivateButton.set("visible", false); LicenseField.set("visible", false); return; } Console.print("Wrong key"); } ActivateButton.setControlCallback(onActivateButton);Now I want to implement the auto-licensesystem from gumroad. Can someone help me to set up the right script for this? Gumroad License:
https://gumroad.com/help/article/76-license-keys
I would be very grateful if someone could help me with this. I want the buyer to have to activate the software only once. After that, no further activation should be required. The license should allow the user to cover 1-3 devices, and it must work on both Windows and Mac. Thank you in advance. Best regards.
-
@Avián You should use Server.callWithPOST
https://docs.hise.audio/scripting/scripting-api/server/index.html#callwithpostsomething like this based on what I read from the docs of gumroad (i'm not using gumroad, so I don't know if it works)
Server.setBaseURL("https://api.gumroad.com"); const var params = { "product_id": "1234", "license_key": "your_license_key", "increment_uses_count": "true" }; Server.callWithPOST("v2/licenses/verify", params, function(status, response) { if(status == Server.StatusOK) { if(response.success) { Console.print("License valid"); Console.print("Uses: " + response.uses); Console.print("Product: " + response.purchase.product_name); } else { Console.print("License invalid"); } } else { Console.print("HTTP error: " + status); } });