@curless/agentbank-merchant-sdk 0.9.3 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,10 +37,13 @@ export type Checkout = {
|
|
|
37
37
|
*/
|
|
38
38
|
mandate?: unknown;
|
|
39
39
|
/**
|
|
40
|
-
* UCP
|
|
41
|
-
* for a
|
|
42
|
-
*
|
|
43
|
-
*
|
|
40
|
+
* UCP stablecoin sessions only: the frozen x402 challenge (payTo / asset /
|
|
41
|
+
* network / amount) for a stablecoin-priced session. "UCP supports x402" is
|
|
42
|
+
* chain-agnostic, so `currency` picks the chain: USDC (EVM) or RLUSD (XRP
|
|
43
|
+
* Ledger). Hand `x402.accepts[0]` to the buyer agent to sign for that chain
|
|
44
|
+
* (an EIP-3009 authorization for USDC, an XRPL Payment for RLUSD) and pay at
|
|
45
|
+
* /complete (X-PAYMENT header), settled over the stablecoin rail. Undefined for
|
|
46
|
+
* a card-priced session.
|
|
44
47
|
*/
|
|
45
48
|
x402?: {
|
|
46
49
|
x402Version: number;
|
|
@@ -56,8 +59,10 @@ export declare class CheckoutResource {
|
|
|
56
59
|
}
|
|
57
60
|
export type OpenX402CheckoutInput = {
|
|
58
61
|
items: CheckoutLineItem[];
|
|
59
|
-
/** Authoritative total in
|
|
62
|
+
/** Authoritative total in 6-dp minor units (USDC/RLUSD share the scale). YOU set this. */
|
|
60
63
|
amount: number;
|
|
64
|
+
/** Stablecoin to receive: 'USDC' (default, EVM) or 'RLUSD' (XRP Ledger). */
|
|
65
|
+
currency?: string;
|
|
61
66
|
/** Overrides the client's configured `merchantId` for this call. */
|
|
62
67
|
merchantId?: string;
|
|
63
68
|
/** Stripe-style idempotency key — send the same value on a retry to dedup. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/resources/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAA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C9E,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -29,12 +29,13 @@ export class CheckoutResource {
|
|
|
29
29
|
const amount = session.totals?.find((t) => t.type === 'total')?.amount ?? 0;
|
|
30
30
|
return { id: session.id, status: session.status, amount, currency: session.currency };
|
|
31
31
|
}
|
|
32
|
-
// Merchant-quoted x402
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
32
|
+
// Merchant-quoted x402 checkout — the stablecoin twin of `openACP`. YOU set the
|
|
33
|
+
// authoritative amount (6-dp minor units); the gateway freezes it and returns
|
|
34
|
+
// the x402 challenge. A buyer agent then pays it by signing against `accepts[0]`
|
|
35
|
+
// and POSTing `{ sessionId }` to /x402/:merchantId/checkout — it can't change
|
|
36
|
+
// the amount. `currency` picks the chain: USDC (default, EVM, EIP-3009) or
|
|
37
|
+
// RLUSD (XRP Ledger, an Ed25519-signed Payment). Settlement is on-chain via the
|
|
38
|
+
// matching x402 facilitator; the stablecoin lands at your address.
|
|
38
39
|
async openX402(input) {
|
|
39
40
|
const merchantId = input.merchantId ?? this.client.merchantId;
|
|
40
41
|
if (!merchantId) {
|
|
@@ -44,6 +45,9 @@ export class CheckoutResource {
|
|
|
44
45
|
idempotencyKey: input.idempotencyKey,
|
|
45
46
|
body: {
|
|
46
47
|
amount: input.amount,
|
|
48
|
+
// Omitted → the gateway defaults to USDC (EVM), so existing callers are
|
|
49
|
+
// unchanged. 'RLUSD' opens an XRP Ledger session instead.
|
|
50
|
+
...(input.currency ? { currency: input.currency } : {}),
|
|
47
51
|
items: input.items.map((it) => ({
|
|
48
52
|
id: it.sku,
|
|
49
53
|
quantity: it.quantity,
|
|
@@ -52,11 +56,15 @@ export class CheckoutResource {
|
|
|
52
56
|
},
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
|
-
// Merchant-quoted UCP
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
// credential
|
|
59
|
-
// the card rail
|
|
59
|
+
// Merchant-quoted UCP checkout — the UCP twin of `openACP`. YOU price the
|
|
60
|
+
// order; the gateway opens a UCP checkout session (it holds no catalog) and
|
|
61
|
+
// returns it. `currency` picks how the buyer settles it: a fiat currency
|
|
62
|
+
// (USD/EUR) → the buyer POSTs a delegated card credential / AP2 PaymentMandate,
|
|
63
|
+
// settled on the card rail (like ACP, over the UCP wire, ucp.dev). A stablecoin
|
|
64
|
+
// currency → "UCP supports x402" (chain-agnostic): the gateway freezes an x402
|
|
65
|
+
// challenge on the session (`x402.accepts[0]`) and the buyer pays with an
|
|
66
|
+
// X-PAYMENT — USDC (EVM, EIP-3009) or RLUSD (XRP Ledger, an Ed25519 Payment) —
|
|
67
|
+
// settled over the stablecoin rail. One UCP session, card + either stablecoin.
|
|
60
68
|
async openUCP(input) {
|
|
61
69
|
const merchantId = input.merchantId ?? this.client.merchantId;
|
|
62
70
|
if (!merchantId) {
|
|
@@ -66,8 +74,9 @@ export class CheckoutResource {
|
|
|
66
74
|
idempotencyKey: input.idempotencyKey,
|
|
67
75
|
body: {
|
|
68
76
|
// UCP wire: { item: { id, title, price: { amount, currency } }, quantity }
|
|
69
|
-
// — quantity sits outside `item`; the merchant prices each item. A
|
|
70
|
-
// currency makes the gateway freeze an x402
|
|
77
|
+
// — quantity sits outside `item`; the merchant prices each item. A
|
|
78
|
+
// stablecoin currency (USDC/RLUSD) makes the gateway freeze an x402
|
|
79
|
+
// challenge on the session for that chain.
|
|
71
80
|
line_items: input.items.map((it) => ({
|
|
72
81
|
item: {
|
|
73
82
|
id: it.sku,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/resources/checkout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file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
-
"version": "0.
|
|
4
|
-
"description": "Merchant-side SDK for agentbank — accept agent payments: open a merchant-quoted card (ACP / UCP) or
|
|
3
|
+
"version": "0.10.1",
|
|
4
|
+
"description": "Merchant-side SDK for agentbank — accept agent payments: open a merchant-quoted card (ACP / UCP) or stablecoin (x402: USDC on EVM / RLUSD on the XRP Ledger) checkout you price, list/summarize orders, PaymentIntents, edge-safe webhook verification, and x402 helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|