SDK reference · Python SDK
prov.authorize.assessments.create
prov.authorize.assessments.create in Python SDK.
Signature
prov.authorize.assessments.create(cart: dict, intent_token: Optional[str] = …, mandate_token: Optional[str] = …, request: Optional[dict] = …, traffic_assessment_id: Optional[str] = …, visit_id: Optional[str] = …, payment_reference: Optional[str] = …, ip: Optional[str] = …, merchant_facts: Optional[dict] = …, billing_address: Optional[dict] = …, contact: Optional[dict] = …, delivery: Optional[str] = …, channels: Optional[list] = …, follow_up_text: Optional[dict] = …, reminders: Optional[dict] = …, display: Optional[dict] = …, retry_url: Optional[str] = …, expires_in: Optional[int] = …, policy_version: Optional[int] = …, draft_group: Optional[str] = …) -> AnyParameters
cartdictRequiredintent_tokenOptional[str]mandate_tokenOptional[str]requestOptional[dict]traffic_assessment_idOptional[str]visit_idOptional[str]payment_referenceOptional[str]ipOptional[str]merchant_factsOptional[dict]billing_addressOptional[dict]contactOptional[dict]deliveryOptional[str]channelsOptional[list]follow_up_textOptional[dict]remindersOptional[dict]displayOptional[dict]retry_urlOptional[str]expires_inOptional[int]policy_versionOptional[int]draft_groupOptional[str]
Request fields
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
cartobjectRequired- Your record of the order, exactly as you pass it to
checkoutBinding(binding v1 or the v2 cart). intent_tokenstring- The
Provenance-Intentvalue the agent sent. mandate_tokenstring- The
Provenance-Mandatevalue (a person's grant) the agent sent. counter_offer_idstring- the
Provenance-Counter-Offervalue the agent sent with a grant presented alone: the accepted counter-offer this cart buys. The cart's total must be at most the accepted amount plus the option'stax_and_fees, each line one that was offered (sku or name), under that grant; otherwise the cart isn't covered (coverage_reason: counter_offer_terms_changed). An intent token minted for a counter-offer names its own. A frictionless outcome uses the acceptance once. requestobject- The agent's request, run through Identify's hosted check with this cart as the order. Its
Provenance-IntentandProvenance-Mandateheaders are read when the fields above are absent.Show child attributes
methodstringRequired- The HTTP method.
urlstringRequired- The full URL.
headersobject- The request headers.
bodystring- The request body, at most 64 KB. Read, never stored.
checkout_jwtstring- The Checkout JWT your store signed for this cart, when the agent pays with an AP2 Checkout Mandate (its
checkout_hashmust be this JWT's hash). A Payment Mandate needs none. traffic_assessment_idstring- A verdict your Identify middleware reported in the last 5 minutes (
tas_…), instead ofrequest. paymentobject- How the agent is paying. A Stripe shared payment token you received is checked on your own Stripe account through your payment connection when its key can read shared payment tokens; otherwise the payment facts stay as reported. We never resolve a token or handle a card number. Any of its fields marks the order as an agent order for your rules, except
payment_intentalone.Show child attributes
shared_payment_tokenstring- The shared payment token (
spt_…) the agent gave you. credential_typeenum- The credential type your own token resolve returned (
agentic_tokenis a card network agent token). One ofagentic_token,dpan,fpan. payment_intentstring- A PaymentIntent you already created (manual capture): its latest charge says whether a network token paid.
payment_referencestring- The payment you created for this cart (a Stripe PaymentIntent
pi_…or chargech_…), so a chargeback on it finds this decision. payment_methodobject- The card in use, shown on a challenge's approval email and page; not part of the signed cart. Rules and risk scores read it as
card.brand,card.last4and, with both expiry fields,card.expiry(YYYY-MM). The expiry is never shown or kept on the approval.Show child attributes
brandenum- The card brand. One of
visa,mastercard,amex,discover,jcb,unionpay,diners,other. last4string- Exactly the last 4 digits.
walletenum- The wallet the card is used through, when there is one. One of
apple_pay,google_pay,link,paypal,shop_pay. descriptionstring- On a read: the line the page shows ("Visa ···· 4242 · Apple Pay").
exp_monthinteger- The card's expiry month. Send with exp_year.
exp_yearinteger- The card's expiry year (four digits). Send with exp_month.
visit_idstring- The storefront visit this cart came from (the storefront check's
tas_…verdict id, at most 24 hours old). With field timing on the visit, its score fillsagent.automation_score; with norequestortraffic_assessment_id, its bot score and signals fill the bot facts. ucp_session_idstring- The UCP session (
ucpa_…) an escalated Universal Commerce Protocol checkout handed to your checkout page (itsprovenance_ucp_sessionquery parameter). The visit's class setsucp.completed_by. ipstring- The agent's client IP, for Identify.
merchant_factsobject- Facts you attest about the order, for your rules (labelled
source: "merchant"). Rules on them are Pro and above.Show child attributes
delivery_timeframeenum- How soon the order ships. One of
electronic,same_day,overnight,two_or_more_days. gift_card_countinteger- Gift cards in the order.
gift_card_amountinteger- Their total, in minor units.
preorderboolean- The order includes a preorder.
reorderboolean- The customer has ordered this before.
ship_toenum- Where it ships. One of
billing_address,stored_address,new_address,pickup,digital. customer_account_age_daysinteger- How old your customer's account is, in days.
billing_addressobject- Your customer's billing address (store-attested). Its country and region are rule facts on every plan (
billing.country,billing.region); the assessment keeps the coarse fields and a challenge's cart approval keeps the full address, sealed.Show child attributes
line1string | null- The street line.
line2string | null- The second line (apartment, suite, unit).
citystring | null- The city.
regionstring | null- The state, province or region: a code (
OR,US-OR) or a name (Oregon). US states, Canadian provinces and territories and Australian states map to ISO 3166-2; any other region is kept for comparison only and its region fact is absent (region_unrecognized). postal_codestring | null- The postal or ZIP code.
countrystringRequired- ISO 3166-1 alpha-2 (
US). Required. locationobject | null- The address's point, when your store has one. Sealed with the address. With it, the distance facts (
approval.distance_km_billing,approval.min_distance_km_billing) work without a geocoder; without it, the server's geocoder finds the postal code's centre, or the distance facts are absent (geocoder_not_configured).Show child attributes
latnumberRequired- Latitude, in degrees.
lngnumberRequired- Longitude, in degrees.
bank_checkobject- Run the bank check (3-D Secure through your payment provider) on the approval page after the passkey, when the outcome is a challenge. Pro and up; 503 until this deployment turns the step on for the provider.
Show child attributes
providerenumRequired- Your payment provider. One of
checkout_com,adyen,cybersource,stripe.
contactobject- On a challenge, ask your own signed-in customer at this contact instead of the agent relay.
namealone (no phone or email) keeps the relay and shows the name on your reads. The older fieldcustomeris refused.Show child attributes
phonestring- An E.164 phone number (
+14155550132). Spaces are removed; nothing else is guessed. emailstring- An email address, compared in lower case.
namestring- The shopper's name as your store holds it (
Maya Chen). One line; spaces collapsed. Sealed at rest, opened in your account export, deleted with the row. text_consentobject- With
phone: your statement that the person at this phone agreed to your texts, as onRequestContact.Show child attributes
methodenumRequired- How the person agreed. One of
sign_up_form,in_app,in_person,customer_list. obtained_attimestampRequired- When they agreed; not in the future.
evidence_urlstring- An
httpslink to how they agreed. Stored, never fetched.
deliveryenumsend: Provenance sends the request on the channelschannelsallows.self: link only. Nothing is sent and the response returns the link for you to pass on. Left out, a request with no contact is link only and any other takes your account's default (sendout of the box). With a default of link only, a request that gives a contact must saysend. One ofsend,self.channelsarray of enums- Which of Provenance's messages may go, in any order:
app_notification(the person's Provenance app, when the contact matches one person there),emailandtext. Left out, your account's default (all three out of the box). With all three, the person gets the app notification and the email when their contact matches, and the text and the email otherwise; a narrower list sends only what it names (the text goes in the notification's place only withtext, the email beside either only withemail). Each message is reported on its own indeliveries. A list that can reach none of the contacts is refused, as aresmsandapp_push. follow_up_textobject- The follow-up text for this request (or, on
PUT /v1/account/reminders, the default). Each key left out takes your account's saved default; the whole object left out takes all three (on,not_opened, 5 minutes out of the box). On a live deployment it is Pro and above (402 plan_requiredon Free, nothing created or saved); in the sandbox it works on every plan. Refused besidedelivery: "self".Show child attributes
enabledbooleanfalsesends no follow-up text.whenenumnot_opened(the default) ornot_finished. One ofnot_opened,not_finished.after_minutesinteger- A whole number of minutes from 1 to 1440, counted from the notification. On a create it must be shorter than the request's
expires_in(400 parameter_invalidonfollow_up_text.after_minutes); a longer wait from your default is kept, and the text is skipped asexpiredif the request ends first.
remindersobject- This request's automatic reminders, in the shape of one product's schedule in Settings (
schedules.<kind>on/v1/account/reminders):capture_requestfor a capture request,checkout_approvalfor a cart approval (and an assessment's challenge or a guest confirmation),approvalfor a routed approval. Keys left out take your account's saved values, as aPUTto Settings does:afteralone changes the timings of a schedule that is on, andenabled: trueturns it on. The cap, the minimum gap and quiet hours apply as built; an offset at or past the request's expiry is left out. Fixed at create: a later change in Settings leaves the request as it was. Refused besidedelivery: "self".Show child attributes
enabledbooleantruetracks this request on the schedule (Pro and above on a live deployment:402 plan_requiredonreminders.enabledbelow Pro, nothing created; every plan in the sandbox);falsesends it no automatic reminder (one by hand or by API is still allowed).afterarray of strings- Up to three offsets from the request's creation (
10m,24h,3d), increasing, each at least the minimum gap after the one before, at most 7 days. Errors use the Settings messages onreminders.after.
displayobject- How the approval page shows your store (default: your brand name, else the cart's host).
Show child attributes
merchant_namestringRequired- Your store's name.
ships_toobject- Coarse ships-to (
city,region,country).
retry_urlstring- Where the agent retries with
Provenance-Intent(default: the cart's origin). expires_ininteger- How long the challenge stays open, in seconds (default: your account's approval expiry, else 600, held to 60 to 3600).
requireobject- What a new passkey needs on this approval, over your checkout rules'
passkeys(defaultstep_up_contact, 86400 seconds,no_contact: accept).Show child attributes
new_passkeyenumstep_up_contact: a new passkey also confirms a code sent to the customer contact you passed, unless the person opened the link from the email or text sent to that same contact (approval_context.method.step_up.methodis thenlink_contact).accept: it counts, and the response says it's new.require_existing: it's refused (passkey_too_new). One ofstep_up_contact,accept,require_existing.min_passkey_ageinteger- Seconds. A passkey younger than this is new; 0 treats only one set up during this approval as new.
no_contactenum- With
step_up_contactand no customer contact (the agent relay): count it, or decline it. One ofaccept,decline.
policy_versioninteger- Sandbox only. Decide with this version of your checkout rules (a draft, typically) instead of the live one;
policy.versionon the answer names it. A draft saved in a draft group needs thatdraft_group. In live,400 parameter_invalid; a version that doesn't exist,404. draft_groupstring- Sandbox only, with
policy_version: the draft group the draft was saved in (the rules embed session'srules.draft_group). Another group's draft is400 parameter_invalid.
Returns
Any The assessment.
HTTP operation
POST /v1/authorize/checkout_assessments: Assess an agent checkout
Errors
- authentication_required
- cart_totals_mismatch
- idempotency_key_reused
- insufficient_scope
- invalid_json
- parameter_invalid
- parameter_missing
- policy_account_required
- rate_limit_exceeded
- resource_missing
- usage_limit_reached
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/intents`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"action_description": "Checkout at harborbean.example: order ord_8812, USD 38.00",
"action_payload": {
"order_id": "ord_8812",
"total": 3800,
"currency": "usd",
"merchant_id": "harborbean",
"origin": "https://harborbean.example",
"items": [
{
"sku": "mug-sage",
"name": "Stoneware mug",
"quantity": 2,
"unit_amount": 1900
}
]
},
"agent_session_id": "sess_reference_assess",
"device_id": "dev_00000000000000000000000000000001",
"biometric_present": true,
"audience": "https://harborbean.example"
}),
})).json();
const intentToken = step1.intent_token;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/checkout_assessments`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"cart": {
"order_id": "ord_8812",
"total": 3800,
"currency": "USD",
"merchant_id": "harborbean",
"origin": "https://harborbean.example",
"items": [
{
"sku": "mug-sage",
"name": "Stoneware mug",
"quantity": 2,
"unit_amount": 1900
}
]
},
"intent_token": intentToken,
"merchant_facts": {
"delivery_timeframe": "two_or_more_days",
"ship_to": "stored_address"
},
"billing_address": {
"line1": "18 Harrow Lane",
"city": "Portland",
"region": "OR",
"postal_code": "97205",
"country": "US"
},
"payment": {
"shared_payment_token": "spt_1RefSample0000000001",
"credential_type": "agentic_token"
},
"contact": {
"name": "Maya Chen"
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/intents", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}, json={
"action_description": "Checkout at harborbean.example: order ord_8812, USD 38.00",
"action_payload": {
"order_id": "ord_8812",
"total": 3800,
"currency": "usd",
"merchant_id": "harborbean",
"origin": "https://harborbean.example",
"items": [
{
"sku": "mug-sage",
"name": "Stoneware mug",
"quantity": 2,
"unit_amount": 1900
}
]
},
"agent_session_id": "sess_reference_assess",
"device_id": "dev_00000000000000000000000000000001",
"biometric_present": True,
"audience": "https://harborbean.example"
}).json()
intent_token = step1["intent_token"]
data = httpx.post(f"{api}/v1/authorize/checkout_assessments", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"cart": {
"order_id": "ord_8812",
"total": 3800,
"currency": "USD",
"merchant_id": "harborbean",
"origin": "https://harborbean.example",
"items": [
{
"sku": "mug-sage",
"name": "Stoneware mug",
"quantity": 2,
"unit_amount": 1900
}
]
},
"intent_token": intent_token,
"merchant_facts": {
"delivery_timeframe": "two_or_more_days",
"ship_to": "stored_address"
},
"billing_address": {
"line1": "18 Harrow Lane",
"city": "Portland",
"region": "OR",
"postal_code": "97205",
"country": "US"
},
"payment": {
"shared_payment_token": "spt_1RefSample0000000001",
"credential_type": "agentic_token"
},
"contact": {
"name": "Maya Chen"
}
}).json()