SDK reference · Node SDK

prov.authorize.checkoutApprovals.create

prov.authorize.checkoutApprovals.create in Node SDK. Create a cart approval (201; 200 with deduped when your customer already has one pending).

Signature

prov.authorize.checkoutApprovals.create(params: CreateCheckoutApprovalParams): Promise<CheckoutApproval>

Parameters

paramsCreateCheckoutApprovalParamsRequired

Request fields

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
cartobjectRequired
An order, exactly as you pass it to checkoutBinding. The rich fields (binding v2) are optional; a cart without them keeps its hash.
Show child attributes
order_idstringRequired
Your order ID.
totalintegerRequired
The total in minor units: lines plus adjustments.
currencystringRequired
ISO 4217 code.
merchant_idstringRequired
Your merchant ID.
originstringRequired
Your store's origin, such as https://harborbean.example.
fulfillment_digeststring
A digest of the full delivery address.
itemsarray of objects
The cart lines (20 at most with the rich fields).
Show child attributes
skustringRequired
The SKU.
namestringRequired
The item name.
quantityintegerRequired
How many.
unit_amountintegerRequired
Price each, in minor units.
variantarray of objects
Up to 3 { name, value } pairs, such as Size: M.
Show child attributes
namestring
The option name.
valuestring
The chosen value.
image_urlstring
A picture of the item: https, on your origin. Display only. We keep a copy when the approval is created; the approval page shows it, and the approval email shows the first item's picture.
urlstring
The item's page: https, on your origin (the image_url rule). Display only and not part of the signed cart: the approval page links the item to it, opened in a new tab. The page keeps your line order.
service_periodobject
The dates of the service this line buys (hotel nights, a flight, a rental), in the place's own local time (binding v3: a cart with it hashes as binding_version: 3). Bound exactly as given. A grant's service_window is checked against it, and the approval page shows it.
Show child attributes
startstringRequired
A date (2027-03-12) or a date-time with an offset (2027-03-12T15:00:00+00:00).
endstringRequired
The same form, on or after start's date. For lodging, the check-out date.
adjustmentsarray of objects
Shipping, tax, discount and fee lines (discounts negative).
Show child attributes
kindenumRequired
The kind of line. One of shipping, tax, discount, fee.
labelstringRequired
What the page shows.
amountintegerRequired
Minor units; negative for a discount.
fulfillmentobject
The delivery method and estimate.
Show child attributes
method_labelstring
The method, such as Standard shipping.
estimate_fromstring
The earliest delivery date.
estimate_tostring
The latest delivery date.
return_policy_urlstring
Your return policy: https, on your origin.
merchantobject
What you declare about your store, as a 3-D Secure authentication request carries it (binding v3: a cart with it hashes as binding_version: 3). Bound into the payload hash. A grant's kinds of merchant and countries are checked against it, and everywhere it shows it reads as declared.
Show child attributes
mccstring
Your acquirer-assigned merchant category code (7011).
countrystring
Your ISO 3166-1 numeric country code (620 for Portugal).
displayobjectRequired
What the approval page shows besides the cart.
Show child attributes
merchant_namestringRequired
Your store's name, shown as "calls itself …".
ships_toobject
City, region and country only.
Show child attributes
citystring
The city.
regionstring
The state or region.
countrystring
The country.
retry_urlstringRequired
Where the agent retries the checkout with Provenance-Intent.
retry_methodstring
The retry's HTTP method (default POST).
expires_ininteger
Seconds the approval stays open (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.
contactobject
Who a checkout approval goes to, and the name you hold for them: a phone, an email or both, from your own records, and an optional name. A name sent alone is no contact to send to (the request reads as having no contact). The name is display only: it shows on your own reads of the assessment and the approval ("Approved by Maya Chen") and never in a share, a webhook, a signal or another account.
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.
customer_sourceenum
Required with contact: you attest the contact belongs to your customer's account with you. The older field name customer is refused. One of merchant_account.
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.
checkout_jwtstring
Your AP2 Checkout JWT for this cart. The challenge then carries ap2 content.
intent_tokenstring
The token the agent sent with this checkout (the Provenance-Intent header, or the ACP or x402 extension value). Verified first: valid for this cart, nobody is asked.
external_confirmationobject
A confirmation the person gave outside Provenance, accepted only when your policy's external_confirmations.accept lists its kind and it verifies for this exact cart. Screenshots, chat transcripts and an agent saying the person confirmed are never a kind. Every plan. See ask once.
Show child attributes
kindenumRequired
ap2_user_mandate: a closed AP2 0.2 mandate SD-JWT; spc: a Secure Payment Confirmation; platform: a listed agent platform's signed confirmation. One of ap2_user_mandate, spc, platform.
evidencestring | objectRequired
The SD-JWT presentation (ap2_user_mandate) or compact JWS (platform) as a string, or the SPC assertion as an object.
Show child attributes
credential_idstring
The passkey's credential ID.
assertionobject
The assertion, base64url fields.
Show child attributes
authenticator_datastringRequired
base64url authenticator data.
client_data_jsonstringRequired
base64url clientDataJSON (type: payment.get).
signaturestringRequired
base64url signature.
public_keystring | object
A passkey your store registered itself: its public key (PEM or JWK). The confirmation is then labelled as your store's credential.
payment_referencestring
The payment you created for this cart (a Stripe PaymentIntent pi_… or charge ch_…), so a chargeback on it finds this decision.
billing_addressobject
Your customer's billing address (store-attested), kept sealed in full with the approval. Your read of the approval returns it; lists and webhooks carry billing, the coarse fields.
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. 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.
ap2object
Ask Provenance to sign the AP2 v0.2 mandates once the person approves with a passkey: the closed Checkout Mandate, and the closed Payment Mandate when payment_instrument is given. Needs checkout_jwt. Pro, or a Free account in its trial; 503 ap2_issuer_unconfigured until this deployment turns the AP2 issuer on.
Show child attributes
issueenumRequired
Sign the mandates. One of true.
holder_keyobject
The agent's P-256 public JWK (kty, crv, x, y): the mandates name it in cnf.jwk, and collecting them from the keyless status needs a DPoP proof from it.
payment_instrumentobject
With ap2: AP2's payment instrument descriptor, so Provenance signs a Payment Mandate too.
Show child attributes
idstringRequired
Your credential provider's id for the instrument.
typestringRequired
card, dpc, …
descriptionstring
What the person sees ("Visa ···· 4242").
payment_methodobject
The card in use (brand, last4, wallet), shown on the approval email and page. More than 4 digits is refused. Display only; not part of the signed cart.
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").

Returns

Promise<CheckoutApproval> With contact: the pending approval this customer already has at this origin (deduped: true).

HTTP operation

POST /v1/authorize/checkout_approvals: Create a cart approval

Errors

Example

const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/checkout_approvals`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "cart": {
      "order_id": "ord_8812",
      "total": 4250,
      "currency": "USD",
      "merchant_id": "harborbean",
      "origin": "https://harborbean.example",
      "items": [
        {
          "sku": "mug-sage",
          "name": "Stoneware mug",
          "quantity": 2,
          "unit_amount": 1900,
          "variant": [
            {
              "name": "Color",
              "value": "Sage"
            }
          ]
        }
      ],
      "adjustments": [
        {
          "kind": "shipping",
          "label": "Standard shipping",
          "amount": 650
        },
        {
          "kind": "discount",
          "label": "WELCOME",
          "amount": -200
        }
      ],
      "fulfillment": {
        "method_label": "Standard shipping",
        "estimate_from": "2026-11-02",
        "estimate_to": "2026-11-05"
      }
    },
    "display": {
      "merchant_name": "Harbor Bean"
    },
    "retry_url": "https://harborbean.example/checkout",
    "billing_address": {
      "line1": "18 Harrow Lane",
      "line2": null,
      "city": "Portland",
      "region": "OR",
      "postal_code": "97205",
      "country": "US"
    },
    "contact": {
      "name": "Maya Chen"
    }
  }),
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.