Embeds · Guide
Chargeback protection
<provenance-chargeback-protection> shows your store's Chargeback protection view to your staff inside your own admin tool, read only. It shows the same records and words as Authorize › Chargeback protection in the console: "Protection used, $X of $Y" over the last 6 months with a meter, orders protected, disputed and proof sent, and the tabs Protected, Disputed and Not protected. Each order is one line: its status, the order, why it is or isn't protected, the amount and the date.
If your account has no program, the element says "Chargeback protection isn't on for this account." and opens on Not protected. That tab lists your own agent orders that would not qualify, with why. It never shows sample rows.
Before you begin: a publishable key (see embeds) and a secret key with the authorize scope. The embed needs Pro or the Free trial in live, and works on any plan in sandbox.
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
1. Mint a session on your server
Your server mints a short session with POST / and widget: "chargeback_protection". The session is scoped to your account, so it needs nothing else. Put it behind a route your admin page calls, after your own sign-in check:
curl -s -X POST $PROVENANCE_API/v1/embed/tokens \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "widget": "chargeback_protection", "ttl": 900 }'
// GET /admin/provenance/session?widget=chargeback_protection (your route, behind your staff sign-in)
const session = await prov.embed.createToken({ widget: "chargeback_protection", ttl: 900 });
res.json({ token: session.embedToken });
token = prov.embed.create_token(widget="chargeback_protection", ttl=900)["embed_token"]
A key without the authorize scope gets 403 insufficient_scope.
2. Drop the element in your page
<script type="module" src="https://unpkg.com/@provenance/embed"></script>
<provenance-chargeback-protection base-url="https://sandbox-api.provenanceauth.com" publishable-key="prv_pub_1D10TzJo8F73Z7ZHhWGKPpn0K7suJ0se"
docs-url="https://provenanceauth.com/docs"></provenance-chargeback-protection>
<script>
const view = document.querySelector("provenance-chargeback-protection");
view.getToken = async () => (await (await fetch("/admin/provenance/session?widget=chargeback_protection")).json()).token;
</script>
| Attribute | What it does |
|---|---|
docs-url | Optional. The Provenance docs address for the empty state's link, https:/. Without it, the empty state has no link. |
The tabs answer clicks and the arrow keys. The element emits pv:ready and, after each read, pv:result with { kind: "chargeback_protection", on, tab }.
What it shows
The element reads GET /v1/embed/chargeback_protection: the summary of GET / without the program IDs, and one tab of GET /.
| Part | From |
|---|---|
| Protection used, $X of $Y | protection_ and protection_ over window_ (180) |
| Orders protected, Disputed, Proof sent | counts and proof |
| Each order's status | status: Protected, Disputed (a decided one reads Disputed › Won or Disputed › Lost), Not protected, Proof sent |
| Why | why, in words: for example "Approved with a passkey", "Over the order limit" or, with no program, "No passkey approval on the order" |
The element states your program's records only. It doesn't promise a payout, and the program's terms aren't published yet.
Errors you might see
| Symptom | Cause | Fix |
|---|---|---|
401 embed_ | The session expired, or it isn't a chargeback_ session for this account | Return a fresh token from getToken. |
503 embed_ | The records couldn't be read | The element shows nothing in their place. Retry shortly. |
See also
- Chargeback responses: the view in the console.
- Admin results and requests: sessions, events and styling for every admin element.