| title | Write a plugin |
|---|---|
| description | Write a Hostpanel plugin as a .NET class library on the SDK: payment and provisioning plugins, the plugin.json manifest, packaging and tests. |
| keywords | write plugin, hostpanel sdk, payment plugin, provisioning plugin, plugin manifest |
A plugin is a .NET class library that references the Hostpanel SDK and adds a payment gateway, a provisioning module, a domain registrar or another capability. The plugin never references the Hostpanel host directly, only the SDK.
The SDK project lives at backend/src/Hostpanel.Sdk in the repository. Reference it from your class library, or reference the built Hostpanel.Sdk.dll directly. This guide is written for Hostpanel.Sdk 3.16.0, the version this release ships. Build against a 3.x version that is not newer than the host's: a package built against an older SDK major is refused with PLUGIN_SDK_ASSEMBLY_OUTDATED, and one whose sdkPackageVersion is newer than the SDK the host ships is refused with PLUGIN_SDK_NEWER_THAN_HOST. The SDK repository also publishes a second package, Hostpanel.Sdk.Packaging, versioned in step with the SDK (3.16.0). It holds the checks the host runs on a package, so you can run them on your own build before you upload it: the signature format and verification, the plugin id and version rules, reserved assembly names, the archive limits and path checks, the icon check and the structural manifest rules. Reference it from your build or release tooling only, never from the plugin assembly itself. The plugins published in the plugin marketplace, each in its own hostpanel-<name> repository, are reference implementations; read their code before writing your own.
Name a plugin project <Company>.Hostpanel.Plugins.<Name>, the .NET plugin convention <Company>.<Product>.<Type>.<Name> (as in Serilog.Sinks.Console). The project, its folder, its assembly and its root namespace all carry that name, and its test project adds .Tests. Innovayse's own plugins are Innovayse.Hostpanel.Plugins.<Name>, with tests in Innovayse.Hostpanel.Plugins.<Name>.Tests, each in its own repository named hostpanel-<name>.
The plugin id in plugin.json is not part of the name and never changes when a project is renamed: the host keys the plugin's stored settings and data by it.
The PluginType enum defines what a plugin can be:
| Type | Value | Covered in this guide |
|---|---|---|
Provisioning |
0 | Yes: see below |
Payment |
1 | Yes: see below |
Registrar |
2 | Yes: see "Registrar plugins" |
Identity |
3 | Listed only |
Fulfilment |
4 | Listed only |
Hosted |
5 | Listed only |
App |
6 | Listed only |
Inherit PaymentGatewayBase and implement IPaymentPlugin from Hostpanel.Sdk.Plugins.Payment.
| Member | Description |
|---|---|
string CurrencyCode |
ISO 4217 numeric currency code this gateway settles in (e.g. "840" for USD, "051" for AMD) |
Task<PaymentSession> CreatePaymentAsync(PaymentInstruction instruction, CancellationToken ct) |
Start a payment session and return a redirect URL |
Task<GatewayPaymentStatus> GetStatusAsync(string gatewayOrderId, CancellationToken ct) |
Poll the gateway for the current state |
Task<string> RefundAsync(string gatewayOrderId, long amountMinor, CancellationToken ct) |
Issue a refund; return the gateway's refund reference |
PaymentInstruction properties: OrderNumber, AmountMinor, ReturnUrl, Description, Language, SavePaymentMethod (SDK 3.5.0 or later, false by default).
PaymentSession properties: GatewayOrderId, RedirectUrl, FormPost and Kind (PaymentSessionKind; SDK 3.7.0 or later, Redirect by default). See Choosing the session kind.
GatewayPaymentStatus properties: State (GatewayPaymentState), TransactionId, RawStatus, AmountMinor, Currency (ISO 4217 numeric), SavedMethod (SDK 3.5.0 or later, null by default).
AcceptsCurrency(string currencyNumeric) has a default implementation that compares against CurrencyCode; override it only when the gateway accepts currencies other than its settlement currency.
GatewayPaymentState enum: Pending (0), Paid (1), Declined (2).
CreatePaymentAsync answers a PaymentSession, and a session is exactly one PaymentSessionKind (SDK 3.7.0 or later for the form post and the browser step):
| Kind | When | What the plugin fills | What the host does |
|---|---|---|---|
Redirect |
the gateway has a hosted page opened with a plain GET (the default) | RedirectUrl |
sends the payer to the address; reads the status when the payer comes back |
FormPost |
the hosted page is opened with a POST that carries a token or other fields | FormPost (action and fields) |
renders the form and submits it for the payer |
BrowserStep |
the payer finishes a step in the browser (a card field that produces a nonce) before the payment can be charged | RedirectUrl (the page of the step) and Kind |
sends the payer to the page, waits for the return request, hands its parameters to the plugin and only then reads the status |
Choose the redirect whenever the gateway offers one. For a form post the plugin only describes the form: the host applies the rules of PaymentFormPost and PaymentFormPostLimits (an absolute https action without user info or line breaks, at most 64 fields, names up to 128 and values up to 8192 characters, an action up to 2048), builds the form with names and values as properties, never as markup, and submits it. A form that breaks a rule is a failed payment: nothing is stored on the invoice and, when the plugin implements IPaymentCancelPlugin, the order it just registered is cancelled.
A plugin that answers BrowserStep, or that needs a value only the payer's browser has when it comes back (a payer id in the return address), implements IPaymentReturnPlugin beside IPaymentPlugin and lists paymentReturn in capabilities. A BrowserStep session from a plugin without the interface is a failed payment.
The payer returns to the panel's result page, which posts the other query parameters of the return request to the host. The host then calls CompleteAsync(gatewayOrderId, returnParameters, ct) and, after it, GetStatusAsync; the status decides what the payer is told, never the value CompleteAsync answered. The host chooses which names reach the plugin and keeps within PaymentReturnLimits: names are compared ordinally, the first value of a repeated name wins, and a set with more than 32 parameters, a name over 64 characters or a value over 2048 characters is refused with a 400 before the plugin is called, so the plugin never sees part of a set. Credentials, cookies and headers are never passed. The values come from the payer's browser, so check them against the gateway and never trust them for the amount or the order. The route the result page posts them to for an order (POST /api/orders/{id}/gateway-payment/complete) is anonymous, because a guest checkout has no sign-in: only the order's payment token guards it, and anyone who holds it can send any names and values. The plugin must therefore verify every value it acts on with its gateway and treat what arrives as a claim. CompleteAsync is called again when the payer returns twice, so it must be idempotent. It is not called for an invoice that is already paid, nor by the reconciliation job, which only reads the status. A plugin that throws leaves the status unread and the payer is told the gateway is unavailable; the reconciliation job settles the payment later if the gateway took it.
A payment plugin that implements IStoredCredentialPlugin and declares the storedCredentials capability can keep the
method the payer pays with, so the host can charge it later. This needs SDK 3.5.0 or later.
Checkout lists such a plugin with supportsStoredCredentials set to true and offers the signed-in client a box to save
the card, with the consent wording. When the client ticks it, the host first makes sure the gateway customer exists
(EnsureCustomerAsync), then registers the payment with PaymentInstruction.SavePaymentMethod set to true, and records
the client's consent for that payment together with the wording version, the address and the browser of the request. The
plugin sends the gateway's own "store this method" request with the payment.
When GetStatusAsync reads the payment as Paid, it returns the stored method in GatewayPaymentStatus.SavedMethod. This
is the same SavedMethod that ListMethodsAsync returns, so the method is charged the same way later. The host binds it
to the consent of that payment in the save that settles the invoice, and it appears among the client's saved methods.
- Return
SavedMethodonly with thePaidstate, and the same method on every read of the same payment. - A plugin that does not support the flag ignores it and returns no method. The host treats that as "not saved", never as a failure of the payment.
- The client of the invoice can ask to save a method when signed in, and a user linked to the account only with the permission to view and pay invoices. A guest checkout pays as before, without the option.
- Return the saved method from
ListMethodsAsyncfor the customer as well: the host reads the brand, the last four digits and the expiry from that list, and shows a bound method the list does not return as unavailable.
Call GetConfig(key) (from PaymentGatewayBase) to read a setting. Settings are stored as integration:{pluginId}:{key} in the application configuration and are written by the admin Integrations page.
public string? GetBaseUrl() => GetConfig("gateway_url");The host does not follow redirects on any HTTP client it hands to a plugin: the client named after the plugin id and the factory's unnamed client. A 3xx reply reaches the plugin as it is, with its Location header, because a client that followed it would resend the plugin's authorization header, and for some handlers its body, to whatever address the reply names. Decide for yourself: send a key or a token only to the host you built the address for, and when a reply names a new address check its scheme, host and port (and that it is https) before you send a request to it, with the credential again only if they are the same. This is the rule of SDK 3.7.0; PluginHttpContract.AssertRedirectIsNotFollowedAsync checks it in the plugin's own tests.
CreatePaymentAsync, GetStatusAsync and RefundAsync are separate calls, and a gateway may need something from one in the next (an order id, a cursor). Take IPluginStore in the plugin's constructor, next to the IConfiguration the host passes:
public MyGateway(IConfiguration configuration, IPluginStore store) : base(configuration)
{
_store = store;
}The host provides it when it activates the plugin. It is plugin wide: scoped to your plugin id and to no client, with the same key rules and size limits as call.Store, and it is removed with the plugin's data when the plugin is removed and its data purged. It never reaches another plugin's values or any client's values; data about one client belongs in call.Store, which is bound to the call's client. The store is the same data as the call store of an admin call outside any client.
::: code-group
using Hostpanel.Sdk.Base;
using Hostpanel.Sdk.Plugins.Enums;
using Hostpanel.Sdk.Plugins.Payment;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace MyCompany.Hostpanel.Plugins.MyGateway;
public sealed class MyGateway : PaymentGatewayBase, IPaymentPlugin
{
public MyGateway(string pluginId, IConfiguration configuration, ILogger<MyGateway> logger)
: base(pluginId, configuration, logger) { }
public string CurrencyCode => "840"; // USD (ISO 4217 numeric)
public Task<PaymentSession> CreatePaymentAsync(
PaymentInstruction instruction, CancellationToken ct)
{
var url = GetConfig("gateway_url")
?? throw new InvalidOperationException("gateway_url is required");
// ... call the gateway API and return a redirect URL
return Task.FromResult(new PaymentSession("order-123", url + "/pay?order=123"));
}
public Task<GatewayPaymentStatus> GetStatusAsync(
string gatewayOrderId, CancellationToken ct)
{
// ... query the gateway
return Task.FromResult(
new GatewayPaymentStatus(GatewayPaymentState.Paid, gatewayOrderId, "ok", null, null));
}
public Task<string> RefundAsync(string gatewayOrderId, long amountMinor, CancellationToken ct)
{
// ... call the gateway refund endpoint
return Task.FromResult("refund-ref-456");
}
}{
"id": "my-gateway",
"name": "My Gateway",
"version": "1.0.0",
"author": "Your Company",
"description": "Accept payments through My Gateway.",
"type": "Payment",
"category": "Payment Gateways",
"color": "#0369a1",
"entryPoint": "MyCompany.Hostpanel.Plugins.MyGateway.MyGateway",
"sdkVersion": "1.0",
"showInIntegrations": true,
"integrationsCategory": "Payment Gateways",
"fields": [
{ "key": "gateway_url", "label": "Gateway URL", "type": "text", "required": true },
{ "key": "api_key", "label": "API Key", "type": "secret", "required": true },
{ "key": "mode", "label": "Mode", "type": "select", "required": false }
]
}using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging.Abstractions;
using Hostpanel.Sdk.Plugins.Payment;
using Xunit;
public class MyGatewayTests
{
[Fact]
public async Task CreatePaymentAsync_ReturnsRedirectUrl()
{
var config = new ConfigurationBuilder()
.AddInMemoryCollection(new Dictionary<string, string?>
{
["integration:my-gateway:gateway_url"] = "https://test.example.com",
["integration:my-gateway:api_key"] = "test-key",
})
.Build();
var gateway = new MyGateway("my-gateway", config, NullLogger<MyGateway>.Instance);
var instruction = new PaymentInstruction(
OrderNumber: "1001",
AmountMinor: 5000,
ReturnUrl: "https://panel.example.com/payment/result",
Description: "Invoice #1001",
Language: "en");
var session = await gateway.CreatePaymentAsync(instruction, CancellationToken.None);
Assert.False(string.IsNullOrEmpty(session.RedirectUrl));
Assert.False(string.IsNullOrEmpty(session.GatewayOrderId));
}
}:::
Implement IProvisioningPanelPlugin from Hostpanel.Sdk.Plugins.Provisioning for a hosting panel (add IProvisioningPanelLoginPlugin to give the account's login details), declare the provisioningPanel capability and list the panel's serverModules in the manifest. What the host calls and how it reads each answer is described under Hosting panel plugins; the SDK's ProvisioningContract checks belong in your tests.
Every plugin ZIP must have plugin.json at the root.
The icon file is checked when the plugin is installed and again when it is loaded. A path that leaves the package, a file that is missing (PLUGIN_ICON_MISSING), a file over the size limit, a .png that is not a PNG, and an SVG that is not well-formed XML or that holds a script, a foreignObject, an event handler attribute (onload, onclick and so on), a DOCTYPE, or a reference that leaves the image (an href that is not a #fragment, a url(...) that is not a #fragment, @import) are refused with PLUGIN_ICON_INVALID. The admin panel shows the image where it shows the colour block; the host serves it from GET /api/admin/plugins/{id}/icon with X-Content-Type-Options: nosniff and a policy that blocks script and every fetch.
The fields above cover manifest version 1. A manifest without manifestVersion is version 1; the host accepts 1 and 2 and refuses any other value (PLUGIN_MANIFEST_VERSION_UNKNOWN). version must be a strict major.minor.patch version. Manifest version 2 ("manifestVersion": 2) adds the members below.
Tags are plain keywords, written in the manifest like this:
"tags": ["billing", "card-payments", "invoices"]The host checks the list when the plugin is installed and when it is loaded, with the same rule the Hostpanel.Sdk.Packaging package runs on your build: a tag shorter than 2 or longer than 30 characters, one with an upper case letter, a space, a leading # or any character outside letters, digits and hyphens, a tag listed twice, or more than 10 tags is refused with PLUGIN_MANIFEST_TAGS_INVALID. A manifest with no tags is fine.
Any manifest version may carry these optional members. They need SDK 3.4.0 or later.
"minHostVersion": "2.1.0",
"maxHostVersion": "2.9.0",
"changelog": "Adds refunds.
Fixes the renewal date."Both bounds are inclusive and compared in semantic version order, so a pre-release such as 2.1.0-rc.1 ranks below 2.1.0. A bound that is not a valid version is refused with PLUGIN_MANIFEST_HOST_VERSION_INVALID, a minHostVersion above the maxHostVersion with PLUGIN_MANIFEST_HOST_VERSION_RANGE_INVERTED, and a longer changelog with PLUGIN_MANIFEST_CHANGELOG_TOO_LONG.
When an administrator uploads a package, the admin panel first shows what it asks for (each hostAccess kind and each capability, in words), the changelog and the supported versions, and installs it only after a confirmation. The host compares the range with the version it runs on every install path: an upload, a registry install and an upgrade of an installed plugin. Outside the range the install is refused with PLUGIN_HOST_VERSION_OUT_OF_RANGE (409) and nothing is unpacked or staged.
Wherever a label, title or description may be a text, write either a key of locales or plain text. A value shaped like a key (letters, digits, dashes and underscores in two or more parts separated by dots) is looked up in the en texts and refused when it is not defined (PLUGIN_LABEL_KEY_MISSING).
Each entry in settings:
Each entry in api.client and api.admin is a route the host serves under /api/client/plugins/{id}/... and /api/admin/plugins/{id}/ext/.... The host checks sign-in, the caller's permission, CSRF and the rate limit before the plugin runs:
ui.client and ui.admin each hold menus and pages. Each page:
Each menu entry:
Each entry in ui.slots puts a widget into a slot the host offers. The slot list is versioned; the host offers client.dashboard.cards (no context), client.service.tabs (context key serviceId), admin.client.panels (clientId) and admin.service.panels (serviceId and clientId). A slot that is not listed, or a context key the slot does not offer, is refused.
A payment gateway calls the panel server to server, with no signed-in user: a card webhook, a pre check and confirmation, a bank result URL. A plugin that implements IPluginEndpoints can receive these through a public door, with no gateway code in the host. This is open to a plugin of any type: a payment plugin lists "capabilities": ["endpoints"] in its manifest and its class implements IPluginEndpoints beside IPaymentPlugin; an App plugin needs no capability. The capability opens this door only. The api.client and api.admin routes, pages, menus and slots of a plugin that is not an App plugin are not served, whatever it declares. A manifest that lists endpoints while its class does not implement IPluginEndpoints is refused at load with PLUGIN_ENDPOINTS_NOT_IMPLEMENTED, and a plugin that does not list it answers its callbacks with the same 404 PLUGIN_ROUTE_NOT_FOUND as an unknown plugin.
Declare each callback in api.callbacks, a list of routes with the same method and path rules as api.client (a permission is not allowed, and neither is streaming; rateLimit is ignored, because the door has its own limit):
{
"api": {
"callbacks": [
{ "method": "Post", "path": "/webhook" },
{ "method": "Post", "path": "/confirm/{step}" }
]
}
}The host serves them under /api/plugins/{id}/callback/..., so the second route above is POST /api/plugins/{id}/callback/confirm/result. Give that address to the gateway.
What the host does:
- It answers only a declared callback of an installed and enabled plugin. An unknown plugin, a switched-off or unconfigured one, an undeclared path and a wrong method all answer the same
404 PLUGIN_ROUTE_NOT_FOUND, so the door never tells what is installed. The routes ofapi.clientandapi.adminare not reachable through it. - There is no sign-in and no CSRF header. The plugin gets
call.Area == PluginArea.Callback, no client reference, no permissions, a fixed caller referencecallbackand the plugin-wide store. - The body is passed on byte for byte, never parsed or re-serialised, so a signature over it still verifies.
call.Headersholds an allow-list of the request headers, exactly as received (see below), andcall.Querythe query string. - A callback may answer with
PluginReply.Raw(status, body, contentType), for gateways that expect a plain answer such asOKastext/plain: the bytes, status and media type are written as given, withX-Content-Type-Options: nosniff. A raw reply is accepted on a callback only (on a client or admin route it is a plugin fault,PLUGIN_FAILED), its media type must betext/plain,application/json,application/xml,application/x-www-form-urlencodedortext/html(anything else, script included, isPLUGIN_FAILED), and its body is held toPluginApi__MaxBodyBytes. Every raw reply that is not HTML also carriesContent-Security-Policy: default-src 'none'; frame-ancestors 'none'. - A callback may answer an HTML page with
PluginReply.Raw(200, bytes, "text/html; charset=utf-8"), so a gateway can serve its checkout page (a browser step, for example). The page is written under a strict policy the plugin cannot change: nothing loads, connects, posts a form or opens a frame except to the exacthttpsorigins its manifest lists inexternalOrigins(a wildcard or anhttporigin names none), the page cannot be framed, has no base address and runs sandboxed (scripts and forms allowed, without the origin of the panel, so it cannot reach the panel's session or storage). It is never cached and sends no referrer, because its address can carry a payment token. Its inline script and style run; a script it loads must come from a listed origin. - A callback may answer with
PluginReply.Redirect(location, status)(301, 302, 303, 307 or 308; 303 by default), for example to send the payer who returns from the gateway's page on to the page that shows the result. The host writes the status and aLocationheader and no body, never cached and with no referrer. A redirect is accepted on a callback only (on a client or admin route it is a plugin fault,PLUGIN_FAILED). The host checks the address again and is stricter than the SDK: it is either a path on the panel (one leading slash, never//, no dot segment, no encoded slash or backslash, never under/api) or an absolutehttpsaddress with no user info and no port, on the origin of the client portal or on an origin the manifest lists inexternalOrigins. It has no line break or other control character, no space, no character outside ASCII (percent-encode it), no fragment (#) and at most 2048 characters. Anything else isPLUGIN_FAILEDand noLocationis written. Never build the address from the request, a query parameter for example: an address outside the allowed ones does not pass anyway. - Only these request headers reach
call.Headers:Content-Type,Content-Length,User-Agent,Signature,Digest,Content-Digest,Date,Idempotency-Key,Webhook-Id,Webhook-Timestamp,Webhook-Signature, and anyX-*header exceptX-Forwarded-*,X-Real-IPand the host's own (X-Language,X-Requested-With,X-Logout-Key,X-Service-Key,X-Renewed-Access-Token).Cookie,Authorization,Proxy-AuthorizationandHostare never passed on. If your gateway signs a header that is not on this list, send it as anX-*header or put it in the body. - The body is capped by
PluginApi__MaxBodyBytes(413PLUGIN_REQUEST_TOO_LARGEabove it) and every request to the door is counted per caller address againstRateLimit__PluginCallback(429 above it). - A failure is logged with the plugin id only, never with a header, a query or a body.
What the plugin must do: verify the call itself (the gateway's signature, checksum or shared secret) before it trusts anything in it, using a secret from its own settings. Answer PluginReply.Problem(400, ...) or 403 for a call that does not verify, and a success reply for one that does; keep the work idempotent, because gateways deliver the same event more than once. Nothing in the host says the call is authentic.
A manifest that breaks one of these rules is refused at install and at startup with a PLUGIN_* manifest error code that names the offending member (PLUGIN_CALLBACK_INVALID for a callback that declares a permission or streams, PLUGIN_ROUTE_PATH_INVALID and PLUGIN_ROUTE_DUPLICATE for its path and repeats). Read backend/src/Hostpanel.Sdk/Plugins/Manifest for the exact types.
A payment plugin whose callback learns that an order probably changed (a webhook, or the payer's return) can ask the host to read it now, instead of waiting for the host's own schedule. This needs SDK 3.11.0 or later, and it is optional, so check for it with a type test and do without it when the host lacks it:
if (call.Host is IPluginHostPaymentApi payment)
{
await payment.RequestOrderReadAsync(gatewayOrderId, ct);
}The request is a hint, never proof: the plugin marks nothing paid. The host finds the order under the calling plugin's own id, calls GetStatusAsync and settles only from that answer, through the same path as the payer's return and the reconciliation job, so a repeat is safe and a wrong amount is refused as before. The host may ignore the request and never tells the plugin whether it read anything. It ignores an unknown order, an order of another plugin, a session a newer attempt replaced, an id that is empty, longer than 255 characters or has a control character, and more than RateLimit__PluginOrderRead__PermitLimit requests (6) for one order within RateLimit__PluginOrderRead__WindowSeconds (60). The plugin must work without it.
A status read never moves money. If the host reads an order of an invoice it already settled through the plugin and the gateway now answers Declined (the contract also uses it for a refund, a reversal and a charge back), it changes nothing on the invoice or the ledger, and tells staff once per payment session by email, unless the invoice already shows a refund of its own through that gateway.
A refund the host asks for carries RefundInstruction.TransactionId (SDK 3.11.0 or later): the transaction id the plugin itself reported when the payment became paid, or null when the host holds only the order id.
A version 2 manifest may list capabilities, each a name from the SDK's PluginCapabilities:
| Capability | Allowed on | Needs | The plugin class must also implement |
|---|---|---|---|
storedCredentials |
Payment only |
IStoredCredentialPlugin |
|
paymentReturn |
Payment only |
IPaymentReturnPlugin |
|
endpoints |
any type | IPluginEndpoints |
|
tax |
any type | ITaxPlugin |
|
provisioningPanel |
Provisioning only |
IProvisioningPanelPlugin |
|
provisioningPanelLogin |
Provisioning only |
provisioningPanel |
IProvisioningPanelLoginPlugin |
provisioningPanelPackages |
Provisioning only |
provisioningPanel |
IProvisioningPanelPackagesPlugin |
provisioningPanelAccount |
Provisioning only |
provisioningPanel |
IProvisioningPanelAccountPlugin |
virtualServer |
Provisioning only |
IVirtualServerPlugin |
|
virtualServerList |
Provisioning only |
IVirtualServerListPlugin |
|
virtualServerSnapshots |
Provisioning only |
virtualServer |
IVirtualServerSnapshotPlugin |
virtualServerBackups |
Provisioning only |
virtualServer |
IVirtualServerBackupPlugin |
virtualServerFirewall |
Provisioning only |
virtualServer |
IVirtualServerFirewallPlugin |
virtualServerConsole |
Provisioning only |
virtualServer |
IVirtualServerPlugin, with CreateConsoleSessionAsync supported |
registrarOperations |
Registrar only |
IRegistrarOperationsPlugin |
|
registrarEmailForwarding, registrarDnsManagement, registrarWhois, registrarChildNameservers, registrarDnssec, registrarRestore, registrarDomainList, registrarSuggestions, registrarBalance |
Registrar only |
the matching interface, for example IRegistrarWhoisPlugin for registrarWhois |
Declaring a hosting panel, virtual server, registrar or tax capability makes the plugin load and shows the capability on the
plugins page. The host calls the hosting panel contracts (see Hosting panel plugins) and the registrar
contracts (see "Registrar plugins" below); it does not call the virtual server and tax contracts yet: a feature starts to use
one when it ships, and a plugin that declares one before then is loaded but never asked.
A registrar plugin whose registry needs more than the standard contact declares it in the domainFields block of its manifest (manifest version 2): each set names the zones it applies to, the registrant holder (any, individual or organization), the operations (register, transfer, contactChange) and the fields to ask, each with a key, a label, a type (text, textarea, select, date, number, url), whether it is required and optional length, pattern and options. The host draws the fields at checkout, on the transfer order and in the contact forms, checks the values with the SDK's PluginDomainFieldRules before an order is placed or the registrar is called, keeps them encrypted, and passes them to your plugin unchanged as the ExtendedAttributes of the register, transfer and contact contexts. The host knows nothing about any zone: what is asked, for which zones, comes only from your manifest.
An App plugin answers routes and shows pages, menus and slots without declaring anything. Any other type that declares
api routes or ui menus, pages or slots must declare endpoints, or the package is refused at install and skipped at
startup (PLUGIN_ENDPOINTS_NOT_DECLARED). This is how one plugin, for example a Fulfilment plugin that sells credits,
also gives the client a screen. An unknown name, a name declared twice, a capability on a type that may not carry it
(storedCredentials on anything but Payment, virtualServer on a Registrar) or a capability declared without the one it
needs (virtualServerSnapshots without virtualServer) is refused the same way (PLUGIN_CAPABILITY_NOT_ALLOWED).
A declared capability is checked against the class when the plugin is activated. If the class does not implement the
interface a capability promises, the plugin is not activated for anything, its own type's calls included: a payment
plugin that declares storedCredentials without implementing IStoredCredentialPlugin takes no payments, and a
fulfilment plugin that declares endpoints without implementing IPluginEndpoints receives no fulfilment calls. The
admin log names the plugin and the capability.
A registrar is the plugin whose id a TLD or a domain names: the admin picks it from the installed registrar plugins, and the
host stores the id. A stored id is matched to a plugin id without regard to letter case. The host calls a registrar plugin
only when it declares registrarOperations, and builds the connection it passes from the plugin's saved settings by their
connectionRole (see below), so the host knows no setting key of yours. A plugin that is not switched on, lacks a required
setting or is mid data migration is treated as not configured, and its domains answer REGISTRAR_NOT_CONFIGURED.
What each capability turns on in the screens:
| Capability | What the host does with it |
|---|---|
registrarOperations |
availability, register, transfer, renew, the active check, nameservers, contact, lock, privacy, auto renew, EPP code, outgoing transfer, DNS records, TLD prices and Test Connection |
registrarDnsManagement |
the DNS management switch and the DNS records section of a domain |
registrarEmailForwarding |
the email forwarding switch and its rules |
registrarWhois |
the WHOIS lookup |
The other registrar capabilities (balance, child nameservers, DNSSEC, restore, domain list, suggestions) are accepted and shown
but nothing in the host calls them yet. An action whose capability a plugin does not declare is hidden in the admin panel and
the portal, and answers REGISTRAR_OPERATION_UNSUPPORTED if it is asked for anyway.
A refusal reason becomes one code and one sentence in the user's language, and your own text is never shown:
| Reason | Code |
|---|---|
DomainUnavailable |
REGISTRAR_DOMAIN_UNAVAILABLE |
TldNotSupported |
REGISTRAR_TLD_NOT_SUPPORTED |
EppCodeInvalid |
REGISTRAR_EPP_CODE_INVALID |
TransferNotAllowed |
REGISTRAR_TRANSFER_NOT_ALLOWED |
ContactInvalid |
REGISTRAR_CONTACT_VALIDATION_FAILED |
NameserverInvalid |
REGISTRAR_NAMESERVER_INVALID |
DnsRecordInvalid |
REGISTRAR_DNS_RECORD_INVALID |
InsufficientFunds |
REGISTRAR_INSUFFICIENT_FUNDS |
AccessDenied |
REGISTRAR_ACCESS_DENIED |
Other |
REGISTRAR_ORDER_UPSTREAM_FAILED |
An order the plugin accepted but has not finished is returned with Pending or RequiresPolling, and the host asks again
through CheckDomainActiveAsync. A renewal carries CurrentExpiresAt, the expiry the host held, so a renewal that already
took effect is answered AlreadyApplied instead of charging twice. A throw means the outcome is unknown and is never read as
a refusal. A name with a premium price is reported as not available, because the host sells at the TLD's price.
A Provisioning plugin that declares provisioningPanel, virtualServer or virtualServerList lists the server modules it
serves in serverModules, for example "serverModules": ["example-panel"]: the short names an administrator picks for a
server's control panel type, and the host sends the servers of those modules to the plugin. Each id is 1 to 50 ASCII letters,
digits, dashes, dots or underscores, ids repeat nothing (case is ignored) and the list holds at least one. A plugin that
declares none of those capabilities lists no module. A list that breaks this is refused at install and at startup with
PLUGIN_MANIFEST_SERVER_MODULES_INVALID.
A Provisioning plugin that declares provisioningPanel and implements IProvisioningPanelPlugin is called for every server whose
module it serves. The host reaches it through the same code that drives its own panels, so an order, a service and the server
screens behave the same whoever drives the panel.
| Operation | When the host calls it |
|---|---|
CreateAccountAsync |
an order or a setup is provisioned |
SuspendAccountAsync, UnsuspendAccountAsync |
a service is suspended, and when it is active again |
TerminateAccountAsync |
a service is terminated |
ChangePackageAsync, ChangePasswordAsync |
a package or a password is changed, by the client or by staff |
CreateSsoLinkAsync |
the control panel sign in link behind Open panel. The host judges the link itself, so a plugin need not repeat the check: it is opened only as an https address with no user info on the server's own host name or the host its API is dialled at, otherwise SERVICE_PANEL_SSO_URL_UPSTREAM_FAILED. A panel that has no such link answers NotSupported; the button then falls back to GetLoginDetailsAsync when provisioningPanelLogin is declared |
ListAccountsAsync, GetUsageAsync |
the disk usage report: the accounts page by page, then each account's usage |
TestConnectionAsync |
Test Connection on a server and the periodic account count sync |
GetLoginDetailsAsync |
the account's login details, only when provisioningPanelLogin is declared; without it the host answers that the action is not supported. Open panel shows them (sign in page, user name, domain, server address, never the password) when CreateSsoLinkAsync answers NotSupported. The sign in page must be an absolute http or https address without user info, otherwise the host answers SERVICE_CREDENTIALS_UPSTREAM_FAILED |
GetAccountAsync |
the service's panel sync and the read after an account is created: one account by its reference, only when provisioningPanelAccount is declared; without it the host answers that the action is not supported |
ListPackagesAsync |
the Change package dialog of a service, only when provisioningPanelPackages is declared: the names of the packages the panel offers, shown as a list to choose from. A plugin without the capability makes the host answer PANEL_OPERATION_NOT_SUPPORTED, and the dialog keeps the field where the name is typed in |
Reading one account. A plugin that also implements IProvisioningPanelAccountPlugin and declares provisioningPanelAccount lets the host read one account by its ProvisioningRef: its status, domain, package and, when the panel says it, IpAddress (an IPv4 or IPv6 address in text form; anything else is ignored). A field the panel leaves null is shown as not reported. The host reads the account right after it creates one, to record the IP address on the service, and when staff press Sync with panel on a service. The read never changes the panel. A sync takes the platform as the source of truth: through the operations above it asks the panel to suspend or unsuspend the account to match the service and to change the package to the product's package, sets the stored password only when staff tick the box, and records the IP address the panel reports. The domain is reported and never changed. Without the capability a sync answers PANEL_OPERATION_NOT_SUPPORTED, and after an account is created the failed read is only logged, so provisioning still succeeds.
Which plugin serves a server. The server's module id is compared with each plugin's serverModules ignoring case, so a server
saved as DirectAdmin is served by a plugin that declares directadmin. Nothing stored is rewritten: the service keeps its server and its
ProvisioningRef, and the credentials the server already holds reach the plugin in the PanelServerConnection. One plugin serves
one module: when two installed plugins declare it, every call is refused with PANEL_PLUGIN_CONFLICT. A plugin that is installed
but switched off, not configured, waiting for its data migration or missing a capability it declares answers
PANEL_PLUGIN_UNAVAILABLE, and the host never falls back to another provider. Install and switch on the plugin before you upgrade a
deployment whose servers were driven by a panel that has become a plugin.
What an answer does. Each operation answers a PanelOperationOutcome:
| Outcome | In the host |
|---|---|
Succeeded, AlreadyApplied |
The operation is done. A repeat of a done operation is success, so a retry is safe. |
Pending |
The panel accepted the work and finishes it itself. For every operation except create the host counts it as done and notes it in the log. For create the service stays pending and the caller is told PROVISIONING_PENDING to try again; answer AlreadyApplied for that user name once the account is ready, and the next attempt adopts it. |
NotFound |
The panel has no such account: PANEL_ACCOUNT_NOT_FOUND. Terminating an account that is already gone counts as done. |
NotSupported |
PANEL_OPERATION_NOT_SUPPORTED. |
Refused |
The code of the PanelRefusalReason: PackageUnknown is PANEL_PACKAGE_UNKNOWN, UsernameInvalid is PANEL_USERNAME_INVALID, DomainInvalid is PANEL_DOMAIN_INVALID, PasswordRejected is PANEL_PASSWORD_REJECTED, LimitReached is PANEL_LIMIT_REACHED, AccessDenied is PANEL_ACCESS_DENIED and every other reason is PANEL_REFUSED. The reader sees the sentence of that code in their own language, never the plugin's text. |
A plugin that throws is logged by plugin id, operation and exception type only, never the message, and answers a generic upstream
failure. A create that throws leaves the outcome unknown (PROVISIONING_OUTCOME_UNKNOWN), and the retry adopts the account if it
exists, so create must be idempotent by user name and answer AlreadyApplied for an account that already exists;
ProvisioningContract.AssertCreateIsIdempotentAsync checks it.
The connection. The plugin receives the server as the host stores it: host name, address, UseSsl, user name, access hash, API
token and Password, with Port null because the host keeps no panel port. The secrets print as *** in a log line or an exception, and
the plugin logs none of them. The stored password is read for a plugin call only; no provider built into the host receives it.
A Provisioning plugin that declares virtualServer and implements IVirtualServerPlugin is called for every server whose module it
serves, through the same provisioning code as a hosting panel: a virtual server is a service on a server the host knows. Which kind of
plugin drives a service is decided in one place, from the capability of the plugin that serves the server's module, never from the
module's name. A module that a hosting panel plugin also serves stays with the panel plugin.
| Operation | When the host calls it |
|---|---|
CreateServerAsync |
an order is provisioned. The service's domain is the server's name and host name (it is stored before the first call, so a retry sends the same name and the plugin answers AlreadyApplied with the same reference), the product's package name is the plan and the service's password is the root password. The product names no image yet, so the image id is empty. |
SuspendServerAsync, UnsuspendServerAsync |
staff or the billing cycle suspend or unsuspend the service. |
TerminateServerAsync |
the service is terminated. A server the platform no longer has counts as done. |
ChangePlanAsync |
Change package on the service. |
TestServerConnectionAsync |
Test connection on the server in the admin panel. |
The answers are the ones of a hosting panel: Succeeded, AlreadyApplied and Pending are done, NotFound is PANEL_ACCOUNT_NOT_FOUND,
NotSupported is PANEL_OPERATION_NOT_SUPPORTED and a refusal answers the code of its PanelRefusalReason. A plugin that cannot set
the root password it was sent and generates one answers it in VirtualServerInstance.GeneratedPassword, and the host stores it on the
service. A plugin that throws is logged by plugin id, operation and exception type only, and a create that throws leaves the service
pending with PROVISIONING_OUTCOME_UNKNOWN, so the retry adopts the server by its name. The other operations of the contract (power,
rebuild, root password reset, console, usage, images and plans, the listing) are not called by the host yet.
A server of a panel plugin can have its SSH keys managed through the SSH key agent the host keeps (see SSH key agent). The agent needs a profile that tells it how to recognise the panel's accounts, and a plugin ships its own, so the host names no panel. A plugin that declares provisioningPanel sets sshAgentProfile in the manifest and carries the files in its package:
| Package path | Holds |
|---|---|
agent/profile.conf |
The profile, one file in the agent's own configuration format (one [agent] section). At most 8 KiB. provider must equal sshAgentProfile and binding must be empty, because the host sets it for each server. It may set only keys the agent defines, and helper_dir and account_check_command must stay inside /usr/local/libexec/hostpanel-ssh-key-agent. |
agent/helpers/<name> |
The small programs the agent runs for the profile, one file each directly in the folder, installed under the helper folder of the profile. At most 32 files of 64 KiB each. A name is a letter or a digit followed by letters, digits, dots, underscores or hyphens. |
The files are covered by the package signature like the rest of the package, and the host checks them with the Hostpanel.Sdk.Packaging package, the same code you run before you publish (PluginAgentPackageChecker). A profile that breaks a rule is refused at install (PLUGIN_MANIFEST_SSH_AGENT_PROFILE_INVALID, PLUGIN_MANIFEST_SSH_AGENT_PROFILE_NOT_ALLOWED, PLUGIN_SSH_AGENT_PROFILE_MISSING, PLUGIN_SSH_AGENT_PROFILE_FILE_INVALID and PLUGIN_SSH_AGENT_HELPER_INVALID). A plugin that was installed before a rule existed stays loaded and its servers simply have no profile to install, with one warning in the log.
For a server whose module the plugin serves, the host offers the profile on the server's SSH dialog and builds an installer bundle for it: the agent and its files plus the plugin's profile and helpers, packed the same way every time, so the SHA256 the administrator sees is the one of the download (GET /api/public/ssh-agent/bundle.tar.gz?profile=<id>, answered 404 SSH_AGENT_PROFILE_NOT_FOUND for an id no loaded plugin ships). A file of the plugin replaces a file the host embeds at the same path. Two plugins that ship the same profile id are not allowed: the second one loads without its profile.
A Registrar plugin may mark which member of the registrar connection a setting fills with connectionRole on that setting:
accountName, apiKey (a secret setting), apiUrl (a url setting), clientIp or testMode (a boolean setting). A role is
given to one setting only, and a plugin that gives any role gives both accountName and apiKey. A manifest that breaks this
is refused with PLUGIN_MANIFEST_CONNECTION_ROLE_NOT_REGISTRAR, PLUGIN_MANIFEST_CONNECTION_ROLE_DUPLICATE,
PLUGIN_MANIFEST_CONNECTION_ROLE_TYPE_MISMATCH or PLUGIN_MANIFEST_CONNECTION_ROLES_INCOMPLETE. These are the checks of the
packaging package, so running the package on your plugin before you publish finds them first.
A hosting panel, virtual server or registrar plugin takes IPanelTransport in its constructor and builds every request on the
client it gives, and never creates its own HttpClient. The host's client refuses loopback, link-local and cloud metadata
addresses, follows no redirect (a 3xx answer reaches the plugin as it is), never repeats a request and gives up after 120
seconds. CreateClient(server) is the one to ask for when the plugin talks to a server it has a PanelServerConnection for: if
the operator ticked "Trust the self signed certificate of this server" on the server form, that client accepts the certificate
of that server's host name and of nothing else. The setting is the operator's alone and off by default; the plugin has no
switch of its own. The host keeps no panel port, so PanelServerConnection.Port is null and the plugin uses its own default.
PanelServerConnection also carries UseSsl and Password as the server stores them. The plugin owns the HttpClient it is given and disposes it when it is done (using var http = transport.CreateClient(server);).
Each entry in fields:
A plugin that deploys something to a client's hosting (a site builder, a store, a deploy tool) can ask the host to set up the
website and the database it needs, instead of asking the client to do it by hand. This needs SDK 3.9.0 or later. Declare what
you need in the manifest, and read it at run time through IPluginHostHostingApi, which extends IPluginHostApi without
changing it:
"hostAccess": ["websites", "databases"]if (host is IPluginHostHostingApi hosting)
{
var capabilities = await hosting.GetHostingCapabilitiesAsync(serviceId, ct);
if (capabilities.Websites && capabilities.PhpVersions.Contains("8.3"))
{
var site = await hosting.EnsureWebsiteAsync(
serviceId, new PluginWebsiteSpec("app.example.com", "sites/app", "8.3", DocumentRootMayBeLink: true), ct);
var database = await hosting.EnsureDatabaseAsync(serviceId, "shop", ct);
}
}| Member | Needs | What it does |
|---|---|---|
GetHostingCapabilitiesAsync |
any of ssh, websites, databases |
Tells which of the three the service supports, and the PHP versions of its server. A kind the manifest does not declare reads as false. |
EnsureWebsiteAsync |
websites |
Makes sure the website exists as the specification says. Asking again with the same specification answers the stored website without calling the server; with another one, the server and the record are updated. The answer's PhpCliPath (SDK 3.16.0) is the absolute path of the PHP command line binary of the website's PHP version, so a deploy can run the same PHP as the site; it is null when the website has no PHP or the server did not report the path. A website stored before the host kept the path is set up once more on its next call to learn it. |
RemoveWebsiteAsync |
websites |
Removes a website this plugin set up. Removing twice is fine. |
EnsureDatabaseAsync |
databases |
Makes sure a database exists for the label. The password is in the answer to the call that created it and nowhere else: a repeat answers the same database with a null password. |
RemoveDatabaseAsync |
databases |
Drops a database this plugin created. Removing twice is fine. |
The rules the host applies, in this order, and a refusal at any step is a PluginHostAccessException whose Failure says why:
- The call is a client-area call, the caller holds the right to manage the account's access (the same right the client portal asks for SSH keys), and the manifest declares the kind. Otherwise
NotAllowed. - The service is the call's client's. A missing service and another client's answer the same
NotFound. - An administrator bound the service's product to one of your slot widgets. Otherwise
NotAllowed. Removing never needs the binding. - The request is valid: the host name is the service's own domain or a subdomain of it, in lower case; the document root is a relative path of one to six plain segments inside the account's home (no leading dot, at most 200 characters); the PHP version is written like
8.3;DocumentRootMayBeLinkneeds a PHP version; a database label is a lower case letter followed by up to fourteen lower case letters or digits. OtherwiseInvalidRequest. - The service has a hosting account on a server that can set sites up. Otherwise
Unavailable. - The host name or label is not another plugin's (
Conflict), and the service holds fewer than 25 websites and 25 databases (LimitReached). - The plugin's hosting budget for the client is not spent (
RateLimit:HostingResources, 10 a minute by default). A spent budget answersServerUnavailable; the host never goes ahead when it cannot count. - The plugin is still switched on. A plugin switched off during the call gets
NotAllowedand what it just set up is taken back.
A website or database is always set up on the service's own server and account; nothing a plugin sends can name another one.
What the plugin sets up belongs to that plugin: another plugin cannot remove it through this API.
When the service is terminated the host marks its websites and databases as removed without calling the server, because the
hosting account is gone. The database user can connect from the server itself only (127.0.0.1, port 3306), so a plugin
that deploys over SSH uses it from the deploy. Store the password where you keep your own secrets and never log it: the host
prints it as ***, keeps no copy, and a lost password means removing the database and creating it again.
A plugin that talks to the panel behind a client's service (a backup tab, a usage page, a one click tool on the service
page) needs to know which server the service runs on and which account the panel holds for it. This needs SDK 3.11.0 or later.
Declare the access in the manifest, and read it at run time through IPluginHostServiceConnectionApi, which extends
IPluginHostApi without changing it:
"hostAccess": ["serviceConnection"]if (host is IPluginHostServiceConnectionApi connections)
{
PanelAccountContext account = await connections.ResolveServiceConnectionAsync(serviceId, ct);
// account.Server is the server and its stored credentials, account.Service.ProvisioningRef is the account name.
}The rules the host applies, in this order. A refusal at any step is a PluginHostAccessException whose Failure says why:
- The call is a client-area call, the caller holds the right to see passwords on the account (the same right the client portal asks), and the manifest declares
serviceConnection. OtherwiseNotAllowed. An administrator call has no client and gets nothing. - The service is the call's client's. A missing service and another client's answer the same
NotFound. - An administrator bound the service's product to one of your slot widgets. Otherwise
NotAllowed. TheproductIdsin your own manifest never count. - The service is active, has a provisioning reference and is assigned to a server that still exists. Otherwise
Unavailable. - The plugin is still switched on. Otherwise
NotAllowed.
Every grant is written to the client's activity log as "Plugin {id} read the server connection of service #{n}", with the plugin and the service only, and the line is saved before the answer is handed over. A refusal writes no line.
The answer carries the credentials the host stores for the server (the password, the API token and the access hash, each only when saved).
They are for your own panel and nothing else: send them only there, never log them, put them in a route reply or keep them past the call.
The host prints them as *** in every message it writes. Because the host keeps no panel port, Port is null and your plugin uses its own
default, and AccountId is null until the server form stores one.
A service tab is declared like any other slot widget. The tab asks the route, and the route resolves the connection with the service id from its path:
"ui": { "slots": [ { "slot": "client.service.tabs", "id": "backups", "title": "Backups", "contextKeys": ["serviceId"], "view": "views/backups.json" } ] },
"api": { "client": [ { "method": "get", "path": "/backups/{serviceId}", "permission": "ViewProductsServices" } ] }The panel lays blocks out by kind, with nothing to set in the view. Consecutive stat blocks form one grid of tiles, and a stat with format: "badge" shows its value as a badge. Consecutive link blocks form one wrapping row of outline buttons; a link that leaves the panel carries an external-link mark. A header block is the page title on a plugin page and a compact section title when the view is shown inside a widget on a host page. The tab bar of a tabs block scrolls sideways when the tabs do not fit.
A page or slot view ({ "schema": 1, "blocks": [...] }) can react to its own data without a reload. Three optional
members do it; all need SDK 2.2.0 or later, and the view schema stays 1.
A condition is one shape, used by visibleWhen and by followUp.until, with exactly these three members:
{ "route": { "method": "get", "path": "/services/{serviceId}/site" }, "field": "site.status", "equals": ["ready", "live"] }routeis aGETroute your manifest declares in the same area as the page or slot.fieldis a dotted path into the JSON answer (letters, digits,_and-per segment, at most 200 characters).equalsis one JSON value (string, number,true,false,null) or a list of 1 to 20 of them. The condition holds when the field strictly equals one of them:"1"does not match1.
visibleWhen goes on any block, including header actions and blocks inside tabs. The block is shown only when the
condition holds; while it is read, when the read fails, or when the field is missing, it stays hidden. It is read again
when the block's own id is refreshed. Hide a create form once a site exists:
{
"kind": "form",
"id": "create-site",
"visibleWhen": { "route": { "method": "get", "path": "/services/{serviceId}/site" }, "field": "exists", "equals": false },
"fields": [
{ "key": "name", "label": "site.name", "type": "text", "required": true },
{ "key": "description", "label": "site.description", "type": "textarea" }
],
"submit": {
"route": { "method": "post", "path": "/services/{serviceId}/site" },
"label": "site.create",
"refresh": ["create-site", "site"],
"confirm": "site.create.confirm",
"resetOnSuccess": true
}
}How often a route is read. A page is one picture of your data. Every block, condition and card that names the same
GET route on a page is answered by one request, and the panel sends a new one only when the page is refreshed (an
action, a form, a conversation turn or a follow-up asked for it) after any call that is not a read ended, or when a
conversation turn begins or ends. A block that appears later takes the answer the page already holds, so a page naming
one state route in ten places costs one request per refresh, not ten. The panel keeps no read past that moment, none
older than ten seconds and none from another page. A route read by
several blocks is still read once for each refresh, so keep it cheap to answer.
confirm is a text key, only inside a form's submit, and optional. Its text is the question the panel asks before
the form is sent, in the client portal and in the admin; nothing is sent unless the reader agrees. It works like the
confirm of an action block, and a host older than this member ignores it and sends the form at once.
resetOnSuccess is true or false, only inside a form's submit. After a successful submit every field goes
back to empty.
followUp goes on an action block or inside a form's submit, with exactly refresh and until. After a
successful call (and its normal refresh), the panel reads until.route again and again, refreshing the listed blocks
each time, until the condition holds (then once more), it runs out of attempts, or the reader leaves the page. A failed
read counts as an attempt. The watch outlives the button that started it, so a button that hides itself once its work is
done (a visibleWhen on the same data) does not stop it. The sentence the action answered with is taken down when the
condition holds, so a line like "is being published" does not outlive the publish. Show a publish result without a
reload:
{
"kind": "action",
"label": "site.publish",
"route": { "method": "post", "path": "/services/{serviceId}/site/publish" },
"followUp": {
"refresh": ["publish-result"],
"until": {
"route": { "method": "get", "path": "/services/{serviceId}/site" },
"field": "publish.state",
"equals": ["done", "failed"]
}
}
}Both examples assume the view also has blocks with the ids site and publish-result, and that the manifest declares
the three routes in its api block and the label keys in locales.en:
{
"locales": {
"en": {
"site.name": "Site name",
"site.description": "Description",
"site.create": "Create site",
"site.publish": "Publish"
}
}
}refresh lists 1 to 20 block ids, each present in the same view. Give every block that has an id its own, in any
container (a tab, a pane, a header): the panel treats blocks that share one as one block, so a refresh would reach all of
them and a new follow-up of one would end the running follow-up of the other. A view that gives one id to two blocks is
refused at install (PLUGIN_VIEW_BLOCK_ID_REPEATED); a plugin that is already installed with such a view still loads, the
host writes a warning in its log, and the panel draws every block but acts on blocks with one id as if they were one. The id of a tab or of a preview source is a separate name and may match a
block's. How often and how long the panel polls is the
host's choice, not yours: every 3 seconds, at most 20 times (about a minute). A long job should report its own state on
the until route rather than expect more time.
bodySource goes on an action block in the client area and makes the button send what the reader saw. It holds
exactly a GET route and 1 to 10 fields, each a body member (a camelCase name, not a label member such as title)
and the dotted path it is read from. Without it an action posts {}, as before.
{
"kind": "action",
"id": "publish",
"label": "site.publish",
"route": { "method": "post", "path": "/services/{serviceId}/site/publish" },
"labelSource": { "route": { "method": "get", "path": "/services/{serviceId}/site" }, "field": "publishLabel" },
"bodySource": {
"route": { "method": "get", "path": "/services/{serviceId}/site" },
"fields": { "expectedVersion": "publishVersion" }
}
}The action needs an id and a POST, PUT or PATCH route, and a labelSource must read the same route: the panel
makes one read for both, so the button sends the value on its label. The button is disabled until every member has been
read as a string, number or boolean. The body is fixed at the click. A refused call reads the data and the action's
refresh blocks again, so answer a conflict with your own sentence; your route, not the panel, decides whether the value
is still current. A result card's action in a chat event carries a literal body of the same shape; an event with a
malformed one loses that action.
An action may open an address the route answers with in a new tab: openUrlFrom names the field of the JSON reply
that holds an absolute https URL (for example a one-time sign-in link). The panel opens the blank tab on the click, so the
browser allows it, reads the field after the call, and sends the tab there only when the address passes the same check as
a link block (an origin in the page's externalOrigins, a https://*.example.com pattern admits every subdomain). A
failed call or a refused address closes the tab and shows the usual error. openUrlFrom is a name of 1 to 64 letters,
digits or underscores, on an action that calls a route and has no navigate; anything else is
PLUGIN_VIEW_OPEN_URL_INVALID.
A view that breaks these rules is refused at install and skipped at startup: PLUGIN_VIEW_ACTION_BODY_INVALID (a bad
bodySource, or one in the wrong place), PLUGIN_VIEW_CONDITION_INVALID (a bad
condition, a condition route that is not GET, visibleWhen outside a block), PLUGIN_VIEW_FOLLOW_UP_INVALID (a bad
followUp or one in the wrong place, a refresh id no block carries, resetOnSuccess that is not a boolean or not in a
submit), and PLUGIN_VIEW_ROUTE_UNDECLARED for a condition route the manifest does not declare.
Two checks were added after plugins were already installed, so they apply to an install only: PLUGIN_VIEW_BLOCK_ID_REPEATED
(one id on more than one block) and PLUGIN_VIEW_INVALID for a mistyped display member (a header's compact,
titleSource or subtitleSource, an action's labelSource, a preview's note, a table's display). A plugin that is
already installed with such a view is not removed by a host upgrade: it loads, and the host writes one warning per fault
to its log. Fix them in your next version, because uploading it will be refused until you do.
Needs SDK 3.2.0 or later; the view schema stays 1.
A client page may set "layout": "workspace" (PluginPageLayouts) in plugin.json: full width, no service side menu,
a slim link back to the service (its {serviceId} path parameter names which). Absent means standard. An admin page
takes no layout. A bad value is PLUGIN_PAGE_LAYOUT_UNKNOWN.
split puts two panes side by side, stacked on a phone, and never nests inside a split (PLUGIN_VIEW_SPLIT_INVALID):
{ "kind": "split", "panes": [ { "blocks": [ { "kind": "chat", "send": { "method": "post", "path": "/chat" } } ] },
{ "blocks": [ { "kind": "preview", "sources": [ ] } ] } ] }preview shows one address in a sandboxed frame, on a client page only:
{
"kind": "preview",
"id": "site-preview",
"size": "desktop",
"sources": [
{ "id": "preview", "label": "site.preview", "route": { "method": "get", "path": "/services/{serviceId}/site" }, "field": "previewUrl" },
{ "id": "live", "label": "site.live", "route": { "method": "get", "path": "/services/{serviceId}/site" }, "field": "liveUrl" }
]
}Up to 5 sources, each exactly id, label, a GET route and a dotted field; size is desktop or phone, and
the reader can switch both. A bad shape, or a preview in a slot or on an admin page, is PLUGIN_VIEW_PREVIEW_INVALID.
The query parameter hp-revision is reserved for the panel: when it draws a preview again it adds hp-revision to the address, so the browser cannot answer with a cached page. A page of yours must not use that name for its own purposes.
Letting the reader select elements. A preview may declare selection, and a chat in the same document "selection": true; both are off when absent:
"selection": {
"sources": ["preview"],
"route": { "method": "post", "path": "/services/{serviceId}/site/selection" },
"release": { "route": { "method": "get", "path": "/services/{serviceId}/site/state" }, "field": "previewRelease" }
}sources are the source ids that may select: leave a live site out. The framed page runs your own script and talks to the panel with postMessage, { "type": "hostpanel.preview.selection", "version": 1, "release": "...", "event": "ready" | "toggle" | "exit", "id": "..." }, and receives { type, version, "event": "state", "active": bool, "selected": [ids] } from the panel. The select button appears only after ready. id is a dotted path of letters and digits, at most 128 characters and 20 per selection. A message is a claim, never trusted: the panel accepts it only from its own frame's window, in exactly this shape, naming the release your route reports, on a listed source, and a toggle only while the mode is on; any script in the frame could still send one. So your route gets { "releaseId", "ids" } and answers { "items": [{ "id", "label" }] } with the ids it really knows, and the panel draws only those labels. The next chat message carries "selection": { "releaseId", "ids" }, which your server must check again; take no text from the frame. Treat ids and releaseId as untrusted input in both routes: they come from page script, whatever the panel checked first, so validate them against your own data and never use one as a path, a query fragment or text for a model without that check. A selection is emptied when the release changes. The panel then ignores the frame until it says ready again, so the framed page must send ready again after a release change (a new document does so by loading; a page that updates itself in place must send it itself), or the select button stays hidden. A "try again" (resend) sends the same selection while its release is on the preview; once the release has changed the panel sends nothing, tells the reader the page changed and to select again, and leaves the text in the message field, because the message without its selection would reach further than what the reader chose. The panel only reads the release when it reads the block, so your chat route must refuse a releaseId that is no longer on the preview, with a problem reply and before it changes anything: the panel's check is a courtesy, and yours is the one that holds. One preview per document may declare selection, since the claim does not say which preview made it. A bad shape, a second selecting preview, or a chat selection with no preview selection, is PLUGIN_VIEW_SELECTION_INVALID.
Links to the reader's own sites. A plugin is published once and runs on every installation, so it cannot list the
domains of each. A link block (and a link in a chat card) may also point at the https origin of a domain of the reader's
own active hosting services, under the same rule as a preview below: only on a product the operator bound to your plugin's
slot widgets, as the domain was typed at order (with its www name), only for a reader who may see services, never the
panel's own origin. The same list reaches a slot widget's view. So an "open live site" or "open stage preview" link needs
no externalOrigins entry for sites hosted on the installation; list an origin only for an address outside it. The
admin panel has no reader account, so there only the manifest's origins apply. Your plugin cannot change any of this.
What may be framed. The address the route returns is shown only when its origin is one of your manifest's
externalOrigins (a pure https origin) or a domain of the reader's own active hosting services on a product the
operator bound to your plugin's slot widgets, as the service's domain was typed at order (with its www name, and only for
a reader who may see services; your manifest's productIds do not count, nothing bound means no domains, and the panel's
own origin is never on the list). Anything else shows nothing, with no message, and your plugin cannot
change that: the host writes the list per reader, and the same list narrows the page's frame-src, so a browser refuses
any other frame too.
The frame is sandbox="allow-scripts allow-forms". Scripts run, but the frame has an opaque origin: no cookies or
storage of the site's own, no pop-ups, no top navigation, no access to the panel. A site that needs its own session
will look signed out there, and a site that refuses framing (X-Frame-Options, frame-ancestors) stays blank, so send
your preview without those headers.
On a developer machine, PLUGIN_PREVIEW_DEV_HTTP_ORIGIN=http://localhost:8088 in docker/.env (the dev compose file maps
it to PluginPreview__DevelopmentHttpOrigins__0, and PLUGIN_PREVIEW_DEV_HTTP_ORIGIN_2 to __1, for a second address;
empty means none) allows an exact http origin on a loopback host. Outside the Development environment the host refuses to start with it set.
Needs SDK 3.2.0 or later. A chat block's streaming route may send these events (PluginChatEvents) beside its reply
text, so a reader can see what happened without reading it out of a paragraph. Text is plain and already in the reader's
language. error and done stay the host's. The reply text itself (delta, message, an assistant row of history) may
use a small Markdown subset: paragraphs, # headings, - and 1. lists, fenced code, **bold**, *italic* and
`code`. HTML and Markdown links in it stay plain text; send a link with the link event.
The block itself takes send (a streaming post route) and, all optional, history (a get route answering rows of { "role": "user" | "assistant", "text", "links"? }), placeholder, maxLength (the longest message), assistant ({ "label" }, the name that signs each reply), intro ({ "title", "text" }) and suggestions ([{ "label", "text"? }]): an empty chat shows the intro and the suggestions, and pressing a suggestion sends its text, or its label without one. refresh lists the ids of blocks the panel reads again when a turn has ended, successfully or not. Beside the events below, status ({ "text" }) says what you are doing now and shows inside the reply while it is written, and link ({ "text", "url" }) attaches a link to the reply under the rule of a link block: the url is either a host-relative path (one leading /, never //, never /api or anything below it, no backslash or control character) or an absolute https address without user info on one of the page's allowed origins (externalOrigins, and in the client panel the https origins of the reader's own bound services). Any other address (http:, javascript:, a protocol-relative or another origin) is checked when the event arrives and the link is left out, while the reply text stays. The panel keeps what the reader typed in the tab until a reply arrives, and gives the text back to the field when a send gets no reply.
{ "event": "step", "data": { "id": "build", "label": "Building the site", "state": "running" } }
{ "event": "step", "data": { "id": "build", "label": "Building the site", "state": "done" } }
{ "event": "result", "data": { "tone": "success", "title": "Published", "text": "Your site is live.", "actions": [
{ "label": "Open site", "href": "https://example.com/" },
{ "label": "Roll back", "route": { "method": "post", "path": "/services/{serviceId}/site/rollback" }, "confirm": "Roll back?" } ] } }
{ "event": "issue", "data": { "text": "The build failed: the theme is missing." } }stepis one row of a list in the reply; sending itsidagain (or itslabel, without anid) updates the row.stateisrunning,doneorfailed.resultis a card.toneisinfo(default),success,warningordanger; at least one oftitleandtext. At most 5actions, each with alabeland exactly one ofroute(one of your own, called through the host, so an undeclared route or a missing permission is refused as usual) orhref(under the rule of a link block). A card stays in the conversation after what it offers has changed, so an action may carryvisibleWhen: the same condition a view block has, except that the event spells the value listequalsAny(a C# record cannot have a member namedequals):{ "route": { "method": "get", "path": "/services/{serviceId}/site" }, "field": "publishVersion", "equalsAny": [5] }. The route is aGETroute of your own that the page can fill,fielda dotted path, andequalsAnyone to 20 strings, numbers, booleans ornull; the action shows only while the field strictly equals one of them. The panel reads it when the card is drawn and again whenever a block named in the chat'srefreshis read again (after a turn, and after a card action), and hides the action while it is being read, when the read fails and when the condition does not hold. It applies to a route, anhrefand aresendaction alike. Without it an action always shows. A condition the panel cannot read drops the action, since a button meant to hide must never show. Your route still decides whether a call is current: the condition is a courtesy to the reader, not the check. A row left with no visible action is hidden too.issueis your own failure, in the danger tone. The stream goes on; end it when you are done.
A panel ignores an event it cannot read. Stop cancels the stream: your enumerator's token fires (EnumeratorCancellation)
and nothing more is sent. Stop does not undo anything, so observe the token and leave your own work consistent.
The host loads every plugin in its own collectible AssemblyLoadContext. When an administrator updates or removes a
plugin, the host drains it (calls that are running get Plugins__DrainSeconds to finish), drops the instance and
unloads the context, so the new version can be loaded without restarting the server. .NET can unload a context only
when nothing outside it still refers to its types, so a plugin that holds on to anything keeps the old version in
memory, and the host then falls back to a restart. To stay unloadable:
- No static references into host objects that outlive a call. Do not store the host's services, the SDK's context
objects, loggers,
HttpClientinstances, delegates or tasks instaticfields, static events or singletons. Take what you need from the constructor or the call and let it go when the call ends. - No threads or timers left running after the call. Do not start a
Thread,Timer,Task.Runloop or backgroundTaskthat outlives the call, and do not leave anything registered with a host event or a global (AppDomain,ThreadPoolorConsolehooks included). Stop what you start, and observe the cancellation token. - Keep nothing alive after the instance is disposed.
Dispose(orDisposeAsync) must release everything the instance created: unsubscribe handlers, cancel and await its own work, close connections and clear caches that sit in static state. - Never ship
Hostpanel.Sdk.dll. The plugin must use the SDK that the host already loaded. A package that carries its own copy is refused, and a second copy of the SDK types would also tie the plugin to the old load context.
A plugin that is not unloadable still works. The host then applies the update by restarting itself, and the administrator can use Restart now for a change that was not applied. The cases that always need a restart (a plugin id that was never loaded, a hosted plugin, a changed plugin type or endpoints capability, a drain that timed out) are listed in Applying a plugin change without a shell.
Folder layout inside the ZIP:
plugin.json ← at the root
MyCompany.Hostpanel.Plugins.MyGateway.dll ← your assembly
plugin.sig ← signature file (required on production servers)
Assembly naming. The prefix Innovayse.Hostpanel. belongs to the host, so a package carrying a DLL under it is refused. The one exception is the plugin namespace Innovayse.Hostpanel.Plugins.<Name> (for example Innovayse.Hostpanel.Plugins.Stripe.dll), which is how official plugins are named and is always allowed in a package. The dot after Plugins is the boundary: Innovayse.Hostpanel.PluginsX.dll and Innovayse.Hostpanel.Plugins.dll are still host names and are refused. No host assembly is ever named under the plugin namespace (an architecture test guards it), so a plugin can never shadow one. Third-party plugins keep their own prefix, such as MyCompany.MyGateway.
Do not include the SDK assembly (Hostpanel.Sdk.dll) or any assembly the host already provides. The server refuses packages that contain a host assembly (PLUGIN_HOST_ASSEMBLY_REFUSED). Give your assemblies names no other plugin uses: a package is also refused (PLUGIN_ASSEMBLY_CONFLICT) when one of its DLL or EXE file names, compared without regard to case, is already shipped by another installed or staged plugin, because the loader would bind both plugins to one copy. The rule covers every DLL in the package, shared third-party libraries included (a JSON or HTTP library two plugins both ship counts): if another installed plugin already ships a library of that name, pick a different assembly name or merge the library into your own assembly. Upgrading the same plugin id never conflicts with itself. A duplicate plugin id is skipped at startup without error, the first loaded version wins (built-in plugins load before uploaded ones).
Packages loaded from outside the Development and Testing environments must be signed. To skip signature checks, open Plugins in the admin panel, choose the Settings tab and switch on Allow unsigned plugins. The PluginSigner tool is part of the Hostpanel repository (backend/tools/Innovayse.Hostpanel.PluginSigner), not the SDK. Run it on the unpacked folder before zipping. The tool uses Hostpanel.Sdk.Packaging (3.1.0) for the signature format, so the signature it writes is checked by the same code the host installs with, and your pipeline can call PluginSigner and PluginSignatureValidator from that package to verify a signed folder before release.
Generate a key pair. The key file is a base64-encoded private key; store it outside any git working tree (the tool refuses to sign if the key file is inside one):
dotnet run --project backend/tools/Innovayse.Hostpanel.PluginSigner -- keygen my-key.keySign the plugin folder:
dotnet run --project backend/tools/Innovayse.Hostpanel.PluginSigner -- sign ./MyCompany.Hostpanel.Plugins.MyGateway my-key.key my-key-idThis writes plugin.sig into the folder. Zip the folder after signing.
The operator must add the matching public key to PluginSigning:OperatorKeys in their deployment environment, or the package will be refused with PLUGIN_SIGNATURE_KEY_UNKNOWN. When you update a plugin, re-sign the new folder before re-zipping, updating re-checks the signature and the server will refuse a stale or missing plugin.sig.
Write unit tests for your gateway against a stubbed HTTP client, so no test needs the real payment provider.
For a manual end-to-end test:
Start a local Hostpanel stack (see Local development).
Build your class library in Release, sign the output folder with PluginSigner, zip it, and upload the ZIP with the Upload plugin button on the Installed tab of the Plugins page. In Development and Testing environments unsigned packages load without any switch. On other servers, open Plugins in the admin panel, choose the Settings tab and switch on Allow unsigned plugins to skip signature verification.
Restart the server from the "Restart required" banner.
Go to Integrations, find your plugin card, click Configure →, enter the test credentials, save and enable.
Create a test client, raise an invoice, and pay it. Verify the payment appears in Gateway Transaction Log. If signature verification fails, the upload is rejected with PLUGIN_UNSIGNED.
Use semantic versioning (major.minor.patch). Include a changelog so operators know what changed. Operators install via the Plugin Manager by uploading the ZIP.