Skip to content

Commit 50428df

Browse files
authored
Document AgentCard checkout origin matching (#652)
* Document AgentCard checkout origin matching * Move AgentCard autopilot details into spec section
1 parent 29d666e commit 50428df

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

‎integrations/wallets/agentcard.mdx‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ const card = await kernel.vaults.items.upsert("notebook-order", {
368368
merchant: "example shop",
369369
amount: 2306,
370370
currency: "usd",
371+
checkout_origin: "https://shop.example.com",
371372
},
372373
});
373374

@@ -392,6 +393,7 @@ card = kernel.vaults.items.upsert(
392393
"merchant": "example shop",
393394
"amount": 2306,
394395
"currency": "usd",
396+
"checkout_origin": "https://shop.example.com",
395397
},
396398
)
397399

@@ -411,7 +413,8 @@ kernel vaults cards create user-12345 notebook-order \
411413
"wallet": "agentcard-wallet",
412414
"merchant": "example shop",
413415
"amount": 2306,
414-
"currency": "usd"
416+
"currency": "usd",
417+
"checkout_origin": "https://shop.example.com"
415418
}'
416419
kernel vaults items get user-12345 notebook-order -o json
417420
```
@@ -420,6 +423,25 @@ kernel vaults items get user-12345 notebook-order -o json
420423

421424
`amount` uses minor currency units, so `2306` means 23.06 usd. omitting `card_id` lets the cardholder select an enrolled card on the approval screen. to pin a card, request the wallet's advertised `payment_methods` expansion and set a returned id as `spec.card_id`.
422425

426+
`checkout_origin` is optional. set it to the checkout's canonical origin: an
427+
HTTPS origin with a lowercase host, no default port, and no path (for example,
428+
`https://shop.example.com`), or an HTTP `localhost` origin for local test
429+
pages (for example, `http://localhost:3000`). For non-prepared checkout
430+
authorizations, Kernel sends this caller-supplied origin to AgentCard for
431+
cardholder autopilot rule matching. This origin match isn't payment approval
432+
itself: an eligible autopilot rule can authorize the request, while an
433+
ineligible rule can still fall back to user approval. If you omit the field,
434+
the existing approval behavior remains. Prepared checkout uses the
435+
`merchant_origin` from its preparation instead of this field. Card updates
436+
replace the full `spec`, so include `checkout_origin` again when you want to
437+
keep using it. An autopilot match doesn't guarantee processor acceptance or
438+
payment success.
439+
440+
Kernel doesn't compare `checkout_origin` with the browser's current page. Your
441+
application must derive or validate the origin from a trusted checkout context
442+
and must not treat it as proof of the page's identity. Continue to verify the
443+
merchant and purchase independently before checkout submission.
444+
423445
### Reuse a card item for a new purchase
424446

425447
`upsert` can retrieve an identical item, but it cannot replace the purchase
@@ -451,6 +473,7 @@ reusableCard = await kernel.vaults.items.update("notebook-order", {
451473
merchant: "example books",
452474
amount: 4199,
453475
currency: "usd",
476+
checkout_origin: "https://books.example.com",
454477
},
455478
});
456479
```
@@ -480,6 +503,7 @@ reusable_card = kernel.vaults.items.update(
480503
"merchant": "example books",
481504
"amount": 4199,
482505
"currency": "usd",
506+
"checkout_origin": "https://books.example.com",
483507
},
484508
)
485509
```
@@ -492,7 +516,8 @@ kernel vaults cards update user-12345 notebook-order \
492516
"wallet": "agentcard-wallet",
493517
"merchant": "example books",
494518
"amount": 4199,
495-
"currency": "usd"
519+
"currency": "usd",
520+
"checkout_origin": "https://books.example.com"
496521
}'
497522
```
498523

@@ -721,7 +746,7 @@ wallet and card items accept these `spec` fields. fields not listed here are rej
721746
| item | required fields | optional fields |
722747
| --- | --- | --- |
723748
| wallet | `provider: 'agentcard'` | `provider_config`; `user_id` for a user already enrolled in the organization under the same configuration |
724-
| card | `provider`, `wallet`, `merchant`, `amount`, `currency` | `card_id` |
749+
| card | `provider`, `wallet`, `merchant`, `amount`, `currency` | `card_id`, `checkout_origin` |
725750

726751
agentcard accepts amounts from 1–9007199254740991 and a three-letter `currency`. `merchant` accepts 1–120 printable characters without control characters. `card_id` uses the provider's `vc_` identifier, and wallet `user_id` uses its `usr_` identifier.
727752

0 commit comments

Comments
 (0)