← Merchant API reference
Integration guide v1

Selling Do.ink products on your own website

Your website runs the shop and takes the buyer's money. Do.ink prints and ships. The Merchant API connects the two: your server reads products and prices, places an order once the buyer has paid, and Do.ink calls your server back as the order moves toward the buyer's door.

This page gives the order of calls. Each step links to the reference for the full request and response.

How the pieces talk

Four parties. The buyer never talks to Do.ink: every Do.ink call comes from your server, with your secret API key.

Sequence of calls between the buyer, your website, your payment provider and the Do.ink API BROWSE CHECKOUT FULFIL TRACK REFUND Buyer browser Your website your server Payment provider Omise, Stripe, … Do.ink API /api/v1 1 Opens your shop 2 GET /products products, variants, SKUs, images 3 Cart + shipping address 4 POST /orders/quote your cost, or a validation error 5 Create payment (your price) 6 Buyer pays 7 Webhook: payment succeeded 8 POST /orders + externalOrderNumber the order: accepted, or awaiting_payment 9 Webhook: status + tracking (signed) 10 Email tracking to the buyer 11 POST /orders/ext:{number}/cancel cancelled, or ORDER_NOT_CANCELLABLE
  • Your server calls Do.ink
  • Do.ink answers
  • Do.ink calls your server (webhook)
  • Your own site and payment flow

Step by step

Browse

  1. 1
    Opens your shop · Buyer → Your website

    The buyer only ever talks to your website. Do.ink is never called from the browser.

  2. 2
    GET /products · Your website → Do.ink API

    Sync your catalog on your server and keep each SKU. Any active variant can be ordered, whatever its product status, so show only what you mean to sell (?status=active). Reference →

Checkout

  1. 3
    Cart + shipping address · Buyer → Your website

    The buyer picks items and enters a Thai address on your checkout page.

  2. 4
    POST /orders/quote · Your website → Do.ink API

    Same items and recipient as the real order. Creates nothing, charges nothing. A bad postcode or phone fails here, before the buyer pays. Reference →

  3. 5
    Create payment (your price) · Your website → Payment provider

    You charge the buyer your own retail price with your own payment provider.

  4. 6
    Buyer pays · Buyer → Payment provider

    The buyer pays the provider. Do.ink never sees the buyer’s card.

Shipping is within Thailand only. Do.ink charges you ฿40 for the first unit and ฿10 for each extra unit, less any free-shipping promotion. The quote gives the exact amount.

Fulfil

  1. 7
    Webhook: payment succeeded · Payment provider → Your website

    Your provider tells your server the payment went through. This is the moment to place the Do.ink order.

  2. 8
    POST /orders + externalOrderNumber · Your website → Do.ink API

    Paid from your Do.ink wallet in the same call. If the wallet is short, the order is still created as awaiting_payment with a payment.payUrl, and nothing is made until you pay it. Reference →

Track

  1. 9
    Webhook: status + tracking (signed) · Do.ink API → Your website

    One signed webhook per status change: accepted, in_production, shipped (with the tracking number), delivered. Webhooks can arrive out of order, so keep the newest timestamps.updatedAt and ignore older ones. Reference →

  2. 10
    Email tracking to the buyer · Your website → Buyer

    Do.ink sends no email to the buyer of an API order. Send the tracking number from your webhook handler.

Refund

  1. 11
    POST /orders/ext:{number}/cancel · Your website → Do.ink API

    Cancel works until Do.ink queues the order for production, which can happen while its status still reads accepted. After that the order is made and shipped as normal: refunding your buyer is up to you. Reference →

Rules that keep orders safe

Take the price from the server

At checkout, look up each item’s price on your server, from your own catalog. Never charge a price the browser sent: anyone can edit it.

Reference →

Quote before you charge

Run POST /orders/quote with the real basket and address before the buyer pays, so a paid buyer never meets an address Do.ink refuses. Pass the quote’s charged.total as expectedTotal when you create the order: if the price changed in between, nothing is created.

Reference →

Create the order from the payment webhook

Place the Do.ink order when your payment provider’s “paid” webhook reaches your server, not when the buyer returns to your site. Buyers close tabs; webhooks still arrive.

Reference →

Your order ID is the idempotency key

Send your own order ID as externalOrderNumber. If the payment webhook fires twice, the second call with the same body returns the existing order instead of printing twice. The same number with a different body is refused.

Reference →

Email the buyer yourself

Do.ink does not email the buyers of API orders. Status and tracking reach you as webhooks; tell your buyer from your handler.

Reference →

Don't need your own checkout? Use Store Embed

Put your Do.ink store, or one product as a Buy Button, inside your own website. Do.ink runs the cart, the payment and the buyer emails, and no API key is needed. First register your website in Do.ink → Store → Embed (up to 5, https only). On any other website the browser blocks the frame.