View as Markdown

Authorize · Guide

Approve UCP checkouts

If you run your own Universal Commerce Protocol (UCP) checkout server, Provenance can ask the shopper to approve the exact cart with a passkey before an agent completes the order. You add our extension to your business profile, send each checkout response to an assessment, and add the approval Action it returns. Your checkout rules decide which orders are asked, as for any checkout assessment.

PieceWhat it does
com.provenanceauth.checkout.approvalThe capability you list in your profile; platforms that list it too get the approval Action
The approval ActionHolds the checkout incomplete until the shopper approves this exact cart with a passkey
The escalationFor a platform without the extension: the shopper finishes on your own checkout page
The completion checkVerifies the intent token or AP2 checkout mandate on Complete Checkout against your own last checkout response

The mapping targets UCP version 2026-08-25. A checkout that names another version is refused with ucp_version_unsupported.

Before you begin: run a UCP checkout server of your own, and set up checkout rules. Each checked cart is one Authorize check on your bill, and a repeat of the same cart is not counted again.

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x

This package isn't on npm yet. Until then, every request in these docs runs over HTTP against the sandbox.

With access to the private Provenance repository, which your Provenance contact grants, install from it:

git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-sdk-1.0.0.tgz ../provenance-packs/provenanceauth-rails-1.0.0.tgz

Availability: @provenanceauth/rails is available to beta customers and runs in Node 20 and later. The helpers below come from @provenanceauth/rails/ucp.

  1. Your UCP server
    sends its checkout response
  2. Provenance
    runs your checkout rules
  3. The Action or the escalation
    you add to the response
  4. Complete Checkout
    checked against your last response

1. Publish the profile

UCP platforms read your business profile at /.well-known/ucp. Add our capability to the profile you already serve with ucpProfileWithProvenance. It returns a new profile with the entry under ucp.capabilities and every other member unchanged.

import { ucpProfileWithProvenance } from "@provenanceauth/rails/ucp";

const profile = ucpProfileWithProvenance(myUcpProfile, {
  schemaBase: "https://provenanceauth.com",
  docsBase: "https://provenanceauth.com/docs",
  jwksUri: `${process.env.PROVENANCE_API}/.well-known/jwks.json`,
  approvalOrigins: ["https://app.provenanceauth.com"],
});

app.get("/.well-known/ucp", (req, res) => res.json(profile));
OptionWhat it is
schemaBaseWhere the extension's schema is served. Its host must bind com.provenanceauth under UCP's authority rule, so it is https://provenanceauth.com
docsBaseThe docs root; the entry's spec is this guide
jwksUriThe keys intent tokens are signed with
profileUrlOptional: your signed discovery profile, when you publish one
approvalOriginsOptional: the origins an approval link may be on. Platforms decline an Action whose link is anywhere else

GET /v1/authorize/settings/ucp returns the same entry for your deployment as capability, ready to paste.

Or let Provenance host the profile

If you don't serve a profile yet, store its parts with PUT /v1/authorize/settings/ucp: your own services, the payment_handlers your payment provider gave you, and your public signing keys. Then rewrite /.well-known/ucp at your edge to hosted_profile_url.

curl -s -X PUT $PROVENANCE_API/v1/authorize/settings/ucp \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "hosted": true,
    "services": { "dev.ucp.shopping": [{ "version": "2026-08-25", "spec": "https://ucp.dev/2026-08-25/specification/overview/",
                  "transport": "rest", "endpoint": "https://harborbean.example/ucp/v1",
                  "schema": "https://ucp.dev/2026-08-25/services/shopping/rest.openapi.json" }] },
    "payment_handlers": {},
    "keys": [{ "kid": "harborbean-2026-11", "kty": "EC", "crv": "P-256",
               "x": "WbbaSStuffRZUCgDFHmFvbJgzM1SbkAdvAJlCnvNBrM", "y": "tp9q4D2JHq7E4jyBL7nLB3lqaW0dAKE-1rR3KZGm9xg" }]
  }'
{
  "object": "ucp_settings",
  "enabled": true,
  "hosted": true,
  "cart_note_carrier": false,
  "payment_handlers": {},
  "hosted_profile_url": "https://api.provenanceauth.com/v1/public/businesses/biz_01M812B77MPF3ZM8ZPT7KMT462/ucp"
}

