Authorize · Guide
Show the full cart
When an agent shops for someone, the person approves the order on a Provenance page before the agent can pay. A rich cart (binding v2) shows them what they're buying: each item's size or color, a picture, shipping, tax and discounts, the delivery estimate and your return policy. Everything you send is bound into the token, so the approval covers exactly what the person saw.
Before you begin: read verify agent checkouts. This guide adds fields to the same checkoutBinding(order).
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
- Your cartitems, adjustments, delivery
- checkoutBindingchecks the totals
- Approval pageshows the whole cart
- Tokenbinds its canonical hash
1. Add the rich fields to your order
The fields are optional, and a cart without them keeps its hash.
| Field | What it holds |
|---|---|
items[]. | Up to 3 { name, value } pairs, such as Size: M |
items[]. | A picture of the item: https, on your store's origin |
items[]. | The item's page: https, on your store's origin. The approval page links the item to it in a new tab. It isn't part of the signed cart, so it never changes the hash |
adjustments | Up to 10 { kind, label, amount } lines. kind is shipping, tax, discount or fee; discounts are negative |
fulfillment | { method_, with dates as YYYY-MM-DD |
return_ | Your return policy: https, on your store's origin |
import { checkoutBinding } from "@provenanceauth/rails/checkout";
const order = {
order_id: "ord_8812",
total: 4250,
currency: "USD",
merchant_id: "harborbean",
origin: "https://harborbean.example",
items: [
{ sku: "mug-sage", name: "Stoneware mug", quantity: 2, unit_amount: 1900,
variant: [{ name: "Color", value: "Sage" }], image_url: "https://harborbean.example/img/mug-sage.png" },
],
adjustments: [
{ kind: "shipping", label: "Standard shipping", amount: 650 },
{ kind: "discount", label: "WELCOME", amount: -200 },
],
fulfillment: { method_label: "Standard shipping", estimate_from: "2026-11-02", estimate_to: "2026-11-05" },
return_policy_url: "https://harborbean.example/returns",
};
const binding = checkoutBinding(order); // binding_version: 2
With any rich field present, checkoutBinding refuses a cart whose lines and adjustments don't add up to total (CartTotalsMismatchError), a picture or policy on another origin, more than 20 lines or more than 10 adjustments. A cart without them keeps the rules it had.
Declare your MCC and country
Add merchant: { mcc, country } to say what your store is, as a 3-D Secure authentication request does: mcc is your acquirer-assigned merchant category code (four digits, "7011") and country your ISO 3166-1 numeric code (three digits, "620" for Portugal). A cart with merchant binds as binding_version: 3, and both values are inside its hash, so the token, the approval page and the receipt carry what you stated.
An agent's grant that limits kinds of store or countries, or blocks some, is checked against them (kinds of merchant and countries); a cart without them can't show it is allowed, so the person is asked. The approval page shows them as declared. The Python (provenanceauth_identify.checkout_binding) and Go (CheckoutBinding) helpers hash a v3 cart the same way.
State the dates of a service
Add service_period: { start, end } to a line that buys a stay, a flight or a rental: each a date ("2027-03-12") or a date-time with an offset ("2027-03-12T15:00:00+00:00"), in the place's own local time. For a stay, end is the check-out date. A cart with a service_period binds as binding_version: 3, and the dates are inside its hash exactly as you wrote them.
The approval page shows each line's dates from the cart ("Mar 12–16"), never from the item's name. An agent's grant with a service window is checked against them (service dates); a cart without dates can't show them, so the person is asked.
2. Ask for the approval
Return approvalChallenge(order, …) from your checkout, or create the approval on our side with POST /. Creating it gives you a public approve_url for the shopper's agent to show and a status_url it polls:
curl -s -X POST $PROVENANCE_API/v1/authorize/checkout_approvals \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"cart": {
"order_id": "ord_8812", "total": 4250, "currency": "USD", "merchant_id": "harborbean", "origin": "https://harborbean.example",
"items": [{ "sku": "mug-sage", "name": "Stoneware mug", "quantity": 2, "unit_amount": 1900, "variant": [{ "name": "Color", "value": "Sage" }] }],
"adjustments": [{ "kind": "shipping", "label": "Standard shipping", "amount": 650 }, { "kind": "discount", "label": "WELCOME", "amount": -200 }],
"fulfillment": { "method_label": "Standard shipping", "estimate_from": "2026-11-02", "estimate_to": "2026-11-05" }
},
"display": { "merchant_name": "Harbor Bean" },
"retry_url": "https://harborbean.example/checkout"
}'
const approval = await prov.authorize.checkoutApprovals.create({
cart: order,
display: { merchantName: "Harbor Bean" },
retryUrl: "https://harborbean.example/checkout",
});
res.status(401).set(approval.challenge.headers).send(approval.challenge.body);
approval = prov.authorize.checkout_approvals.create(
cart=order,
display={"merchant_name": "Harbor Bean"},
retry_url="https://harborbean.example/checkout",
)
{
"id": "coap_01M5WX3K8Q2V7N4T6YBA9RJ5DM",
"object": "checkout_approval",
"status": "pending",
"route": "agent_relay",
"origin": "https://harborbean.example",
"order_id": "ord_8812",
"binding_version": 2,
"expires_at": "2026-10-26T20:15:00.000Z",
"approve_url": "https://app.provenanceauth.com/approve/c/Hq2vN8xK4tB7mW3sYd9cFj",
"status_url": "https://api.provenanceauth.com/v1/authorize/checkout_approvals/requests/Hq2vN8xK4tB7mW3sYd9cFj/status",
"challenge": { "headers": { "WWW-Authenticate": "ProvenanceIntent realm=\"harborbean.example\", action=\"checkout\", binding=\"order\"" }, "body": { "status": 401, "approval_request": { "object": "approval_request", "approve_url": "https://app.provenanceauth.com/approve/c/Hq2vN8xK4tB7mW3sYd9cFj" } } }
}
Return challenge as your checkout's 401, unchanged. How the person gets the link is in ask your own customer.
3. Pictures come from our copy
We fetch each image_url once, when the approval is created, and the page shows our copy. The approval page never loads anything from your store, so you don't learn who looked at the order or from where. Each picture is checked before we keep it:
- PNG, JPEG or WebP, by its
Content-Typeand its bytes, at most 200 KB and 4,000 pixels a side; - fetched only from a public address on your origin, with no redirects and a 3-second limit;
- kept 30 days.
A picture that fails a check is left out and the approval still works. Under the cart the page says "Pictures are from Harbor Bean". Pictures are for display only: the binding holds your URL, never the image bytes.
When we email the approval link to your customer, the email shows the first item's picture beside the order, from our copy. A line without a picture shows none, in the email and on the page.
4. Verify the token against your full cart
Verify the retry with verifyAgentCheckout and the same order, as in verify agent checkouts. The token's payload_hash covers every field you sent, so a changed variant, adjustment, delivery estimate or return policy is payload_hash_mismatch.
Errors you might see
| Symptom | Cause | Fix |
|---|---|---|
cart_ (400) | The lines and adjustments don't add up to total | Send the total the shopper pays, with every shipping, tax, discount and fee line. |
parameter_ on cart | A picture or policy URL on another origin, more than 20 lines or 10 adjustments | Host pictures on your store's origin, and trim the cart. |
| No picture on the page | The fetch failed a check (type, size, address or time) | Serve a PNG, JPEG or WebP under 200 KB from your origin. |
payload_ | The order changed after the person approved it | Ask for a new approval for the current cart. |