View as Markdown

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 /v1/embed/tokens 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 }'

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>
AttributeWhat it does
docs-urlOptional. The Provenance docs address for the empty state's link, https://provenanceauth.com/docs. 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 /v1/authorize/chargeback_protection without the program IDs, and one tab of GET /v1/authorize/chargeback_protection/orders.

PartFrom
Protection used, $X of $Yprotection_used and protection_limit over window_days (180)
Orders protected, Disputed, Proof sentcounts and proof
Each order's statusstatus: Protected, Disputed (a decided one reads Disputed › Won or Disputed › Lost), Not protected, Proof sent
Whywhy, 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

SymptomCauseFix
401 embed_token_invalidThe session expired, or it isn't a chargeback_protection session for this accountReturn a fresh token from getToken.
503 embed_result_unavailableThe records couldn't be readThe element shows nothing in their place. Retry shortly.

See also