# prov.authorize.assessments.create

prov.authorize.assessments.create in Node SDK.

## Signature

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

## Parameters

- `params` (CreateAssessmentParams)

## Returns

`Promise<CheckoutAssessment>`

## HTTP operation

[`POST /v1/authorize/checkout_assessments`](https://provenanceauth.com/docs/api/assessments.md#post-v1-authorize-checkout-assessments): Assess an agent checkout

## Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`cart_totals_mismatch`](https://provenanceauth.com/docs/platform/errors.md#cart_totals_mismatch)
- [`idempotency_key_reused`](https://provenanceauth.com/docs/platform/errors.md#idempotency_key_reused)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`policy_account_required`](https://provenanceauth.com/docs/platform/errors.md#policy_account_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`usage_limit_reached`](https://provenanceauth.com/docs/platform/errors.md#usage_limit_reached)

## Example

**Node**

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

**Python**

```python
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()
```
