Printcart logo

Webhooks

Printcart webhooks push an HTTP POST to your callback URL whenever a product, side, design, template or project changes, so an integration does not have to poll the API. This page covers the available topics and events, the exact payload shape, and how to verify the HMAC-SHA256 Signature header before trusting a delivery.

Updated . Maintained by the Printcart team.

Overview

Webhook subscriptions notify your app when something changes in a store, so you do not have to poll the API. After you subscribe to a topic, Printcart sends an HTTP POST to your callback URL whenever a matching event occurs. Creating, listing and removing subscriptions is done with the /webhooks endpoints in the API reference.

Topics and events

One subscription covers one topic and one event.

TopicResource
productsProduct
sidesSide
designsDesign
templatesTemplate
projectsProject (order)
userUser

Events: POST, PUT, DELETE, POST BATCH, PUT BATCH and DELETE BATCH.

The subscription object

PropertyDescription
idUnique identifier of the subscription
callback_urlDestination URL that receives the POST request when the event occurs
topicTopic of the subscription
eventEvent that triggers the webhook
created_atWhen the subscription was created
updated_atWhen the subscription was last updated

Payload

The request body wraps the resource exactly as the API returned it for the triggering request. The outer data is added by the delivery job.

json
{
  "data": {
    "data": {
      "id": "4419934f-8e1b-4cf0-b432-01ef9258a812",
      "name": "project example",
      "status": "processing",
      "note": "project example note",
      "created_at": "2021-11-16T08:26:30.000000Z",
      "updated_at": "2021-11-16T08:26:30.000000Z"
    },
    "message": "Created successfully"
  }
}

Batch events carry a list of resources in the inner data. The shape of each resource matches the corresponding schema in the API reference.

Verify the signature

Every delivery carries a Signature header. Verify it before you trust the request.

  • Header: Signature
  • Algorithm: HMAC-SHA256 of the raw request body, hex encoded
  • Key: base64(sid:secret), the same string you put after Basic in an Authorization header

Compute the HMAC over the raw body, not over parsed JSON, and compare with a constant-time function.

js
import crypto from 'node:crypto'

export function isValidSignature(rawBody, signatureHeader, sid, secret) {
  const key = Buffer.from(`${sid}:${secret}`).toString('base64')
  const expected = crypto.createHmac('sha256', key).update(rawBody).digest('hex')

  return (
    expected.length === signatureHeader.length &&
    crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signatureHeader))
  )
}

Keep the store sid and secret on your server and never publish them.

Delivery behaviour

  • A failed delivery is retried up to 3 times with exponential backoff, and each attempt times out after 3 seconds. Respond quickly and process the event asynchronously.
  • There is no delivery log and no replay endpoint. If your receiver was down, reconcile by listing the affected resources through the API.
  • Webhooks are sent from the production environment only, so test your receiver against a production test store.

Questions & answers

How do I verify a webhook really came from Printcart?

Every delivery carries a Signature header: HMAC-SHA256 of the raw request body, keyed with base64(sid:secret). Compute it over the raw body, not parsed JSON, and compare with a constant-time function.

What happens if my endpoint is down when an event fires?

A failed delivery is retried up to 3 times with exponential backoff. There is no delivery log or replay endpoint, so reconcile by listing the affected resources through the API afterward.

Which resources can I subscribe to?

Products, sides, designs, templates, projects (orders) and the user, each with POST, PUT, DELETE and their batch equivalents as separate events.

Can you work with a merchant in my country?

Yes. Printcart services are delivered remotely, so we work with merchants in any country. Netbase JSC, the company behind Printcart, has worked with clients in 80+ countries.

Do you support my industry?

Printcart services are not tied to one industry. Full stores, custom development, integration and support are delivered remotely; tell us what you sell and we will say plainly whether Printcart fits.

How do I pay securely?

You sign the contract with and pay the company, Netbase JSC. App plans are billed through Shopify or Wix for stores on those platforms, and through PayPal for WooCommerce and direct stores. Full-store orders on solution.printcart.com check out through PayPal. Service work is quoted in writing in your Helpdesk ticket before any payment.

Who do I talk to?

Talk to our CEO, Huy Nguyen (David), on WhatsApp at https://wa.me/84937869689 or by email at support@printcart.com.

Sources: RFC 2104 — HMAC: Keyed-Hashing for Message Authentication · OpenAPI Specification 3.1