SDK reference · Node SDK

prov.authorize.assessments.create

prov.authorize.assessments.create in Node SDK.

Signature

prov.authorize.assessments.create(params: CreateAssessmentParams): Promise<CheckoutAssessment>

Parameters

paramsCreateAssessmentParamsRequired

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-Intent value the agent sent.
mandate_tokenstring
The Provenance-Mandate value (a person's grant) the agent sent.
counter_offer_idstring
the Provenance-Counter-Offer value 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's tax_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-Intent and Provenance-Mandate headers 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_hash must 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 of request.
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_intent alone.
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_token is a card network agent token). One of agentic_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 charge ch_…), 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.last4 and, 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 fills agent.automation_score; with no request or traffic_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 (its provenance_ucp_session query parameter). The visit's class sets ucp.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. name alone (no phone or email) keeps the relay and shows the name on your reads. The older field customer is 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 on RequestContact.
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 https link to how they agreed. Stored, never fetched.
deliveryenum
send: Provenance sends the request on the channels channels allows. 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 (send out of the box). With a default of link only, a request that gives a contact must say send. One of send, 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), email and text. 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 with text, the email beside either only with email). Each message is reported on its own in deliveries. A list that can reach none of the contacts is refused, as are sms and app_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_required on Free, nothing created or saved); in the sandbox it works on every plan. Refused beside delivery: "self".
Show child attributes
enabledboolean
false sends no follow-up text.
whenenum
not_opened (the default) or not_finished. One of not_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_invalid on follow_up_text.after_minutes); a longer wait from your default is kept, and the text is skipped as expired if 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_request for a capture request, checkout_approval for a cart approval (and an assessment's challenge or a guest confirmation), approval for a routed approval. Keys left out take your account's saved values, as a PUT to Settings does: after alone changes the timings of a schedule that is on, and enabled: true turns 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 beside delivery: "self".
Show child attributes
enabledboolean
true tracks this request on the schedule (Pro and above on a live deployment: 402 plan_required on reminders.enabled below Pro, nothing created; every plan in the sandbox); false sends 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 on reminders.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 (default step_up_contact, 86400 seconds, no_contact: accept).
Show child attributes
new_passkeyenum
step_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.method is then link_contact). accept: it counts, and the response says it's new. require_existing: it's refused (passkey_too_new). One of step_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_contact and no customer contact (the agent relay): count it, or decline it. One of accept, decline.
policy_versioninteger
Sandbox only. Decide with this version of your checkout rules (a draft, typically) instead of the live one; policy.version on the answer names it. A draft saved in a draft group needs that draft_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's rules.draft_group). Another group's draft is 400 parameter_invalid.

Returns

Promise<CheckoutAssessment> The assessment.

HTTP operation

POST /v1/authorize/checkout_assessments: Assess an agent checkout

Errors

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();

Was this page helpful? Send us feedback

LLM? Read llms.txt.