All checks were successful
Build and Deploy MkDocs / build-next (push) Successful in 49s
84 lines
3.3 KiB
Markdown
84 lines
3.3 KiB
Markdown
# Overview
|
|
|
|
PostalPoint® supports JavaScript plugin extensions. Plugins can hook into PostalPoint to add features and integrations.
|
|
|
|
## What plugins can do
|
|
|
|
* Process card payments and handle saved payment methods
|
|
* Process cryptocurrency payments
|
|
* Add additional carriers, providing shipping rates and labels
|
|
* Print to label and receipt printers, letting PostalPoint handle hardware support and drivers
|
|
* Extend support for prepaid label acceptance, prepaid barcode recognition, and carrier dropoff QR codes
|
|
* Install pages in the Tools menu, creating new interfaces and features
|
|
* Receive transaction receipts for ingestion into third-party accounting or business software
|
|
* Display interactive HTML5 content on the customer-facing screen
|
|
* Run both Node.JS and browser code.
|
|
|
|
## PostalPoint DevTools and Testing Builds
|
|
|
|
The [PostalPoint build server](https://build.netsyms.net/job/PostalPoint_Retail/)
|
|
creates installers from the latest prerelease changes. It is not recommended to use these
|
|
builds for production purposes, but they contain the latest changes to plugin APIs.
|
|
|
|
For Windows developers, you'll want to download a "postalpoint-retail-sdk_x.xx.exe" installer,
|
|
as it contains the Chromium DevTools.
|
|
|
|
To enable DevTools on Linux, simply run `sudo apt install nw.js-sdk` and restart PostalPoint.
|
|
|
|
To access the DevTools, press F12 or right-click anywhere inside PostalPoint and click Inspect.
|
|
Depending on various factors, some plugin console output may go to the "background page";
|
|
right-click and click "Inspect background page" to view that console.
|
|
|
|
## Plugin Package Structure
|
|
|
|
A plugin is distributed as a simple ZIP file, containing a folder. The folder then has at least one file, named `plugin.js`.
|
|
The `exports.init` function in `plugin.js` is executed when PostalPoint launches, allowing the plugin
|
|
to request involvement with various events in PostalPoint.
|
|
|
|
PostalPoint installs plugin packages by unzipping their contents into a plugins folder.
|
|
Plugins are uninstalled by deleting their folder.
|
|
|
|
## PostalPoint Plugin API
|
|
|
|
The PostalPoint plugin API is a globally-available object named `global.apis`.
|
|
It contains many useful functions for integrating with PostalPoint.
|
|
All the APIs listed under the Plugin API section must be prefixed with `global.apis.` in order to work.
|
|
|
|
## Minimal Plugin Code
|
|
|
|
```javascript title="plugin-name/plugin.js"
|
|
exports.init = function () {
|
|
global.apis.alert("This message appears when PostalPoint launches.", "Hello!");
|
|
};
|
|
```
|
|
|
|
Yes, the smallest plugin really is just two lines of code, and accessing PostalPoint features
|
|
really is that easy.
|
|
|
|
## Plugin Metadata File
|
|
|
|
While not strictly required, a `package.json` is encouraged, and allows specifying the plugin's
|
|
display name, PostalPoint version compatibility, and other metadata.
|
|
|
|
Sample:
|
|
|
|
```json
|
|
{
|
|
"name": "plugin-id-here",
|
|
"main": "plugin.js",
|
|
"description": "Human-readable description of the plugin",
|
|
"version": "1.0.0",
|
|
"author": "Your Name",
|
|
"license": "Code license name",
|
|
"postalpoint": {
|
|
"pluginname": "Display Name for Plugin",
|
|
"minVersion": "000034",
|
|
"maxVersion": "001000"
|
|
}
|
|
}
|
|
|
|
```
|
|
|
|
PostalPoint version codes are MMMnnn where MMM is the major version and nnn is the minor version, zero-padded.
|
|
So version 0.35 is "000035", and 1.23 is "001023".
|