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.
| Piece | What it does |
|---|---|
com. | The capability you list in your profile; platforms that list it too get the approval Action |
| The approval Action | Holds the checkout incomplete until the shopper approves this exact cart with a passkey |
| The escalation | For a platform without the extension: the shopper finishes on your own checkout page |
| The completion check | Verifies 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.tgzAvailability: @provenanceauth/rails is available to beta customers and runs in Node 20 and later. The helpers below come from @provenanceauth/rails/ucp.
- Your UCP serversends its checkout response
- Provenanceruns your checkout rules
- The Action or the escalationyou add to the response
- Complete Checkoutchecked 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));
| Option | What it is |
|---|---|
schemaBase | Where the extension's schema is served. Its host must bind com. under UCP's authority rule, so it is https:/ |
docsBase | The docs root; the entry's spec is this guide |
jwksUri | The keys intent tokens are signed with |
profileUrl | Optional: your signed discovery profile, when you publish one |
approvalOrigins | Optional: the origins an approval link may be on. Platforms decline an Action whose link is anywhere else |
GET / 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 /: 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" }]
}'
const settings = await (
await fetch(`${process.env.PROVENANCE_API}/v1/authorize/settings/ucp`, {
method: "PUT",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ hosted: true, services, payment_handlers: {}, keys: [publicJwk] }),
})
).json();
settings = httpx.put(
f"{api}/v1/authorize/settings/ucp",
headers={"Authorization": f"Bearer {key}"},
json={"hosted": True, "services": services, "payment_handlers": {}, "keys": [public_jwk]},
).json()
{
"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 /, 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 / 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 }]
}
}'
const assessment = await (
await fetch(`${process.env.PROVENANCE_API}/v1/authorize/ucp_assessments`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
origin: "https://harborbean.example",
merchant_id: "harborbean",
platform_profile: platformProfileUrl,
capabilities: negotiated,
checkout,
}),
})
).json();
assessment = httpx.post(
f"{api}/v1/authorize/ucp_assessments",
headers={"Authorization": f"Bearer {key}"},
json={
"origin": "https://harborbean.example",
"merchant_id": "harborbean",
"platform_profile": platform_profile_url,
"capabilities": negotiated,
"checkout": checkout,
},
).json()
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(ormeta["ucp-agent"].profileover MCP). Only its host is kept. capabilitiesarray or object- The intersection you computed with the platform: capability names, or the capabilities object.
transportstringrest(default),mcpora2a.signalsobject- The platform's
signalson this request. Read, never stored. request_signatureobject- The platform's request as you received it (
method,url,headers, optionalbody), to check its signature. platform_signaturestringverifiedwhen 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_hash | Why |
|---|---|
actions, messages | The Action and its message come and go |
signals, ap2 | Request data and AP2 signatures |
status, continue_ | They move on the way to completion |
order, payment | Set once the order is placed or paid |
expires_ | Capped 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 / returns approval.status with action: null.
approval.status | What to do |
|---|---|
approved | Drop the Action and let the checkout reach ready_. Collect the intent token from the approval on your server; the platform never carries it |
denied or expired | Keep 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_fallback | What you get | What you do |
|---|---|---|
escalate (default) | escalation: requires_, a requires_ message and your continue_ with the session id added | Return the checkout with those members. The platform sends the shopper to your checkout page |
hold_ | hold: the cart approval's links | Let the order through, hold it until the approval resolves, and send the shopper approve_ |
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 }]
}
}'
const assessment = await (
await fetch(`${process.env.PROVENANCE_API}/v1/authorize/ucp_assessments`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ origin: "https://harborbean.example", merchant_id: "harborbean", continue_url: "https://harborbean.example/checkout", capabilities: negotiated, checkout }),
})
).json();
assessment = httpx.post(
f"{api}/v1/authorize/ucp_assessments",
headers={"Authorization": f"Bearer {key}"},
json={"origin": "https://harborbean.example", "merchant_id": "harborbean", "continue_url": "https://harborbean.example/checkout", "capabilities": negotiated, "checkout": checkout},
).json()
{
"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 class | ucp.completed_by | Default rules |
|---|---|---|
likely_ | person | "Shopper finished the checkout" approves: the escalation already handed the order to the shopper |
signed_, declared_ or suspected_ | agent | The ask stands; show the passkey approval on the page with the checkout approval widget |
| Unknown | Not set | Your 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 /. 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": {} }
}'
const completion = await (
await fetch(`${process.env.PROVENANCE_API}/v1/authorize/ucp_completions`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ origin: "https://harborbean.example", merchant_id: "harborbean", checkout: lastCheckout, complete_request: req.body }),
})
).json();
completion = httpx.post(
f"{api}/v1/authorize/ucp_completions",
headers={"Authorization": f"Bearer {key}"},
json={"origin": "https://harborbean.example", "merchant_id": "harborbean", "checkout": last_checkout, "complete_request": complete_request},
).json()
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 carries | What is checked |
|---|---|
AP2 negotiated for this checkout, or an ap2. | The mandate is required (ap2_ without it), from an issuer you list in outside confirmations, over your own last checkout |
An intent token in signals["com. | ES256 under our keys, bound to your last checkout, not revoked and not held |
| Neither | The 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 /. 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.
| Side | Helper | What it does |
|---|---|---|
| Agent | withProvenanceCartNote(note, token) | Appends one line, provenance-intent: <token>, after the shopper's own text, which stays first and unchanged |
| Store | readProvenanceCartNote(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
| Symptom | Cause | Fix |
|---|---|---|
ucp_ (503) | The UCP routes are off on this deployment | Keep your UCP checkout as it is and use checkout assessments. |
ucp_ (400) | The checkout lacks id, currency, readable line_ or a total entry in minor units | Send your checkout response exactly as you return it to the platform. |
ucp_ (400) | The checkout names a UCP version other than 2026-08-25 | Negotiate 2026-08-25 with the platform. |
ucp_ (400) | A key in keys carries private members | Send public members only, then rotate that key. |
ucp_ (404) | The business hasn't turned on a hosted profile | Fetch the business's own /. |
idempotency_ (400) | The same Idempotency-Key was sent with a different checkout state | Use a new key for each checkout state. |
ucp_ in warnings | The platform's profile couldn't be fetched | The signature reads absent; check the UCP-Agent URL. |