# TestBlockonomics

> WooCommerce store, prices in USD. AI agents can browse, check out and pay in crypto (btc, usdt) entirely through JSON APIs. Prefer these over driving the website UI.

## Agent checkout

No API key needed. Send `Content-Type: application/json` on POSTs.

1. Find products: `GET https://wordpress.testblockonomics.com/de/wp-json/wc/store/v1/products?search=<term>` (also `?slug=`, `?category=`, `?per_page=`). Use the product `id`.
2. Start a cart: `GET https://wordpress.testblockonomics.com/de/wp-json/wc/store/v1/cart`. Save the `Cart-Token` response header and send it back as a `Cart-Token` request header on every later call (no nonce needed then).
3. Add items: `POST https://wordpress.testblockonomics.com/de/wp-json/wc/store/v1/cart/add-item` with `{"id": <product id>, "quantity": 1}`. Variable products also need `"variation"`.
4. Check out: `POST https://wordpress.testblockonomics.com/de/wp-json/wc/store/v1/checkout` with:

   ```json
   {"payment_method":"blockonomics","payment_data":[{"key":"crypto","value":"btc"}],"billing_address":{"first_name":"Jane","last_name":"Doe","email":"jane@example.com","address_1":"1 Main St","city":"Springfield","state":"IL","postcode":"62701","country":"US"}}
   ```

   `crypto` is one of: btc, usdt. `GET https://wordpress.testblockonomics.com/de/wp-json/wc/store/v1/cart` lists required address fields for the shipping country.
5. Pay: the response `payment_result.payment_details` (key/value list) has `address`, `amount`, `payment_uri` (BTC), `expires_at` and `order_hash`. Send exactly `amount` to `address` before `expires_at`.
6. USDT only: after sending, `POST https://wordpress.testblockonomics.com/de/wp-json/blockonomics/v1/orders/{order_hash}/txhash` with `{"txhash": "0x..."}`. Unregistered USDT transfers are not detected.
7. Status: `GET https://wordpress.testblockonomics.com/de/wp-json/blockonomics/v1/orders/{order_hash}?crypto=<crypto>` returns `payment_status` (`awaiting_payment`, `detected`, `confirmed`, `underpaid`). Calling it after `expires_at` returns a fresh quote.

## Pages

- Shop: https://wordpress.testblockonomics.com/de/shop/
- Cart: https://wordpress.testblockonomics.com/de/cart/
- Checkout: https://wordpress.testblockonomics.com/de/checkout/

## Reference

- WooCommerce Store API: https://github.com/woocommerce/woocommerce/tree/trunk/plugins/woocommerce/src/StoreApi/docs