@peable.to/contracts 4.1.0 → 5.1.0
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.
- package/dist/cjs/resources/checkout/checkoutSessions.js +22 -1
- package/dist/cjs/resources/payments/paymentIntents.js +42 -5
- package/dist/cjs/resources/payments/social.js +6 -1
- package/dist/cjs/vocabulary/errors.js +1 -0
- package/dist/cjs/vocabulary/payments.js +7 -2
- package/dist/esm/resources/checkout/checkoutSessions.js +22 -1
- package/dist/esm/resources/payments/paymentIntents.js +41 -4
- package/dist/esm/resources/payments/social.js +6 -1
- package/dist/esm/vocabulary/errors.js +1 -0
- package/dist/esm/vocabulary/payments.js +7 -2
- package/dist/types/resources/checkout/checkoutSessions.d.ts +9 -0
- package/dist/types/resources/checkout/index.d.ts +4 -0
- package/dist/types/resources/payments/index.d.ts +142 -30
- package/dist/types/resources/payments/paymentIntents.d.ts +159 -33
- package/dist/types/resources/payments/social.d.ts +3 -0
- package/dist/types/resources/payments/testHelpers.d.ts +14 -3
- package/dist/types/vocabulary/errors.d.ts +1 -0
- package/dist/types/vocabulary/payments.d.ts +7 -3
- package/package.json +1 -1
|
@@ -250,6 +250,9 @@ exports.sessionLineItemParams = zod_1.z
|
|
|
250
250
|
price_data: priceDataParams.optional(),
|
|
251
251
|
quantity: shared_1.quantityParam,
|
|
252
252
|
adjustable_quantity: shared_1.adjustableQuantityParam.optional(),
|
|
253
|
+
connected_account: shared_1.checkoutIdParam
|
|
254
|
+
.optional()
|
|
255
|
+
.describe("The seller (`ca_…`) this line is sold by (ADR 0021 D6). A FairCoin payment pays every seller of the order its share directly, in one transaction, split by each seller's lines' `amount_subtotal`; a line without one is the merchant's own sale. The card payment stays the merchant's charge. Exclusive with the session's `connected_account`."),
|
|
253
256
|
})
|
|
254
257
|
.strict()
|
|
255
258
|
.superRefine((line, ctx) => {
|
|
@@ -319,7 +322,15 @@ exports.createCheckoutSessionParams = zod_1.z
|
|
|
319
322
|
submit_type: zod_1.z.enum(checkout_1.CHECKOUT_SUBMIT_TYPES).optional(),
|
|
320
323
|
connected_account: shared_1.checkoutIdParam
|
|
321
324
|
.optional()
|
|
322
|
-
.describe('Pay this seller (`ca_…`) rather than the merchant (ADR 0012); FairCoin only.'),
|
|
325
|
+
.describe('Pay this seller (`ca_…`) rather than the merchant (ADR 0012); FairCoin only. Exclusive with `line_items[].connected_account`.'),
|
|
326
|
+
payment_intent_data: zod_1.z
|
|
327
|
+
.object({
|
|
328
|
+
metadata: params_1.metadataCreateParam
|
|
329
|
+
.optional()
|
|
330
|
+
.describe('Copied to EVERY payment this session creates (each method the payer confirms, each fresh quote), so its events carry your own identifiers (ADR 0021 D8).'),
|
|
331
|
+
})
|
|
332
|
+
.strict()
|
|
333
|
+
.optional(),
|
|
323
334
|
expand: params_1.expandParam.optional(),
|
|
324
335
|
})
|
|
325
336
|
.strict()
|
|
@@ -360,6 +371,16 @@ exports.createCheckoutSessionParams = zod_1.z
|
|
|
360
371
|
if (body.submit_type !== undefined && mode !== 'payment') {
|
|
361
372
|
issue('submit_type', 'submit_type is for payment mode');
|
|
362
373
|
}
|
|
374
|
+
if (body.line_items?.some((line) => line.connected_account !== undefined)) {
|
|
375
|
+
if (body.connected_account !== undefined) {
|
|
376
|
+
issue('connected_account', 'connected_account and line_items[].connected_account are mutually exclusive');
|
|
377
|
+
}
|
|
378
|
+
if (mode !== 'payment')
|
|
379
|
+
issue('line_items', 'a line names its seller in payment mode only');
|
|
380
|
+
}
|
|
381
|
+
if (body.payment_intent_data !== undefined && mode === 'setup') {
|
|
382
|
+
issue('payment_intent_data', 'a setup session creates no payment');
|
|
383
|
+
}
|
|
363
384
|
});
|
|
364
385
|
/** `POST /v1/checkout_sessions/{id}` — the merchant's `metadata`, as a patch. */
|
|
365
386
|
exports.updateCheckoutSessionParams = zod_1.z
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.paymentIntentRoutes = exports.clientSecretQuery = exports.retrievePaymentIntentQuery = exports.clientSecretParam = exports.listPaymentIntentsQuery = exports.submitPaymentIntentTxParams = exports.cancelPaymentIntentParams = exports.capturePaymentIntentParams = exports.confirmPaymentIntentParams = exports.updatePaymentIntentParams = exports.createPaymentIntentParams = exports.connectedAccountParam = exports.railParams = exports.paymentIntentSchema = exports.paymentIntentClientActionSchema = exports.clientActionSchema = exports.paymentIntentTransferDataSchema = exports.paymentIntentFaircoinSchema = exports.faircoinQuoteSchema = exports.paymentIntentNextActionSchema = exports.paymentErrorSchema = void 0;
|
|
3
|
+
exports.paymentIntentRoutes = exports.clientSecretQuery = exports.retrievePaymentIntentQuery = exports.clientSecretParam = exports.listPaymentIntentsQuery = exports.submitPaymentIntentTxParams = exports.cancelPaymentIntentParams = exports.capturePaymentIntentParams = exports.confirmPaymentIntentParams = exports.updatePaymentIntentParams = exports.createPaymentIntentParams = exports.connectedAccountParam = exports.railParams = exports.paymentIntentSchema = exports.paymentIntentClientActionSchema = exports.clientActionSchema = exports.paymentIntentTransferDataSchema = exports.paymentIntentFaircoinSchema = exports.faircoinQuoteSchema = exports.paymentIntentNextActionSchema = exports.faircoinPaymentOutputSchema = exports.paymentErrorSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const address_1 = require("../../common/address");
|
|
6
6
|
const envelopes_1 = require("../../common/envelopes");
|
|
@@ -26,6 +26,8 @@ exports.paymentErrorSchema = (0, objects_1.defineComponent)('PaymentError', zod_
|
|
|
26
26
|
message: zod_1.z.string(),
|
|
27
27
|
})
|
|
28
28
|
.strict());
|
|
29
|
+
/** One output of a FairCoin payment, as the payer pays it (ADR 0021 D6). */
|
|
30
|
+
exports.faircoinPaymentOutputSchema = (0, objects_1.defineComponent)('FaircoinPaymentOutput', zod_1.z.object({ address: zod_1.z.string(), amount: primitives_1.amount }).strict());
|
|
29
31
|
/**
|
|
30
32
|
* What the payer must do next (`status: 'requires_action'`).
|
|
31
33
|
*
|
|
@@ -41,11 +43,21 @@ exports.paymentIntentNextActionSchema = (0, objects_1.defineComponent)('PaymentI
|
|
|
41
43
|
type: zod_1.z.literal('faircoin_payment'),
|
|
42
44
|
faircoin_payment: zod_1.z
|
|
43
45
|
.object({
|
|
44
|
-
address: zod_1.z
|
|
46
|
+
address: zod_1.z
|
|
47
|
+
.string()
|
|
48
|
+
.nullable()
|
|
49
|
+
.describe("The one output's address; `null` when the payment has several outputs (read `outputs`)."),
|
|
45
50
|
network: primitives_1.network,
|
|
46
|
-
amount: primitives_1.amount,
|
|
51
|
+
amount: primitives_1.amount.describe('The sum of every output, in base units.'),
|
|
47
52
|
currency: zod_1.z.literal('FAIR'),
|
|
48
|
-
uri: zod_1.z
|
|
53
|
+
uri: zod_1.z
|
|
54
|
+
.string()
|
|
55
|
+
.nullable()
|
|
56
|
+
.describe('The `faircoin:` URI a wallet scans; `null` when the payment has several outputs (a `faircoin:` URI names one address, so only the Peable wallet can pay it).'),
|
|
57
|
+
outputs: zod_1.z
|
|
58
|
+
.array(exports.faircoinPaymentOutputSchema)
|
|
59
|
+
.min(1)
|
|
60
|
+
.describe('Every output the ONE transaction must carry (ADR 0021 D6): each address receives at least its amount, or the whole payment is `canceled` `underpaid`.'),
|
|
49
61
|
})
|
|
50
62
|
.strict(),
|
|
51
63
|
})
|
|
@@ -95,13 +107,30 @@ exports.paymentIntentFaircoinSchema = (0, objects_1.defineComponent)('PaymentInt
|
|
|
95
107
|
network: primitives_1.network,
|
|
96
108
|
address: zod_1.z
|
|
97
109
|
.string()
|
|
98
|
-
.
|
|
110
|
+
.nullable()
|
|
111
|
+
.describe("Receive address in the Peable wallet of the account this payment pays (the merchant's owner, or the seller), derived per payment from that account's public identity key (ADR 0021 D5); `null` when the payment pays several accounts (read `outputs`)."),
|
|
112
|
+
outputs: zod_1.z
|
|
113
|
+
.array(zod_1.z
|
|
114
|
+
.object({
|
|
115
|
+
address: zod_1.z.string(),
|
|
116
|
+
amount: primitives_1.amount,
|
|
117
|
+
connected_account: zod_1.z
|
|
118
|
+
.string()
|
|
119
|
+
.nullable()
|
|
120
|
+
.describe("The seller (`ca_…`) this output pays; `null` for the merchant's owner."),
|
|
121
|
+
})
|
|
122
|
+
.strict())
|
|
123
|
+
.min(1)
|
|
124
|
+
.describe("Every output of the payment's ONE transaction, in order (ADR 0021 D6). Each pays one account's Peable wallet; the watcher verifies each."),
|
|
99
125
|
txid: primitives_1.nullableString,
|
|
100
126
|
confirmations: zod_1.z.number().int().nonnegative(),
|
|
101
127
|
required_confirmations: zod_1.z.number().int().nonnegative(),
|
|
102
128
|
quote: exports.faircoinQuoteSchema
|
|
103
129
|
.nullable()
|
|
104
130
|
.describe('The fiat order this payment pays, as quoted (ADR 0021); `null` on a FAIR-priced payment.'),
|
|
131
|
+
recipient_key_replaced_at: primitives_1.unixSeconds
|
|
132
|
+
.nullable()
|
|
133
|
+
.describe("When Peable found that a recipient's identity key had been replaced after this payment's address was reserved, while the payer had already broadcast (ADR 0002, amended 2026-11-06). The coins are at the address reserved under the PREVIOUS key: spendable only with that key, which the recipient may no longer hold. `null` when every recorded key is still the recipient's `#key-1`, and on a payment written before keys were recorded. A payment nobody had paid yet is never left open under a replaced key: it is canceled with `cancellation_reason: recipient_key_changed`."),
|
|
105
134
|
})
|
|
106
135
|
.strict());
|
|
107
136
|
/** Where a destination charge's funds go (`transfer_data`, ADR 0015 §2). */
|
|
@@ -217,6 +246,7 @@ exports.paymentIntentSchema = (0, objects_1.defineObject)('payment_intent', 'Pay
|
|
|
217
246
|
amount: '150000000',
|
|
218
247
|
currency: 'FAIR',
|
|
219
248
|
uri: 'faircoin:fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG?amount=1.5',
|
|
249
|
+
outputs: [{ address: 'fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG', amount: '150000000' }],
|
|
220
250
|
},
|
|
221
251
|
},
|
|
222
252
|
last_payment_error: null,
|
|
@@ -229,6 +259,13 @@ exports.paymentIntentSchema = (0, objects_1.defineObject)('payment_intent', 'Pay
|
|
|
229
259
|
faircoin: {
|
|
230
260
|
network: 'testnet',
|
|
231
261
|
address: 'fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG',
|
|
262
|
+
outputs: [
|
|
263
|
+
{
|
|
264
|
+
address: 'fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG',
|
|
265
|
+
amount: '150000000',
|
|
266
|
+
connected_account: null,
|
|
267
|
+
},
|
|
268
|
+
],
|
|
232
269
|
txid: null,
|
|
233
270
|
confirmations: 0,
|
|
234
271
|
required_confirmations: 6,
|
|
@@ -99,7 +99,11 @@ exports.socialReceiveCursorSchema = (0, objects_1.defineComponent)('SocialReceiv
|
|
|
99
99
|
identity_public_key: zod_1.z
|
|
100
100
|
.string()
|
|
101
101
|
.nullable()
|
|
102
|
-
.describe('The identity public key (hex) those addresses derive from; `null` exactly when no address was ever reserved.'),
|
|
102
|
+
.describe('The identity public key (hex) those addresses derive from — the key recorded at the LAST reservation; `null` exactly when no address was ever reserved.'),
|
|
103
|
+
account_identity_public_key: zod_1.z
|
|
104
|
+
.string()
|
|
105
|
+
.nullable()
|
|
106
|
+
.describe("The caller's CURRENT identity public key: their DID's `#key-1`, read from Oxy at request time (never cached), as lowercase hex of the key exactly as the DID publishes it (`publicKeyHex`, the compressed secp256k1 key) — the same encoding as `identity_public_key`. Compare the device's key with THIS, not with `identity_public_key`, which only says what the last reservation used. `null` for a keyless (custodial) account."),
|
|
103
107
|
})
|
|
104
108
|
.strict());
|
|
105
109
|
exports.socialPaymentsQuery = networkQuery;
|
|
@@ -154,6 +158,7 @@ exports.socialRoutes = [
|
|
|
154
158
|
path: '/v1/social/me/cursor',
|
|
155
159
|
tag: 'Social payments',
|
|
156
160
|
summary: "Retrieve the caller's receive cursor",
|
|
161
|
+
description: "How far the caller's receive tree has been reserved, the key the last reservation used, and the caller's current `#key-1` read fresh from Oxy (ADR 0002). A 503 when Oxy cannot be asked for the current key.",
|
|
157
162
|
auth: 'user',
|
|
158
163
|
query: exports.socialReceiveCursorQuery,
|
|
159
164
|
response: exports.socialReceiveCursorSchema,
|
|
@@ -134,6 +134,7 @@ exports.ERROR_CODE_DESCRIPTIONS = {
|
|
|
134
134
|
faircoin_price_unavailable: 'No fresh FairCoin price exists right now, so this order cannot be quoted in FAIR. The other payment methods still work; try FairCoin again shortly.',
|
|
135
135
|
faircoin_wallet_missing: "The Peable wallet that receives this payment (the merchant owner's, or the seller's) isn't set up yet, so it cannot be paid in FairCoin. The other payment methods still work.",
|
|
136
136
|
faircoin_network_closed: 'FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.',
|
|
137
|
+
faircoin_amount_too_small: "One seller's share of this order is below the smallest amount the FairCoin network relays, so it cannot be paid in FairCoin. The other payment methods still work.",
|
|
137
138
|
credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.",
|
|
138
139
|
test_clock_unexpected_state: 'The test clock is advancing; wait until it is ready.',
|
|
139
140
|
meter_event_customer_missing: 'The meter event names no customer of this merchant.',
|
|
@@ -26,14 +26,19 @@ exports.PAYMENT_INTENT_STATUSES = [
|
|
|
26
26
|
'canceled',
|
|
27
27
|
];
|
|
28
28
|
/**
|
|
29
|
-
* Why an intent was cancelled — Stripe's reasons, plus
|
|
30
|
-
*
|
|
29
|
+
* Why an intent was cancelled — Stripe's reasons, plus two FairCoin-only ones:
|
|
30
|
+
* `underpaid` (a transaction paid less than the amount) and
|
|
31
|
+
* `recipient_key_changed` (the recipient's identity key was replaced after the
|
|
32
|
+
* address was reserved, so the address is no longer in the wallet it pays —
|
|
33
|
+
* ADR 0002, amended 2026-11-06; nothing had been broadcast, and the order stays
|
|
34
|
+
* open for a fresh address).
|
|
31
35
|
*/
|
|
32
36
|
exports.PAYMENT_INTENT_CANCELLATION_REASONS = [
|
|
33
37
|
'abandoned',
|
|
34
38
|
'automatic',
|
|
35
39
|
'duplicate',
|
|
36
40
|
'fraudulent',
|
|
41
|
+
'recipient_key_changed',
|
|
37
42
|
'requested_by_customer',
|
|
38
43
|
'underpaid',
|
|
39
44
|
];
|
|
@@ -247,6 +247,9 @@ export const sessionLineItemParams = z
|
|
|
247
247
|
price_data: priceDataParams.optional(),
|
|
248
248
|
quantity: quantityParam,
|
|
249
249
|
adjustable_quantity: adjustableQuantityParam.optional(),
|
|
250
|
+
connected_account: checkoutIdParam
|
|
251
|
+
.optional()
|
|
252
|
+
.describe("The seller (`ca_…`) this line is sold by (ADR 0021 D6). A FairCoin payment pays every seller of the order its share directly, in one transaction, split by each seller's lines' `amount_subtotal`; a line without one is the merchant's own sale. The card payment stays the merchant's charge. Exclusive with the session's `connected_account`."),
|
|
250
253
|
})
|
|
251
254
|
.strict()
|
|
252
255
|
.superRefine((line, ctx) => {
|
|
@@ -316,7 +319,15 @@ export const createCheckoutSessionParams = z
|
|
|
316
319
|
submit_type: z.enum(CHECKOUT_SUBMIT_TYPES).optional(),
|
|
317
320
|
connected_account: checkoutIdParam
|
|
318
321
|
.optional()
|
|
319
|
-
.describe('Pay this seller (`ca_…`) rather than the merchant (ADR 0012); FairCoin only.'),
|
|
322
|
+
.describe('Pay this seller (`ca_…`) rather than the merchant (ADR 0012); FairCoin only. Exclusive with `line_items[].connected_account`.'),
|
|
323
|
+
payment_intent_data: z
|
|
324
|
+
.object({
|
|
325
|
+
metadata: metadataCreateParam
|
|
326
|
+
.optional()
|
|
327
|
+
.describe('Copied to EVERY payment this session creates (each method the payer confirms, each fresh quote), so its events carry your own identifiers (ADR 0021 D8).'),
|
|
328
|
+
})
|
|
329
|
+
.strict()
|
|
330
|
+
.optional(),
|
|
320
331
|
expand: expandParam.optional(),
|
|
321
332
|
})
|
|
322
333
|
.strict()
|
|
@@ -357,6 +368,16 @@ export const createCheckoutSessionParams = z
|
|
|
357
368
|
if (body.submit_type !== undefined && mode !== 'payment') {
|
|
358
369
|
issue('submit_type', 'submit_type is for payment mode');
|
|
359
370
|
}
|
|
371
|
+
if (body.line_items?.some((line) => line.connected_account !== undefined)) {
|
|
372
|
+
if (body.connected_account !== undefined) {
|
|
373
|
+
issue('connected_account', 'connected_account and line_items[].connected_account are mutually exclusive');
|
|
374
|
+
}
|
|
375
|
+
if (mode !== 'payment')
|
|
376
|
+
issue('line_items', 'a line names its seller in payment mode only');
|
|
377
|
+
}
|
|
378
|
+
if (body.payment_intent_data !== undefined && mode === 'setup') {
|
|
379
|
+
issue('payment_intent_data', 'a setup session creates no payment');
|
|
380
|
+
}
|
|
360
381
|
});
|
|
361
382
|
/** `POST /v1/checkout_sessions/{id}` — the merchant's `metadata`, as a patch. */
|
|
362
383
|
export const updateCheckoutSessionParams = z
|
|
@@ -23,6 +23,8 @@ export const paymentErrorSchema = defineComponent('PaymentError', z
|
|
|
23
23
|
message: z.string(),
|
|
24
24
|
})
|
|
25
25
|
.strict());
|
|
26
|
+
/** One output of a FairCoin payment, as the payer pays it (ADR 0021 D6). */
|
|
27
|
+
export const faircoinPaymentOutputSchema = defineComponent('FaircoinPaymentOutput', z.object({ address: z.string(), amount }).strict());
|
|
26
28
|
/**
|
|
27
29
|
* What the payer must do next (`status: 'requires_action'`).
|
|
28
30
|
*
|
|
@@ -38,11 +40,21 @@ export const paymentIntentNextActionSchema = defineComponent('PaymentIntentNextA
|
|
|
38
40
|
type: z.literal('faircoin_payment'),
|
|
39
41
|
faircoin_payment: z
|
|
40
42
|
.object({
|
|
41
|
-
address: z
|
|
43
|
+
address: z
|
|
44
|
+
.string()
|
|
45
|
+
.nullable()
|
|
46
|
+
.describe("The one output's address; `null` when the payment has several outputs (read `outputs`)."),
|
|
42
47
|
network,
|
|
43
|
-
amount,
|
|
48
|
+
amount: amount.describe('The sum of every output, in base units.'),
|
|
44
49
|
currency: z.literal('FAIR'),
|
|
45
|
-
uri: z
|
|
50
|
+
uri: z
|
|
51
|
+
.string()
|
|
52
|
+
.nullable()
|
|
53
|
+
.describe('The `faircoin:` URI a wallet scans; `null` when the payment has several outputs (a `faircoin:` URI names one address, so only the Peable wallet can pay it).'),
|
|
54
|
+
outputs: z
|
|
55
|
+
.array(faircoinPaymentOutputSchema)
|
|
56
|
+
.min(1)
|
|
57
|
+
.describe('Every output the ONE transaction must carry (ADR 0021 D6): each address receives at least its amount, or the whole payment is `canceled` `underpaid`.'),
|
|
46
58
|
})
|
|
47
59
|
.strict(),
|
|
48
60
|
})
|
|
@@ -92,13 +104,30 @@ export const paymentIntentFaircoinSchema = defineComponent('PaymentIntentFaircoi
|
|
|
92
104
|
network,
|
|
93
105
|
address: z
|
|
94
106
|
.string()
|
|
95
|
-
.
|
|
107
|
+
.nullable()
|
|
108
|
+
.describe("Receive address in the Peable wallet of the account this payment pays (the merchant's owner, or the seller), derived per payment from that account's public identity key (ADR 0021 D5); `null` when the payment pays several accounts (read `outputs`)."),
|
|
109
|
+
outputs: z
|
|
110
|
+
.array(z
|
|
111
|
+
.object({
|
|
112
|
+
address: z.string(),
|
|
113
|
+
amount,
|
|
114
|
+
connected_account: z
|
|
115
|
+
.string()
|
|
116
|
+
.nullable()
|
|
117
|
+
.describe("The seller (`ca_…`) this output pays; `null` for the merchant's owner."),
|
|
118
|
+
})
|
|
119
|
+
.strict())
|
|
120
|
+
.min(1)
|
|
121
|
+
.describe("Every output of the payment's ONE transaction, in order (ADR 0021 D6). Each pays one account's Peable wallet; the watcher verifies each."),
|
|
96
122
|
txid: nullableString,
|
|
97
123
|
confirmations: z.number().int().nonnegative(),
|
|
98
124
|
required_confirmations: z.number().int().nonnegative(),
|
|
99
125
|
quote: faircoinQuoteSchema
|
|
100
126
|
.nullable()
|
|
101
127
|
.describe('The fiat order this payment pays, as quoted (ADR 0021); `null` on a FAIR-priced payment.'),
|
|
128
|
+
recipient_key_replaced_at: unixSeconds
|
|
129
|
+
.nullable()
|
|
130
|
+
.describe("When Peable found that a recipient's identity key had been replaced after this payment's address was reserved, while the payer had already broadcast (ADR 0002, amended 2026-11-06). The coins are at the address reserved under the PREVIOUS key: spendable only with that key, which the recipient may no longer hold. `null` when every recorded key is still the recipient's `#key-1`, and on a payment written before keys were recorded. A payment nobody had paid yet is never left open under a replaced key: it is canceled with `cancellation_reason: recipient_key_changed`."),
|
|
102
131
|
})
|
|
103
132
|
.strict());
|
|
104
133
|
/** Where a destination charge's funds go (`transfer_data`, ADR 0015 §2). */
|
|
@@ -214,6 +243,7 @@ export const paymentIntentSchema = defineObject('payment_intent', 'PaymentIntent
|
|
|
214
243
|
amount: '150000000',
|
|
215
244
|
currency: 'FAIR',
|
|
216
245
|
uri: 'faircoin:fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG?amount=1.5',
|
|
246
|
+
outputs: [{ address: 'fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG', amount: '150000000' }],
|
|
217
247
|
},
|
|
218
248
|
},
|
|
219
249
|
last_payment_error: null,
|
|
@@ -226,6 +256,13 @@ export const paymentIntentSchema = defineObject('payment_intent', 'PaymentIntent
|
|
|
226
256
|
faircoin: {
|
|
227
257
|
network: 'testnet',
|
|
228
258
|
address: 'fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG',
|
|
259
|
+
outputs: [
|
|
260
|
+
{
|
|
261
|
+
address: 'fLx9bJ3Wv2kq8mT4sR6nZ1cY7pD5eH0aG',
|
|
262
|
+
amount: '150000000',
|
|
263
|
+
connected_account: null,
|
|
264
|
+
},
|
|
265
|
+
],
|
|
229
266
|
txid: null,
|
|
230
267
|
confirmations: 0,
|
|
231
268
|
required_confirmations: 6,
|
|
@@ -96,7 +96,11 @@ export const socialReceiveCursorSchema = defineComponent('SocialReceiveCursor',
|
|
|
96
96
|
identity_public_key: z
|
|
97
97
|
.string()
|
|
98
98
|
.nullable()
|
|
99
|
-
.describe('The identity public key (hex) those addresses derive from; `null` exactly when no address was ever reserved.'),
|
|
99
|
+
.describe('The identity public key (hex) those addresses derive from — the key recorded at the LAST reservation; `null` exactly when no address was ever reserved.'),
|
|
100
|
+
account_identity_public_key: z
|
|
101
|
+
.string()
|
|
102
|
+
.nullable()
|
|
103
|
+
.describe("The caller's CURRENT identity public key: their DID's `#key-1`, read from Oxy at request time (never cached), as lowercase hex of the key exactly as the DID publishes it (`publicKeyHex`, the compressed secp256k1 key) — the same encoding as `identity_public_key`. Compare the device's key with THIS, not with `identity_public_key`, which only says what the last reservation used. `null` for a keyless (custodial) account."),
|
|
100
104
|
})
|
|
101
105
|
.strict());
|
|
102
106
|
export const socialPaymentsQuery = networkQuery;
|
|
@@ -151,6 +155,7 @@ export const socialRoutes = [
|
|
|
151
155
|
path: '/v1/social/me/cursor',
|
|
152
156
|
tag: 'Social payments',
|
|
153
157
|
summary: "Retrieve the caller's receive cursor",
|
|
158
|
+
description: "How far the caller's receive tree has been reserved, the key the last reservation used, and the caller's current `#key-1` read fresh from Oxy (ADR 0002). A 503 when Oxy cannot be asked for the current key.",
|
|
154
159
|
auth: 'user',
|
|
155
160
|
query: socialReceiveCursorQuery,
|
|
156
161
|
response: socialReceiveCursorSchema,
|
|
@@ -129,6 +129,7 @@ export const ERROR_CODE_DESCRIPTIONS = {
|
|
|
129
129
|
faircoin_price_unavailable: 'No fresh FairCoin price exists right now, so this order cannot be quoted in FAIR. The other payment methods still work; try FairCoin again shortly.',
|
|
130
130
|
faircoin_wallet_missing: "The Peable wallet that receives this payment (the merchant owner's, or the seller's) isn't set up yet, so it cannot be paid in FairCoin. The other payment methods still work.",
|
|
131
131
|
faircoin_network_closed: 'FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.',
|
|
132
|
+
faircoin_amount_too_small: "One seller's share of this order is below the smallest amount the FairCoin network relays, so it cannot be paid in FairCoin. The other payment methods still work.",
|
|
132
133
|
credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.",
|
|
133
134
|
test_clock_unexpected_state: 'The test clock is advancing; wait until it is ready.',
|
|
134
135
|
meter_event_customer_missing: 'The meter event names no customer of this merchant.',
|
|
@@ -23,14 +23,19 @@ export const PAYMENT_INTENT_STATUSES = [
|
|
|
23
23
|
'canceled',
|
|
24
24
|
];
|
|
25
25
|
/**
|
|
26
|
-
* Why an intent was cancelled — Stripe's reasons, plus
|
|
27
|
-
*
|
|
26
|
+
* Why an intent was cancelled — Stripe's reasons, plus two FairCoin-only ones:
|
|
27
|
+
* `underpaid` (a transaction paid less than the amount) and
|
|
28
|
+
* `recipient_key_changed` (the recipient's identity key was replaced after the
|
|
29
|
+
* address was reserved, so the address is no longer in the wallet it pays —
|
|
30
|
+
* ADR 0002, amended 2026-11-06; nothing had been broadcast, and the order stays
|
|
31
|
+
* open for a fresh address).
|
|
28
32
|
*/
|
|
29
33
|
export const PAYMENT_INTENT_CANCELLATION_REASONS = [
|
|
30
34
|
'abandoned',
|
|
31
35
|
'automatic',
|
|
32
36
|
'duplicate',
|
|
33
37
|
'fraudulent',
|
|
38
|
+
'recipient_key_changed',
|
|
34
39
|
'requested_by_customer',
|
|
35
40
|
'underpaid',
|
|
36
41
|
];
|
|
@@ -563,6 +563,7 @@ export declare const sessionLineItemParams: z.ZodObject<{
|
|
|
563
563
|
minimum: z.ZodOptional<z.ZodNumber>;
|
|
564
564
|
maximum: z.ZodOptional<z.ZodNumber>;
|
|
565
565
|
}, z.core.$strict>>;
|
|
566
|
+
connected_account: z.ZodOptional<z.ZodString>;
|
|
566
567
|
}, z.core.$strict>;
|
|
567
568
|
export type CheckoutLineItemParams = z.input<typeof sessionLineItemParams>;
|
|
568
569
|
export declare const createCheckoutSessionParams: z.ZodObject<{
|
|
@@ -598,6 +599,9 @@ export declare const createCheckoutSessionParams: z.ZodObject<{
|
|
|
598
599
|
donate: "donate";
|
|
599
600
|
}>>;
|
|
600
601
|
connected_account: z.ZodOptional<z.ZodString>;
|
|
602
|
+
payment_intent_data: z.ZodOptional<z.ZodObject<{
|
|
603
|
+
metadata: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodString>, z.ZodTransform<Record<string, string>, Record<string, string>>>>;
|
|
604
|
+
}, z.core.$strict>>;
|
|
601
605
|
expand: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodString>>>;
|
|
602
606
|
billing_address_collection: z.ZodOptional<z.ZodEnum<{
|
|
603
607
|
auto: "auto";
|
|
@@ -697,6 +701,7 @@ export declare const createCheckoutSessionParams: z.ZodObject<{
|
|
|
697
701
|
minimum: z.ZodOptional<z.ZodNumber>;
|
|
698
702
|
maximum: z.ZodOptional<z.ZodNumber>;
|
|
699
703
|
}, z.core.$strict>>;
|
|
704
|
+
connected_account: z.ZodOptional<z.ZodString>;
|
|
700
705
|
}, z.core.$strict>>>;
|
|
701
706
|
currency: z.ZodOptional<z.ZodEnum<{
|
|
702
707
|
FAIR: "FAIR";
|
|
@@ -887,6 +892,9 @@ export declare const checkoutSessionRoutes: readonly [{
|
|
|
887
892
|
donate: "donate";
|
|
888
893
|
}>>;
|
|
889
894
|
connected_account: z.ZodOptional<z.ZodString>;
|
|
895
|
+
payment_intent_data: z.ZodOptional<z.ZodObject<{
|
|
896
|
+
metadata: z.ZodOptional<z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodString>, z.ZodTransform<Record<string, string>, Record<string, string>>>>;
|
|
897
|
+
}, z.core.$strict>>;
|
|
890
898
|
expand: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>, z.ZodTransform<string[], string | string[]>>, z.ZodArray<z.ZodString>>>;
|
|
891
899
|
billing_address_collection: z.ZodOptional<z.ZodEnum<{
|
|
892
900
|
auto: "auto";
|
|
@@ -986,6 +994,7 @@ export declare const checkoutSessionRoutes: readonly [{
|
|
|
986
994
|
minimum: z.ZodOptional<z.ZodNumber>;
|
|
987
995
|
maximum: z.ZodOptional<z.ZodNumber>;
|
|
988
996
|
}, z.core.$strict>>;
|
|
997
|
+
connected_account: z.ZodOptional<z.ZodString>;
|
|
989
998
|
}, z.core.$strict>>>;
|
|
990
999
|
currency: z.ZodOptional<z.ZodEnum<{
|
|
991
1000
|
FAIR: "FAIR";
|
|
@@ -48,6 +48,9 @@ export declare const checkoutRoutes: readonly [{
|
|
|
48
48
|
donate: "donate";
|
|
49
49
|
}>>;
|
|
50
50
|
connected_account: import("zod").ZodOptional<import("zod").ZodString>;
|
|
51
|
+
payment_intent_data: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
52
|
+
metadata: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>, import("zod").ZodTransform<Record<string, string>, Record<string, string>>>>;
|
|
53
|
+
}, import("zod/v4/core").$strict>>;
|
|
51
54
|
expand: import("zod").ZodOptional<import("zod").ZodPipe<import("zod").ZodPipe<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>, import("zod").ZodTransform<string[], string | string[]>>, import("zod").ZodArray<import("zod").ZodString>>>;
|
|
52
55
|
billing_address_collection: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
53
56
|
auto: "auto";
|
|
@@ -147,6 +150,7 @@ export declare const checkoutRoutes: readonly [{
|
|
|
147
150
|
minimum: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
148
151
|
maximum: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
149
152
|
}, import("zod/v4/core").$strict>>;
|
|
153
|
+
connected_account: import("zod").ZodOptional<import("zod").ZodString>;
|
|
150
154
|
}, import("zod/v4/core").$strict>>>;
|
|
151
155
|
currency: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
152
156
|
FAIR: "FAIR";
|