The hosted profile is served keyless at GET /v1/public/businesses/{business}/ucp, cached for 5 minutes, with only the parts you stored plus our entry. A key with private members, such as d, is refused with ucp_private_key_refused: send public keys only.

To check the profile your site serves, send your origin to POST /v1/authorize/settings/ucp/check with a console session or your key. It reports whether the profile is reachable, whether our entry is there, whether its schema URL passes UCP's authority rule, and which UCP version it declares.

2. Assess each checkout response

Before you return a checkout response to the platform, send it to POST /v1/authorize/ucp_assessments with the platform's profile URL and the capabilities you negotiated with it.

curl -s -X POST $PROVENANCE_API/v1/authorize/ucp_assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "origin": "https://harborbean.example",
    "merchant_id": "harborbean",
    "platform_profile": "https://agent.example/.well-known/ucp",
    "capabilities": ["dev.ucp.shopping.checkout", "com.provenanceauth.checkout.approval"],
    "checkout": {
      "ucp": { "version": "2026-08-25" },
      "id": "chk_8812",
      "status": "incomplete",
      "currency": "USD",
      "line_items": [{ "id": "li_1", "item": { "id": "mug-sage", "title": "Stoneware mug", "price": 1900 }, "quantity": 2 }],
      "totals": [{ "type": "subtotal", "amount": 3800 }, { "type": "total", "amount": 3800 }]
    }
  }'

The platform listed our extension and no token covers the cart, so the default rule "No mandate or approval" asks. The response carries the Action and its message (the full checkout assessment, under assessment, is shortened here):

{
  "object": "ucp_assessment",
  "id": "ucpa_01M81280F2PJM5R642X8YM62WN",
  "checkout_id": "chk_8812",
  "checkout_hash": "4df003dc6643d8a220549d8e3b014e5145718522f82038cf334a540e53e42244",
  "negotiated": { "approval_action": true, "ap2_mandate": false },
  "assessment": { "object": "checkout_assessment", "id": "cas_01M81280F1SHQAEV3QK6SY8SRF", "outcome": "challenge" },
  "ucp": {
    "version": "2026-08-25",
    "transport": "rest",
    "platform": { "profile_host": "agent.example", "signature": "absent" },
    "verified": { "intent_signal": "absent", "ap2_checkout_mandate": "absent" }
  },
  "approval": { "id": "coap_01M81280F2PGNNSQKZCG4ZP7KR", "status": "pending", "expires_at": "2026-11-22T07:39:03.937Z" },
  "action": {
    "key": "com.provenanceauth.checkout.approval",
    "instance": {
      "id": "pa_coap_…",
      "config": {
        "approve_url": "https://app.provenanceauth.com/approve/c/GcNeQ3PErXQQ5YR870PpzA",
        "status_url": "https://api.provenanceauth.com/v1/authorize/checkout_approvals/requests/status?token=GcNeQ3PErXQQ5YR870PpzA",
        "checkout_approval_id": "coap_01M81280F2PGNNSQKZCG4ZP7KR",
        "binding_hash": "f1ad98c06b58f7c59f942fa41236f49131a3320a55318d4610f3f74efdef8e17",
        "expires_at": "2026-11-22T07:39:03.937Z",
        "require": { "biometric": true }
      }
    }
  },
  "message": {
    "type": "info",
    "code": "com.provenanceauth.approval_requested",
    "content": "The shopper approves this exact order with a passkey before it can be completed.",
    "path": "$.actions['com.provenanceauth.checkout.approval'][0]"
  },
  "fallback": null,
  "warnings": []
}
checkoutobjectRequired
Your own checkout response, exactly as you return it to the platform.
originstringRequired
Your store's origin, bound into the cart.
merchant_idstring
Your merchant id, the payee an intent token binds. Defaults to the origin's host.
platform_profilestring
The platform's profile URL, from UCP-Agent (or meta["ucp-agent"].profile over MCP). Only its host is kept.
capabilitiesarray or object
The intersection you computed with the platform: capability names, or the capabilities object.
transportstring
rest (default), mcp or a2a.
signalsobject
The platform's signals on this request. Read, never stored.
request_signatureobject
The platform's request as you received it (method, url, headers, optional body), to check its signature.
platform_signaturestring
verified when you checked the platform's signature yourself. The record says you checked it.
continue_urlstring
Your checkout page, for the escalation (step 4). Defaults to origin.

