---
name: checkout-complete
description: Complete a purchase order in DemoShop. Use when the user has items in the cart and wants to finalize the purchase by providing their name, email, and address.
version: 1.0.0
license: MIT
homepage: https://demoshop-88e.pages.dev
---

# checkout-complete

Finalize a DemoShop purchase.

## When to use

- The user says "comprar", "finalizar pedido", "checkout", "pagar".
- The user has already added items to the cart or wants to complete a purchase directly.

Do NOT use this skill if the user is just browsing or adding to cart — those are separate skills.

## Base URL

```
https://demoshop-88e.pages.dev
```

## Endpoint

### POST /api/checkout

Creates an order and returns an order ID.

## Request body (JSON)

| Field | Type | Required | Description |
|---|---|---|---|
| `customer_name` | string | Yes | Full name of the buyer |
| `email` | string | Yes | Valid email address |
| `address` | string | Yes | Full shipping address |

## Example

```python
import urllib.request, json

url = "https://demoshop-88e.pages.dev/api/checkout"
payload = json.dumps({
    "customer_name": "Juan Perez",
    "email": "juan@example.com",
    "address": "Calle Falsa 123, Ciudad, CP 01000"
}).encode("utf-8")
req = urllib.request.Request(url, data=payload, headers={
    "Content-Type": "application/json",
    "Accept": "application/json",
}, method="POST")
with urllib.request.urlopen(req, timeout=15) as resp:
    data = json.loads(resp.read().decode("utf-8"))
    print(f"Pedido confirmado: {data['order_id']}")
    print(f"Entrega estimada: {data['estimated_delivery']}")
```

## Output the agent should produce

After successful checkout, report to the user:

```
Pedido confirmado: ORD-ABC123
Entrega estimada: 3-5 dias habiles
```

If the user has not provided name/email/address, ask for them before calling the endpoint.

## Failure modes

- `400`: Missing required fields. Ask the user for the missing info.
- `405`: Wrong HTTP method. Always use POST.

