SDK reference · Node SDK
prov.authorize.network.createOrder
prov.authorize.network.createOrder in Node SDK. Buy under a network mandate: a cart-bound intent token within the limits, else the person is asked.
Signature
prov.authorize.network.createOrder(params: { networkMandate: string; order: Record<string, unknown>; aud: string; approvalId?: string; paymentMethod?: NetworkOrderPaymentMethod; }): Promise<NetworkAuthorization>Parameters
params{ networkMandate: string; order: Record<string, unknown>; aud: string; approvalId?: string; paymentMethod?: NetworkOrderPaymentMethod; }Required
Request fields
network_mandatestringRequired- The network-mandate token the person granted.
orderobjectRequiredcheckoutBinding(order)from@provenanceauth/rails/checkout: the store's normalized order.audstringRequired- The store's origin; it must equal
order.origin. approval_idstring- After the person approved this exact order outside the limits.
counter_offer_idstring- The accepted proposal this order buys. The order must match the acceptance (amount with the option's tax and fees, currency, store, lines), and uses it once (409
counter_offer_terms_changedorcounter_offer_closed). The person's yes on it is this order's approval. payment_methodobject- The card this order pays with (brand, last four, wallet), never a card number. It joins the person's card list; when the grant names another card, the order asks (
payment_card_mismatch).Show child attributes
brandenumRequired- The card's brand. One of
visa,mastercard,amex,discover,jcb,unionpay,diners,other. last4stringRequired- The card's last four digits.
walletstring- The wallet it pays through (
apple_pay). network_tokenboolean- True when the card is a network agent token.
agent_sessionobject- This run of your agent, so the person sees it as its own session and can stop or limit it. A stopped session is refused with
session_stopped.Show child attributes
idstringRequired- Your session's ID (stored hashed).
clientobject- The label the person sees.
Show child attributes
namestring- Your agent's name.
versionstring- Its version.
workspacestring- What this run works on, shown to the person.
Returns
Promise<NetworkAuthorization> authorized, approval_required or refused.
HTTP operation
POST /v1/mandate/network_orders: Buy under a network mandate
Errors
Example
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/network_orders`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"network_mandate": "eyJhbGciOiJFUzI1NiIsInR5cCI6Im5ldHdvcmstbWFuZGF0ZStqd3QifQ.eyJqdGkiOiJubWRfMDFNNVg5QTJCN1E5VjNOOEs0VDZXMVkwUjUifQ.sig",
"aud": "https://shop.quillstack.example",
"order": {
"order_id": "ord_88213",
"total": 3800,
"currency": "usd",
"merchant_id": "m_quillstack",
"origin": "https://shop.quillstack.example",
"items": [
{
"sku": "nb-linen",
"name": "Linen notebook",
"quantity": 2,
"unit_amount": 1900
}
]
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/network_orders", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"network_mandate": "eyJhbGciOiJFUzI1NiIsInR5cCI6Im5ldHdvcmstbWFuZGF0ZStqd3QifQ.eyJqdGkiOiJubWRfMDFNNVg5QTJCN1E5VjNOOEs0VDZXMVkwUjUifQ.sig",
"aud": "https://shop.quillstack.example",
"order": {
"order_id": "ord_88213",
"total": 3800,
"currency": "usd",
"merchant_id": "m_quillstack",
"origin": "https://shop.quillstack.example",
"items": [
{
"sku": "nb-linen",
"name": "Linen notebook",
"quantity": 2,
"unit_amount": 1900
}
]
}
}).json()