Integration spec
Embed the designer. Keep your cart and your prices.
This is the reference for a patch maker or shop that puts the AI patch designer on its own pages. It lists every setting, script attribute and event field, and the typical way a Shopify store connects it to its own cart. The basic install is on the installation guide; the script loader and SDK are on the SDK page.
How it works
Your customer designs a patch with the AI on your page. When they press Get It Made, one of two things happens, depending on one account setting:
| Checkout mode | What Get It Made does | Who prices and charges |
|---|---|---|
| quote (default) | Opens the quote form. The request is emailed to your quote address, and the customer gets a confirmation. | You, by email, after the quote. |
| host | Opens no form. The designer sends the design and its choices to your page as the order_intent event. | Your store, from your own variants and your cart. We send no price. |
Host mode is part of the Scale plan. It is how DTF Virginia runs its Shopify pages.
Typical setup (Shopify)
- Sign up as a manufacturer and note your client key (it starts with mfr-), shown in the dashboard under your embed snippet.
- Dashboard, Settings: set your patch types, your backings, and (optional) hide prices so the designer shows none. Set your quote email as the fallback.
- On the Scale plan, tick Take the order in my own cart under "Where your quotes go".
- Add the script tag to each product page (one type per page, below). On Shopify, paste it into a Custom Liquid block or the theme file.
- Add the listener below to the theme. It maps the event to one of your variants and adds it to the cart.
- Set your prices in Shopify: one variant per type and size, with quantity breaks. We never see them.
- Place a test order. The design file link and its choices are on the cart line and on the Shopify order.
<script src="https://patchdesign.ai/embed.js"
data-client="mfr-yourshop-com-1a2b"
data-target="#patch-designer"
data-patch-type="uv-leatherette"
async defer></script>
<div id="patch-designer"></div>Account settings
Set in the partner dashboard. Settings marked manufacturer apply only to mfr- keys.
| Setting | Values | What it does |
|---|---|---|
| checkoutMode | quote | host | Manufacturer, Scale and up for host. quote opens the quote form. host sends the order_intent event instead. A plan that loses Scale goes back to quote. |
| hidePricing | true | false | Manufacturer, any plan. Lead-only mode: the designer shows no price and the quote confirmation prints none. Use it when your store does the pricing. |
| enabledPatchTypes | list of type ids | Which types appear. Empty means every type. A page can narrow this list with data-patch-type, never widen it. |
| pricingOverrides | price table | Your own prices per type, size and quantity, shown in the designer when prices are not hidden. |
| customPatchTypes | list | Your own named types, priced from your table. |
| enabledBackings | per type | Which backings each type offers. |
| enabledUvFinishes | list | Which UV base finishes you stock. Empty means every finish. |
| quoteEmail | up to 5 addresses | Where quote requests go. Blank uses your sign-up email. Not used by host mode. |
| leadRoutes | rules | Pro and up. Sends each quote to a person by patch type, region or size. |
| safetyDailyLimit / safetyMonthlyLimit | whole numbers | Your own cap on designs a day and a month. Default 100 and 2,000. You can only lower the plan limit, not raise it. |
| brand and look | colors, logo, text | Name, logo, colors, greeting and example prompts. The embed carries your brand, not ours. |
Script attributes
On the embed.js script tag. Only data-client is required.
| Attribute | Default | What it does |
|---|---|---|
| data-client | none (required) | Your client key. |
| data-target | after the script tag | A CSS selector for the element to mount the designer in. |
| data-height | auto | auto grows with the content, or a fixed number of pixels such as 720. |
| data-min-height | 640 | Minimum height in pixels. |
| data-max-height | 4000 | Maximum height in pixels when height is auto. |
| data-theme | your brand | light or dark. A hint only; your branding still applies. |
| data-referrer | none | A short label for the placement, such as product_page. |
| data-patch-type | all enabled types | Locks this page to one type id, or a comma list. It narrows your enabled types and can never add one. Up to 3 locked pages on each plan below Custom; unlimited on Custom. |
The pinned SDK script (patch-designer.sdk.v1.x.js) is a separate way to embed. A version you pin keeps the code it shipped with, so new attributes and events arrive in the next SDK version. The iframe loader above gets them at once. From v1.5.8 the SDK also reads the page lock: put patch-types="uv-leatherette" on the <patch-designer> tag, with the same rules and the same 3-page limit as data-patch-type. Host checkout works in the SDK too: the same patchdesign:order_intent event is dispatched on window, so the listener above works unchanged.
Events
The loader fires these on window and document. Read the payload from event.detail.
| Event | When | Payload |
|---|---|---|
| patchdesign:view | The designer finished loading. | clientKey |
| patchdesign:generation | The customer generated a design. | clientKey and details of the generation. No prompt text. |
| patchdesign:quote_submitted | The customer sent a quote (quote mode). | clientKey, patchType, quantity |
| patchdesign:order_intent | The customer pressed Get It Made (host mode). | The fields in the next section. |
The order_intent event, field by field
Sent once per press. Sizes are always in inches. The event never carries a price.
| Field | Type | Meaning |
|---|---|---|
| type | string | Always patchdesign:order_intent. |
| v | number | The version of this payload. Currently 1. New fields are added without changing v; a change that breaks a field changes v. |
| clientKey | string | Your key, so a page with two designers can tell them apart. |
| designId | string | The id of this design in the chat. Quote it in support requests. |
| designName | string | The customer's own description of the design, up to 300 characters. |
| imageUrl | string (https) | The clean design as a PNG with a transparent background. A public link. See Design files. |
| patchType | string | A type id from the list below, or one of your own custom types. |
| material | string | The type's display name, such as UV Printed - Leatherette. |
| width, height | number | The chosen size in inches. height equals width when the design is square. |
| unit | string | Always in. |
| quantity | number | How many patches the customer chose. Null when none was chosen. |
| backing | string | The chosen backing label, such as Iron-on. Empty when none was chosen. |
| uv | object or null | UV orders only: base (leatherette, tpu or acrylic), finish (the color or finish name) and tpuColor. |
| comments | string | The customer's notes, up to 1,000 characters. |
| customValues | object | Answers to the custom questions you set in your dashboard, keyed by question. |
| sessionId | string | Our id for the design session. Useful when you ask us about a design. |
| orderRef | string | Your own quote number for this press (for example ICS-1042), also printed on the production files we email you. Empty if we could not record the order; the event is still sent. |
Patch type ids
| Id | Type |
|---|---|
| embroidered | Embroidered |
| woven | Woven |
| chenille | Chenille |
| printed | Printed (sublimation) |
| leather | Leather |
| pvc-2d | PVC, flat |
| pvc-3d | PVC, raised |
| uv-leatherette | UV printed, leatherette base |
| uv-tpu | UV printed, TPU base |
| uv-acrylic | UV printed, acrylic base |
A custom type you define in your dashboard has its own id, which is what the event reports for it.
Shopify: the cart code
The pattern below is what we hand a Shopify shop. Keep one variant per type and size, with quantity breaks as a Shopify price rule or a theme-side tier table. The listener maps the event to that variant and adds it to the cart. The cart then shows your price, and your checkout takes the payment.
// Theme code on the product page. Check the origin, never trust a price.
window.addEventListener('patchdesign:order_intent', async (e) => {
const o = e.detail // the order_intent fields below
const variantId = VARIANTS[o.patchType]?.[sizeKey(o.width, o.height)]
if (!variantId) return showMessage('That size is not available.')
await fetch('/cart/add.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
items: [{
id: variantId,
quantity: o.quantity, // a quantity-break price rule prices it
properties: {
'Design file': o.imageUrl,
'Design ID': o.designId,
'Order ref': o.orderRef,
'Size (in)': o.width + ' x ' + o.height,
'Backing': o.backing,
'Finish': o.uv ? o.uv.finish : '',
},
}],
}),
})
window.location.href = '/cart'
})- VARIANTS and sizeKey are yours: a table from type id and size to a Shopify variant id. Round the size to the sizes you sell.
- Line-item properties carry the design file and the choices to the order, where your team reads them.
- Price comes from the variant. A property is text the customer can edit in the browser, so never price from one.
- With no listener on the page, nothing visible happens when the customer presses Get It Made. Test the cart on a staging theme first.
Design files
| File | Where it comes from | Notes |
|---|---|---|
| imageUrl | The order_intent event. | The design as generated, a PNG with a transparent background at the generator's size (about 1,000 pixels). Good for the cart and for review. Copy it to your own storage when the order is placed. |
| 300 dpi print PNG, print PDF, vector (SVG, PDF, EPS), cut lines (SVG, PDF, DXF), UV specs and white underbase, production sheet, job sheet, ZIP | The production package we build when the customer presses Get It Made (host mode) or sends a quote (quote mode), and email to your quote address. | Built at the ordered size, titled with your orderRef. Download links last one year. Which files each channel receives is set in your dashboard. |
We do not promise a storage period for a design, so copy what you need when the order comes in. In host mode the package is built when the customer presses the button, not when your store takes payment, so an abandoned cart also produces one. Each build counts against a monthly build allowance that matches your plan. Match a package to a Shopify order by orderRef, which you add to the cart line.
Plans and limits
| Plan | Designs a month | Includes |
|---|---|---|
| Free | 20 | The embed, your branding, quotes to your inbox. |
| Starter | 200 | The above. |
| Pro | 1,000 | Spanish and German, lead routing rules. |
| Scale | 2,000 | Host checkout, the partner API and webhooks, the currency picker, brand guidelines. |
| Custom (Enterprise) | No plan limit | Everything in Scale, a fixed color list per type, and any number of type-locked pages. |
Every image the AI makes counts as one design, edits included. Your own safety limits (100 a day, 2,000 a month by default) can only lower these.
Security checklist
- Accept the event only from the designer: the iframe loader already checks that a message comes from patchdesign.ai before it fires the page event. If you listen to message directly, check event.origin yourself.
- Price from your variants, never from the payload or a cart property.
- Treat imageUrl as a public link. Do not put anything private in a design.
- Keep your client key in the page as it is: it identifies the account and cannot be used to read your data.
Questions, or a platform other than Shopify? Contact us.