STACK
MENU
DOCS / THE ACCOUNT / PRINT ON DEMAND

Print on demand

How you connect your own print-on-demand supplier account, how an agent orders a printed product through it, and how you approve the order. What the service is and what it costs is on Services.

Before you start

  • You need your own account at the supplier: Gelato, Prodigi, Printful or Lulu. The supplier charges that account. STACK never pays a supplier.
  • The agent needs an open account and its Passport.

Connect your supplier account

Only the owner or an admin can connect a supplier. The key is entered in the terminal and never passes through a chat, so there is no tool for this step:

bash
# The key is read from a hidden prompt.
npx @getstackrun/cli account making-connect-supplier gelato

# Printful can also connect by signing in at Printful.
npx @getstackrun/cli account making-connect-printful

# See which suppliers are connected.
npx @getstackrun/cli account making-suppliers

Lulu needs a key and a secret. From code: stack.accounts.making.connectSupplier('gelato', { api_key }). The key is encrypted and never shown again. account making-disconnect-supplier removes it.

Quote and order

The agent uploads the artwork as a design, as in Parts, then quotes and orders. A printed product names the supplier and the supplier's own product id:

typescript
const { quotes } = await stack.accounts.making.quote('acct_123', {
  design_id: design.id,
  supplier: 'gelato',
  spec: { quantity: 1, product: '<the supplier product id>' },
  recipient: {
    name: 'Anna Berg', email: 'anna@example.com', phone: '+4915112345678',
    address1: '1 Main St', city: 'Berlin', postal_code: '10115', country: 'DE',
  },
}, { passportToken });

const order = await stack.accounts.making.order('acct_123', quotes[0].id, { passportToken });
// order.state: 'placed', or 'awaiting_approval' when the order waits for you

The tools are stack_quote_making and stack_order_making. Product ids come from the supplier's own catalogue. Quote and order are one action each.

Approve the order

A new account trusts its agents, so an order through your own supplier account is placed at once. The trust setting is trust_agents or ask_first, for the account or for one agent, and an agent's own setting comes first. Read it with stack_get_trust and change it with stack_set_trust. On ask_first, an order is held until one of these lets it through:

  • The agent's Mission has an allowance for orders with enough left. Set one with stack_set_mission_making_allowance, or mission making-allowance <id> --cents N.
  • You approve it. In an AI client, stack_place_making_order asks you to confirm in the chat, naming the supplier, product, quantity, destination and amount. From the terminal: account making <id> approve <order-id>.

stack_reject_making_order declines a held order. Approving, rejecting and cancelling are free. A held order lapses when its quote ends, or after 90 days when the quote names no end.

The order amount is reserved against the agent's budget while it waits, and given back if the order is rejected, cancelled or lapses.

When it is refused

  • 409 MAKING_SUPPLIER_ACCOUNT_REQUIRED - the supplier account is not connected.
  • 422 MAKING_SUPPLIER_REJECTED - the supplier refused the product, the specification or the file.
  • 409 MAKING_QUOTE_EXPIRED - the quote has lapsed. Quote again.
  • 403 GOVERNANCE_APPROVAL_REQUIRED - approving a held order with a key needs a person to confirm it. The answer carries the approval link.
  • 409 MAKING_ORDER_STATE - the order is not waiting for approval, or it has lapsed.
  • 403 CONTROL_DENIED - with controls on, your policy or your own server refused it. Controls are asked as making.quote and making.order.

Reference

Every field is on Making. Every tool is in the tool reference.

Print on demand | Docs