跳到正文
DEV Community· Alex·· 42 分鐘前AI 評分48

eSIM 結帳與付費 OCR 呼叫帶來的智能體支付啟示

What an eSIM checkout and a paid OCR call taught us about agent payments

AI 導讀

ModelMarket 於 11 月 26 日在目錄加入 Tutu 日本 eSIM 方案及 HALOWERK OCR 服務,展示兩種智能體支付流程。Tutu 提供價格和結帳連結,報價為 $3.49;HALOWERK 則按 PDF 提供付款要求,買家簽署後重試,費用為 0.006 USDC。兩筆 OCR 測試均完成結算,ModelMarket 以交易雜湊記錄成功交付。

正文

A traveller who asks for a week of mobile data in Japan needs a plan and somewhere to buy it. An agent that has a scanned PDF already has the input and needs a result it can use in the same workflow. On November 26, we put one offer of each kind in the ModelMarket catalogue, with the supplier collecting the payment in both cases.

The distinction shows up in the response the agent gets. Tutu returns a price and a checkout URL. HALOWERK returns a payment challenge for the exact PDF, then accepts a signed retry. Here is where the price, attribution and proof of delivery sit in each flow.

Two flows. Tutu supplies a tagged checkout link for a human buyer. HALOWERK quotes a PDF with HTTP 402, then returns OCR and a payment receipt after the buyer signs and retries.

A quote that ends in checkout

The Tutu pilot lists one Japan data plan, JP-1-7, with 1 GB for seven days. ModelMarket asks Tutu for the current price and returns a provider link carrying the plan and src=aimarket. Tutu handles payment and delivers the eSIM. The quote we checked on November 26 was $3.49.

Run this from a shell with curl and Python 3. It requests the current quote and prints the buy link.

curl -fsS https://modelmarket.dev/ai-market/v2/external-services/tutu-esim/quote \
  | python3 -c 'import json,sys; q=json.load(sys.stdin); print(q["plan_id"], q["price"], q["currency"]); print(q["checkout_url"])'

A quote and a checkout click are early steps in that flow. Tutu's order log is where we can learn how many tagged purchases went through. The Tutu check for this article stopped at the quote and handoff.

A quote tied to the bytes in a PDF

For the OCR pilot, the buyer posts one PDF to ModelMarket. The Hub forwards the body to HALOWERK, sets X-HALOWERK-QUELLE: modelmarket and relays the seller's Payment-Required header. The quote includes the SHA-256 of the file, the page count, and the payment terms for this request. The buyer can inspect those terms before asking its wallet to sign.

The example below downloads the synthetic scan used in the test and reads the challenge. It requires curl and Python 3 and uses no wallet or credentials.

curl -fsSLO https://modelmarket.dev/blog/media/two-supplier-pilots-2026-11-26/sample.pdf

python3 - <<'PY'
import base64, hashlib, json
from pathlib import Path
from urllib.error import HTTPError
from urllib.request import Request, urlopen

pdf = Path("sample.pdf").read_bytes()
body = json.dumps({
    "image_base64": base64.b64encode(pdf).decode(),
    "mime": "application/pdf",
}).encode()
endpoint = (
    "https://modelmarket.dev/ai-market/v2/external-services/"
    "halowerk-ocr/ocr"
)
request = Request(
    endpoint, data=body, headers={"Content-Type": "application/json"},
    method="POST",
)

try:
    with urlopen(request, timeout=20) as response:
        raise SystemExit(f"Expected a quote, got HTTP {response.status}")
except HTTPError as response:
    if response.code != 402:
        raise
    with response:
        quote = json.loads(base64.b64decode(
            response.headers["Payment-Required"]
        ))

assert quote["quote"]["file_sha256"] == hashlib.sha256(pdf).hexdigest()
assert quote["quote"]["pages_priced"] == [1]
offer, = quote["accepts"]
print(offer["network"], offer["amount"], "atomic units")
print(quote["quote"]["total_usdc"], "USDC")
PY

On November 26 that returned eip155:8453, 6000 atomic units, and 0.006 USDC. A buyer proceeding from here signs the quoted terms and repeats the same body with Payment-Signature. The payment goes directly to HALOWERK. ModelMarket forwards the OCR response and receipt, and records a successful paid delivery by transaction hash so a repeated receipt counts once.

Settlement and recognition answer different questions

We ran the paid flow against a local ModelMarket instance connected to the real HALOWERK endpoint. We received HTTP 200, verified the transfer on Base, and matched the returned document hash to the submitted scan. HALOWERK later confirmed the same request in its payment log with our attribution header. After deployment we checked the public catalogue, MCP discovery and the live unpaid quote again.

The OCR output got the reference and total right. It read the synthetic code A0B7 as AOB7, even though the returned block confidence was 0.94. This was one clean test scan, so it tells us what happened to that field on that page. In an invoice workflow I would preserve the raw OCR, then validate identifiers against their expected format or checksum before using them downstream.

For the two-week reconciliation, we're counting successful tagged orders at Tutu and successful paid, tagged OCR calls at HALOWERK. The direct OCR check and the ModelMarket OCR check both settled. We'll exclude both test calls when we compare the pilot totals.

Both offers are in the ModelMarket catalogue. The supplier references are Tutu's Japan plan and HALOWERK's OCR API.

Disclosure: we operate ModelMarket. AI assistance was used to prepare the test tooling, this article and its illustrations.

來源:DEV Community · dev.to