The platform's signature. With request_signature, Provenance fetches the profile named in UCP-Agent (cached for 5 minutes, no redirects) and checks the RFC 9421 signature with its keys: ES256 (P-256) or Ed25519, and for the web-bot-auth tag the keyid must be the key's RFC 7638 thumbprint. The result is ucp.platform.signature, which reads verified only when the signature checks out. A profile that can't be fetched leaves it absent and adds ucp_platform_profile_unreachable to warnings; the assessment still runs.

Repeats. The same checkout state, or the same Idempotency-Key, returns the same session and the same Action with 200 and Idempotent-Replayed: true, and isn't counted again. A changed cart is a new state: a new approval and a new Action id.

The checkout's state is its checkout_hash: the SHA-256 of its JCS form (RFC 8785) without the members that change while the cart stays the same.

Left out of checkout_hashWhy
actions, messagesThe Action and its message come and go
signals, ap2Request data and AP2 signatures
status, continue_urlThey move on the way to completion
order, paymentSet once the order is placed or paid
expires_atCapped by the Action's expiry

The rules see the UCP facts listed in the policy field catalog. A UCP checkout is agent traffic, so the default "Unclassified" row never approves one.

3. Add the Action to your checkout response

When action is present, add it and its message to the checkout response you return, and cap the checkout's expiry at the Action's. The checkout stays incomplete while the Action is there.

import { withUcpApprovalAction, ucpApprovalBlocked, ucpCappedExpiry } from "@provenanceauth/rails/ucp";

if (assessment.action) {
  const action = { ...assessment.action, message: assessment.message };
  checkout = withUcpApprovalAction(checkout, action);
  checkout.expires_at = ucpCappedExpiry(checkout.expires_at, action.instance.config.expires_at);
}

If the platform calls Complete Checkout while the Action is outstanding, return the current checkout with the recoverable error ucpApprovalBlocked() builds. Its path selects the Action, as UCP's checkout spec asks.

checkout.messages = [...(checkout.messages ?? []), ucpApprovalBlocked()];
return res.json(checkout);

The platform hands approve_url to the shopper as a link or a QR code and polls status_url. When the shopper decides, you get the authorize.checkout_assessment.updated webhook, and GET /v1/authorize/ucp_assessments/{id} returns approval.status with action: null.

approval.statusWhat to do
approvedDrop the Action and let the checkout reach ready_for_complete. Collect the intent token from the approval on your server; the platform never carries it
denied or expiredKeep the checkout incomplete with a recoverable error, or cancel it

4. Handle a platform without the extension

When the platform didn't list our extension, you can't send it the Action. The deciding rule's UCP fallback picks what happens instead.

