SDK reference · Node SDK
prov.authorize.checkoutApprovals.spcChallenge
prov.authorize.checkoutApprovals.spcChallenge in Node SDK. A single-use Secure Payment Confirmation challenge bound to this exact cart.
Signature
prov.authorize.checkoutApprovals.spcChallenge(params: { cart: Record<string, unknown> }): Promise<{ object: "spc_challenge"; challenge: string; expiresAt: string; rpId: string }>Parameters
params{ cart: Record<string, unknown> }Required
Request fields
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_urlrule). 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'sservice_windowis 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 (
620for Portugal).
Returns
Promise<{ object: "spc_challenge"; challenge: string; expiresAt: string; rpId: string }> The challenge.
HTTP operation
POST /v1/authorize/checkout_approvals/spc_challenge: Create an SPC challenge for a cart
Errors
- authentication_required
- cart_totals_mismatch
- insufficient_scope
- invalid_json
- parameter_invalid
- parameter_missing
- rate_limit_exceeded
Example
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/checkout_approvals/spc_challenge`, {
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": "hb-1",
"name": "House Blend, 1 lb",
"quantity": 2,
"unit_amount": 1900
}
]
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/authorize/checkout_approvals/spc_challenge", 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": "hb-1",
"name": "House Blend, 1 lb",
"quantity": 2,
"unit_amount": 1900
}
]
}
}).json()