**Kind**: static method of [<code>shipping</code>](#shipping)
**Returns**: <code>Object</code> - Data about the ZIP code. See example. Fields may be empty if not available. Type may be "STANDARD", "UNIQUE", "PO BOX", or "MILITARY".
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| zipcode | <code>string</code> | | ZIP or postal code. |
| country | <code>string</code> | <code>"US"</code> | Currently only "US" and "CA" are supported. |
Register the plugin as a shipping rate and label provider. See the Shipping example plugin.
**Kind**: static method of [<code>shipping</code>](#shipping)
| Param | Type | Description |
| --- | --- | --- |
| getRates | <code>function</code> | A function passed a Parcel object to get rates for. Returns a Promise that resolves to an array of rate objects. |
| purchase | <code>function</code> | A function passed a rate ID to purchase. Returns a Promise that resolves to the label information. |
| idPrefix | <code>string</code> | A unique string that will be prefixing all rate IDs from this plugin. |
Register the plugin to modify PostalPoint's shipping markup calculation during shipment rating.
**Kind**: static method of [<code>shipping</code>](#shipping)
**Throws**:
-<code>Error</code> Only one plugin may register with this function;
any subsequent attempts to register will throw an Error.
| Param | Type | Description |
| --- | --- | --- |
| markupFn | <code>function</code> | A function that must return either the retail price to charge for this rate, or `false` to opt-out of setting this particular rate. |
**Kind**: static method of [<code>shipping</code>](#shipping)
| Param | Type | Description |
| --- | --- | --- |
| id | <code>string</code> \| <code>null</code> | Unique ID for the provider. Will be autogenerated if null. |
| name | <code>string</code> | Human-readable name for the provider. Shown as the card heading on the Insurance section of the Ship screen. |
| cardText | <code>string</code> | Text or HTML to display on the Ship screen card for this provider. |
| maxValue | <code>number</code> | The largest number that will be accepted for the "Insured for" value. |
| getQuote | <code>function</code> | Returns the cost and retail price for insuring the parcel, or a Promise that resolves into the same. See the example for details. |
| insure | <code>function</code> | Insure the parcel and add the insurance details to the receipt. See example. |
**Example**
```js
async function getQuote(value, parcel, carrier, service) {
// Do math, etc
var cost = value / 100;
return {
cost: cost,
retail: cost * 2
};
// Or, to remove this shipping rate from the list,
// because the shipment/carrier/service combination
// is not eligible for insurance:
return false;
}
async function insure(value, parcel, carrier = "USPS", service = "Priority", trackingNumber = "94055...") {
// Purchase the insurance
var cost = value / 100;
var retailPrice = cost * 2;
var costPrice = cost;
var receiptitem = new global.apis.pos.ReceiptItem(`sampleinsurance_${trackingNumber}`,
"Sample Insurance",
"Insured for " + global.apis.i18n.moneyString(value),
retailPrice, 1, costPrice, 0
);
receiptitem.merch = true;
receiptitem.category = "Shipping Insurance";
receiptitem.barcode = trackingNumber;
global.apis.pos.addReceiptItem(receiptitem);
}
global.apis.shipping.registerInsuranceProvider(
"sampleproviderid", "Sample Insurance",
"Insurance coverage from Sample Insurance. $1 per $100 of value.",