ucp_fallbackWhat you getWhat you do
escalate (default)escalation: requires_escalation, a requires_buyer_review message and your continue_url with the session id addedReturn the checkout with those members. The platform sends the shopper to your checkout page
hold_after_orderhold: the cart approval's linksLet the order through, hold it until the approval resolves, and send the shopper approve_url
curl -s -X POST $PROVENANCE_API/v1/authorize/ucp_assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "origin": "https://harborbean.example",
    "merchant_id": "harborbean",
    "continue_url": "https://harborbean.example/checkout",
    "capabilities": ["dev.ucp.shopping.checkout"],
    "checkout": {
      "ucp": { "version": "2026-08-25" },
      "id": "chk_8813",
      "status": "incomplete",
      "currency": "USD",
      "line_items": [{ "id": "li_1", "item": { "id": "mug-sage", "title": "Stoneware mug", "price": 1900 }, "quantity": 2 }],
      "totals": [{ "type": "total", "amount": 3800 }]
    }
  }'
{
  "object": "ucp_assessment",
  "id": "ucpa_01M81288V5C3ZMSS7QRFEVKPJ7",
  "checkout_id": "chk_8813",
  "negotiated": { "approval_action": false, "ap2_mandate": false },
  "approval": null,
  "action": null,
  "message": null,
  "fallback": "escalate",
  "escalation": {
    "status": "requires_escalation",
    "continue_url": "https://harborbean.example/checkout?provenance_ucp_session=ucpa_01M81288V5C3ZMSS7QRFEVKPJ7",
    "messages": [
      {
        "type": "error",
        "code": "com.provenanceauth.approval_requested",
        "severity": "requires_buyer_review",
        "content": "The shopper finishes this order on the store's checkout page."
      }
    ]
  },
  "warnings": []
}

ucpEscalation(checkout, { continueUrl, sessionId }) builds the same members from your checkout if you'd rather apply them yourself.

Set the fallback per rule as require.ucp_fallback on a rule in your checkout rules document (/v1/authorize/policies). It goes on assess-phase rules that ask for approval; a rule without it escalates.

A person who finishes on your page isn't asked again

On your checkout page, run your ordinary checkout assessment with ucp_session_id set to the provenance_ucp_session value from the URL, plus the shopper's visit, as for any checkout. Identify's class for that visit sets ucp.completed_by:

Visitor classucp.completed_byDefault rules
likely_humanperson"Shopper finished the checkout" approves: the escalation already handed the order to the shopper
signed_agent, declared_bot or suspected_botagentThe ask stands; show the passkey approval on the page with the checkout approval widget
UnknownNot setYour other rules decide

5. Verify the completion

When the platform calls Complete Checkout, send your own last checkout response and the platform's request body to POST /v1/authorize/ucp_completions. Use your stored response, never a checkout the platform sends back.

curl -s -X POST $PROVENANCE_API/v1/authorize/ucp_completions \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "origin": "https://harborbean.example",
    "merchant_id": "harborbean",
    "checkout": {
      "ucp": { "version": "2026-08-25" },
      "id": "chk_8812",
      "status": "incomplete",
      "currency": "USD",
      "line_items": [{ "id": "li_1", "item": { "id": "mug-sage", "title": "Stoneware mug", "price": 1900 }, "quantity": 2 }],
      "totals": [{ "type": "subtotal", "amount": 3800 }, { "type": "total", "amount": 3800 }]
    },
    "complete_request": { "payment": {} }
  }'

The shopper hasn't approved checkout chk_8812 yet, so the completion isn't ok:

{
  "object": "ucp_completion",
  "id": "ucpc_01M8128FDXNMDYZS0YEM4TG5G1",
  "ok": false,
  "reason": "approval_pending",
  "session_id": "ucpa_01M81280F2PJM5R642X8YM62WN",
  "approval_id": "coap_01M81280F2PGNNSQKZCG4ZP7KR",
  "checkout_id": "chk_8812",
  "verified": { "intent_signal": "absent", "ap2_checkout_mandate": "absent" }
}

The check takes the first of these that applies:

What the request carriesWhat is checked
AP2 negotiated for this checkout, or an ap2.checkout_mandateThe mandate is required (ap2_mandate_missing without it), from an issuer you list in outside confirmations, over your own last checkout
An intent token in signals["com.provenanceauth.intent"]ES256 under our keys, bound to your last checkout, not revoked and not held
NeitherThe session's own outcome: its approval approved, nothing to ask, or an escalated checkout a person finished

Every completion is recorded and readable at GET /v1/authorize/ucp_completions/{id}. The reason values are on the reason codes page.

Verify offline

verifyUcpCompletion runs the intent-token check in your own server against the keys you cached, with no call to Provenance. The platform sends the token with withProvenanceIntentSignal(request, token, jwksUri).

import { verifyUcpCompletion } from "@provenanceauth/rails/ucp";

