SDK reference · Rails
@provenanceauth/rails/checkout
@provenanceauth/rails/checkout in the Rails: 13 methods. Plain web checkout.
Methods
checkoutBinding
checkoutBinding(order: CheckoutOrder): CheckoutOrderThe exact object to pass as action_payload to POST /v1/mandate/intents (agent side) and to rebuild from your own order record (merchant side).
serviceDay
serviceDay(value: unknown): string | nullThe calendar day of a service date or date-time, in its own offset (no time-zone conversion); null when invalid.
checkoutBindingHash
checkoutBindingHash(order: CheckoutOrder): Promise<string>Sha256(canonical JSON) of the binding: the payload_hash a token bound to this order carries.
fulfillmentDigest
fulfillmentDigest(address: Record<string, unknown>): Promise<string>Sha256 hex over the canonical shipping address, for fulfillment_digest.
verifyIpCommitment
verifyIpCommitment(ip: string, nonce: string, commitment: string): Promise<boolean>Check that the approving device's IP you received with a checkout approval (signals.browser.ip and ip_nonce) is the one Provenance saw: commitment (from the decision record, the receipt or an evidence pack) is the hex SHA-256 of the IP's UTF-8 bytes followed by the 16 nonce bytes (base64url).
approvalChallenge
approvalChallenge(order: CheckoutOrder, opts: ApprovalChallengeOptions): { status: 401; headers: Record<string, string>; body: ApprovalProblem }Merchant side: the 401 to send when you want the shopper's approval for this exact order.
cartSummary
cartSummary(binding: Pick<CheckoutOrder, "total" | "currency" | "items">, merchantName: string): stringThe cart in one line, for an agent to show its person ("Harbor Bean Coffee: 2 items, USD 38.00").
mcpApprovalResult
mcpApprovalResult(challenge: { body: ApprovalProblem } | ApprovalProblem | ApprovalRequest): McpApprovalResultGoal 9b: for a store with its own MCP server.
checkoutHeaders
checkoutHeaders(intentToken: string, mandateToken?: string): Record<string, string>Agent side: the headers to add to the checkout request.
publicVerify
publicVerify(baseUrl: string, opts?: { surface?: "page" | "embed" | "checkout" | "api"; fetch?: typeof fetch }): OnlineStatusAn onlineStatus callback for the free, keyless POST /v1/verify.
loadJwks
loadJwks(baseUrl: string, opts?: { maxAgeMs?: number; fetch?: typeof fetch }): { get: (o?: { refresh?: boolean }) => Promise<Jwks> }A cached JWKS getter for <baseUrl>/.well-known/jwks.json.
verifyAgentCheckout
verifyAgentCheckout(headerValue: string | null | undefined, opts: CheckoutVerifyOptions): Promise<CheckoutVerifyResult>Merchant side: verify the Provenance-Intent header against your own order record.
acceptNetworkOrder
acceptNetworkOrder(headerValue: string | null | undefined, opts: NetworkAcceptOptions): Promise<NetworkAcceptResult>Verify a network order offline (signature, the exact order, approval strength), then accept it online: the person's reserved budget becomes spend.