# Widget

> One script tag that walks the customer through confirm, tap and receipt.

Valet developer docs — Take a payment. Web page: https://storeypos.com/valet/docs/widget. Full reference for AI: https://storeypos.com/llms-full.txt. OpenAPI: https://storeypos.com/openapi.json.

The widget is a self-contained, shadow-DOM component — it always looks like Storey, never like your site, and needs no styling from you. Open it with a session token before charging the card; it walks the customer through confirm, tap and receipt, and reports the outcome back to your code.

The session tells the widget which kind of station it is working with. For a terminal it waits at the card machine; for a key-entry station it opens Storey's hosted payment window, where the card is typed into the payment provider's own secure field. Either way your code sees the same result. When a session carries a card difference fee, the widget shows the fee and the card price.

HTML:

```html
<script src="https://storeypos.com/valet-widget.js"></script>
<script>
  StoreyValet.open({
    token: session.token,
    onComplete: (result) => { /* result.status: "approved" | "declined" */ },
    onCancel: () => {},
  });
</script>
```

Create the session on your server first ([Hosted payment window](https://storeypos.com/valet/docs/hosted-window)), then pass its token to the page.

---

Previous: [Hosted payment window (session)](https://storeypos.com/valet/docs/hosted-window.md)
Next: [Refund](https://storeypos.com/valet/docs/refund.md)