const result = await verifyUcpCompletion(completeRequest, {
  jwks,
  checkout: lastCheckout,
  payee: "harborbean",
  origin: "https://harborbean.example",
});
if (!result.ok) return refuse(result.reason);

A token is accepted when its payload_hash binds either the UCP binding payload (ucpBindingPayload(checkout, { payee }), the object an agent passes as action_payload when it mints the token) or, with origin, the cart of the checkout approval for this checkout. result.bound says which: ucp or cart. Add onlineStatus to check revocation too.

Verify an AP2 checkout mandate

When UCP's AP2 mandates extension (dev.ucp.common.payment.ap2_mandate) is negotiated, you sign ap2.merchant_authorization with your own key on every checkout response, and the platform must send ap2.checkout_mandate. UCP locks the session, so the intent signal isn't used instead.

import { verifyUcpCheckoutMandate, verifyUcpMerchantAuthorization } from "@provenanceauth/rails/ucp";

const own = verifyUcpMerchantAuthorization(lastCheckout, myPublicKeys); // your signature, in your tests
const mandate = verifyUcpCheckoutMandate(completeRequest.ap2.checkout_mandate, {
  issuers, // the issuers you list, each with the JWKS you fetched
  checkout: lastCheckout,
  origin: "https://harborbean.example",
  payee: "harborbean",
});

The mandate's embedded checkout must equal your last response, compared in JCS form byte for byte. Two placements are accepted: a checkout_jwt that is your merchant_authorization with its payload attached (your checkout without ap2), or a JWT whose payload is the full checkout with ap2. An accepted mandate is an outside confirmation: the record says which issuer signed it.

6. Carry a token in a Shopify cart note

A Shopify store can't add our Action to Shopify's agent checkout (see the limitations below). For agents that hold an intent token, @provenanceauth/rails/ucp has a carrier on the cart note, off by default, because staff and the shopper can see and edit the note.

SideHelperWhat it does
AgentwithProvenanceCartNote(note, token)Appends one line, provenance-intent: <token>, after the shopper's own text, which stays first and unchanged
StorereadProvenanceCartNote(note)Returns the token (or null), the note without the line, byte for byte as the shopper wrote it, and malformed

cart_note_carrier in your UCP settings turns the carrier on for your connected Shopify store, and is false until you change it. With it off, the note is never read.

With it on, when your rules ask about an order, the hold reads the marked line: a token that verifies against the order's own lines, total, currency and your store releases the hold as the buyer's approval (reason: "store_intent_token"), and the line is removed from the note so staff see only the shopper's text.

A token over another cart, an expired one or a malformed line is recorded on the order (intent_carrier.verdict) and the buyer is asked as usual. On another platform, your own order handler reads the line with readProvenanceCartNote and verifies the token as in verify agent checkouts.

Limitations

Limitations: the approval opens as a link or a QR code, never in a frame inside the platform's app. Platforms see the Action only when their own profile lists com.provenanceauth.checkout.approval; every other platform gets the fallback. A Shopify store can't emit the Action, because Shopify serves the store's UCP endpoints and documents no third-party extensions: agent orders there reach your checkout or arrive as orders, and Hold Shopify orders covers both. AP2 delegate chains are refused.

Errors you might see

SymptomCauseFix
ucp_unconfigured (503)The UCP routes are off on this deploymentKeep your UCP checkout as it is and use checkout assessments.
ucp_checkout_invalid (400)The checkout lacks id, currency, readable line_items or a total entry in minor unitsSend your checkout response exactly as you return it to the platform.
ucp_version_unsupported (400)The checkout names a UCP version other than 2026-08-25Negotiate 2026-08-25 with the platform.
ucp_private_key_refused (400)A key in keys carries private membersSend public members only, then rotate that key.
ucp_profile_not_published (404)The business hasn't turned on a hosted profileFetch the business's own /.well-known/ucp.
idempotency_key_reused (400)The same Idempotency-Key was sent with a different checkout stateUse a new key for each checkout state.
ucp_platform_profile_unreachable in warningsThe platform's profile couldn't be fetchedThe signature reads absent; check the UCP-Agent URL.

See also