create_tcgplayer_order
Creates a TCGplayer order from email data, matching line items to cards by exact name, and syncs corresponding inventory listings with deduplication safeguards for retries and manual sales.
Instructions
Create a TCGplayer order and its line items, matching each line item to a card by exact name (foil printings are matched literally, e.g. "Sinterfee (Foil)" — do not strip "(Foil)" from card_name_raw). Also creates a matching "active" listing in tcgplayer_listings (same shape the dashboard's manual "create listing" flow produces: quantity_listed bumped, no sold_price/fee/cost_basis/net_profit/quantity_owned changes yet) — even though the order email means TCGplayer already has a committed buyer, these are booked as placeholders on file and finalized later through the existing chat-based "mark sold" flow once the packing slip is printed and the order actually ships. Safe to re-run: if order_number already exists, its line items are never (re-)created, and its listing/inventory sync is only (re-)attempted if it never completed the first time (e.g. a prior call errored or timed out after the order was recorded but before the listing was synced) — so a retry after a failed call finishes the sync instead of silently no-oping. Also guards against duplicating a sale that was already recorded manually: if any of this order's cards has a manually-created tcgplayer_listings row (not one this tool made) within 3 days of the order date, listing creation is skipped (the order/items are still recorded) and the response says which existing listing to check. Two auto-created listings for the same card from different orders are never treated as duplicates — each has its own order_number, so they're genuinely separate sales.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | Line items parsed from the order email. | |
| ship_by | No | Ship-by date, YYYY-MM-DD. | |
| ordered_at | No | ISO timestamp of when the order was placed. | |
| order_total | No | Aggregate order total from the email. | |
| order_number | Yes | e.g. F0DFDDC3-1965A5-DEF21 | |
| gmail_message_id | No | ||
| manage_order_url | No |