@peable.to/shared-types 0.14.0 → 0.16.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.
@@ -1,73 +1,452 @@
1
1
  import type { BillingFaircoinFxQuote } from './billing';
2
+ import type { Price, Product } from './catalog';
3
+ import type { Customer } from './customer';
4
+ import type { CheckoutBranding } from './branding';
2
5
  import type { CurrencyCode } from './money';
3
- import type { NetworkType } from './network';
4
6
  import type { MerchantDisplay } from './merchantDisplay';
5
- import type { PaymentIntent, PaymentIntentRail } from './paymentIntent';
7
+ import type { NetworkType } from './network';
8
+ import type { Address, AddressParams, PaymentIntent, PaymentIntentRail } from './paymentIntent';
6
9
  import type { ConnectedAccount } from './settlement';
7
- /** The merchant/SDK-facing DTO — returned on create and by merchant retrieve. */
8
- export interface CheckoutSession {
10
+ import type { SetupIntent } from './setupIntent';
11
+ export declare const CHECKOUT_SESSION_MODES: readonly ["payment", "setup", "subscription"];
12
+ export type CheckoutSessionMode = (typeof CHECKOUT_SESSION_MODES)[number];
13
+ export declare const CHECKOUT_SESSION_STATUSES: readonly ["open", "complete", "expired"];
14
+ export type CheckoutSessionStatus = (typeof CHECKOUT_SESSION_STATUSES)[number];
15
+ export declare const CHECKOUT_PAYMENT_STATUSES: readonly ["paid", "unpaid", "no_payment_required"];
16
+ export type CheckoutSessionPaymentStatus = (typeof CHECKOUT_PAYMENT_STATUSES)[number];
17
+ export declare const CHECKOUT_UI_MODES: readonly ["hosted", "embedded"];
18
+ export type CheckoutUiMode = (typeof CHECKOUT_UI_MODES)[number];
19
+ /** The languages the hosted and embedded checkout speak. */
20
+ export declare const CHECKOUT_LOCALES: readonly ["en", "es", "fr", "de", "it", "pt"];
21
+ export type CheckoutLocale = (typeof CHECKOUT_LOCALES)[number];
22
+ export declare const CHECKOUT_SUBMIT_TYPES: readonly ["auto", "pay", "book", "donate"];
23
+ export type CheckoutSubmitType = (typeof CHECKOUT_SUBMIT_TYPES)[number];
24
+ export declare const CHECKOUT_CUSTOMER_CREATIONS: readonly ["always", "if_required"];
25
+ export type CheckoutCustomerCreation = (typeof CHECKOUT_CUSTOMER_CREATIONS)[number];
26
+ export declare const CHECKOUT_BILLING_ADDRESS_COLLECTIONS: readonly ["auto", "required"];
27
+ export type CheckoutBillingAddressCollection = (typeof CHECKOUT_BILLING_ADDRESS_COLLECTIONS)[number];
28
+ export declare const CHECKOUT_CUSTOM_FIELD_TYPES: readonly ["text", "numeric", "dropdown"];
29
+ export type CheckoutCustomFieldType = (typeof CHECKOUT_CUSTOM_FIELD_TYPES)[number];
30
+ /** Stripe's tax id types Peable collects; `eu_vat` covers every EU member state. */
31
+ export declare const CHECKOUT_TAX_ID_TYPES: readonly ["eu_vat", "gb_vat", "ch_vat", "no_vat", "us_ein", "ca_bn"];
32
+ export type CheckoutTaxIdType = (typeof CHECKOUT_TAX_ID_TYPES)[number];
33
+ /**
34
+ * Bounds of the session contract, shared by the gateway's validators and the
35
+ * clients that build requests, so the two cannot drift.
36
+ */
37
+ export declare const CHECKOUT_LIMITS: Readonly<{
38
+ lineItemsMax: 20;
39
+ quantityMax: 999999;
40
+ customFieldsMax: 3;
41
+ customFieldKeyMax: 200;
42
+ customFieldLabelMax: 50;
43
+ customFieldTextMax: 255;
44
+ dropdownOptionsMax: 200;
45
+ dropdownOptionLabelMax: 100;
46
+ dropdownOptionValueMax: 100;
47
+ clientReferenceIdMax: 200;
48
+ /** `expires_at` must be between 30 minutes and 24 hours from creation. */
49
+ expiresMinSeconds: number;
50
+ expiresMaxSeconds: number;
51
+ shippingCountriesMax: 250;
52
+ termsTextMax: 1200;
53
+ }>;
54
+ /** The template a `success_url` may carry; replaced with the session's `cs_…`. */
55
+ export declare const CHECKOUT_SESSION_ID_TEMPLATE = "{CHECKOUT_SESSION_ID}";
56
+ export interface CheckoutAdjustableQuantity {
57
+ enabled: boolean;
58
+ /** Default 0 when enabled. */
59
+ minimum: number | null;
60
+ /** Default 99 when enabled. */
61
+ maximum: number | null;
62
+ }
63
+ /** One line of a session — Stripe's `item` (`GET /v1/checkout_sessions/:id/line_items`). */
64
+ export interface CheckoutLineItem {
9
65
  id: string;
10
- object: 'checkout_session';
66
+ object: 'item';
67
+ /** The product's name, or the inline `product_data.name`. */
68
+ description: string;
11
69
  /**
12
- * Which of the provider's two worlds this object belongs to (ADR 0017):
13
- * `true` for a `production` merchant, `false` for every other environment.
70
+ * The catalog price (`price_…`, or the object with `expand[]=data.price`), or
71
+ * `null` for an inline `price_data` line — an inline price is a snapshot on
72
+ * the line, never a stored `price_…`.
14
73
  */
74
+ price: string | Price | null;
75
+ /** The catalog product (`prod_…`, expandable), or `null` for `product_data`. */
76
+ product: string | Product | null;
77
+ /** Images to show beside the line (the product's, or `product_data.images`). */
78
+ images: string[];
79
+ quantity: number;
80
+ adjustable_quantity: CheckoutAdjustableQuantity | null;
81
+ currency: CurrencyCode;
82
+ /** The per-unit amount for a per-unit price; `null` for a tiered one. */
83
+ unit_amount: string | null;
84
+ /** Before discount and tax. */
85
+ amount_subtotal: string;
86
+ amount_discount: string;
87
+ amount_tax: string;
88
+ /** `amount_subtotal - amount_discount + amount_tax` (exclusive tax only). */
89
+ amount_total: string;
90
+ }
91
+ export interface CheckoutTaxId {
92
+ type: CheckoutTaxIdType;
93
+ value: string;
94
+ }
95
+ /** What the payer told checkout about themselves — Stripe's `customer_details`. */
96
+ export interface CheckoutCustomerDetails {
97
+ email: string | null;
98
+ name: string | null;
99
+ phone: string | null;
100
+ address: Address | null;
101
+ tax_ids: CheckoutTaxId[];
102
+ }
103
+ export interface CheckoutShippingDetails {
104
+ name: string;
105
+ address: Address;
106
+ }
107
+ export interface CheckoutCustomFieldLabel {
108
+ type: 'custom';
109
+ custom: string;
110
+ }
111
+ export interface CheckoutCustomFieldDropdownOption {
112
+ label: string;
113
+ value: string;
114
+ }
115
+ /** A merchant-defined field the payer fills in; `value`s are what they entered. */
116
+ export interface CheckoutCustomField {
117
+ key: string;
118
+ label: CheckoutCustomFieldLabel;
119
+ type: CheckoutCustomFieldType;
120
+ optional: boolean;
121
+ dropdown: {
122
+ options: CheckoutCustomFieldDropdownOption[];
123
+ value: string | null;
124
+ } | null;
125
+ text: {
126
+ minimum_length: number | null;
127
+ maximum_length: number | null;
128
+ value: string | null;
129
+ } | null;
130
+ numeric: {
131
+ minimum_length: number | null;
132
+ maximum_length: number | null;
133
+ value: string | null;
134
+ } | null;
135
+ }
136
+ export interface CheckoutDiscount {
137
+ /** The coupon applied (`coupon` id — merchant-chosen or `coupon_…`). */
138
+ coupon: string;
139
+ /** The promotion code it was redeemed through (`promo_…`), or `null`. */
140
+ promotion_code: string | null;
141
+ }
142
+ export interface CheckoutTotalDetails {
143
+ amount_discount: string;
144
+ amount_tax: string;
145
+ amount_shipping: string;
146
+ }
147
+ /**
148
+ * `automatic_tax` — Peable Tax (ADR 0011). `requires_location_inputs` until
149
+ * the payer gave an address Peable Tax can locate them with; `failed` when the
150
+ * sale is covered and could not be priced (checkout refuses to proceed: tax
151
+ * fails CLOSED, never zero).
152
+ */
153
+ export interface CheckoutAutomaticTax {
154
+ enabled: boolean;
155
+ status: 'complete' | 'requires_location_inputs' | 'failed' | null;
156
+ }
157
+ export interface CheckoutConsentCollection {
158
+ terms_of_service: 'none' | 'required';
159
+ }
160
+ export interface CheckoutConsent {
161
+ terms_of_service: 'accepted' | null;
162
+ }
163
+ export interface CheckoutAfterCompletion {
164
+ type: 'redirect' | 'hosted_confirmation';
165
+ redirect: {
166
+ url: string;
167
+ } | null;
168
+ hosted_confirmation: {
169
+ custom_message: string | null;
170
+ } | null;
171
+ }
172
+ /** The merchant/SDK-facing session — Stripe's Checkout Session. */
173
+ export interface CheckoutSession {
174
+ id: string;
175
+ object: 'checkout_session';
176
+ /** ADR 0017: `true` for a `production` merchant. */
15
177
  livemode: boolean;
16
- /** The wrapped payment's `pi_…`, or the {@link PaymentIntent} with `expand[]=payment_intent`. */
17
- payment_intent: string | PaymentIntent;
18
- /** The wrapped intent's `client_secret`, returned to the merchant on create. */
19
- client_secret: string;
20
- amount: string;
178
+ mode: CheckoutSessionMode;
179
+ status: CheckoutSessionStatus;
180
+ payment_status: CheckoutSessionPaymentStatus;
181
+ ui_mode: CheckoutUiMode;
182
+ /** The language checkout renders in; `null` follows the payer's browser. */
183
+ locale: CheckoutLocale | null;
184
+ submit_type: CheckoutSubmitType;
21
185
  currency: CurrencyCode;
22
186
  rail: PaymentIntentRail;
23
187
  /** FairCoin rail only; `null` on a card session. */
24
188
  network: NetworkType | null;
189
+ payment_method_types: string[];
190
+ amount_subtotal: string;
191
+ amount_total: string;
192
+ total_details: CheckoutTotalDetails;
193
+ discounts: CheckoutDiscount[];
194
+ allow_promotion_codes: boolean;
195
+ automatic_tax: CheckoutAutomaticTax;
196
+ /** `cus_…` (expandable) — given on create, or created at completion. */
197
+ customer: string | Customer | null;
198
+ customer_email: string | null;
199
+ customer_creation: CheckoutCustomerCreation;
200
+ customer_details: CheckoutCustomerDetails | null;
201
+ billing_address_collection: CheckoutBillingAddressCollection;
202
+ shipping_address_collection: {
203
+ allowed_countries: string[];
204
+ } | null;
205
+ shipping_details: CheckoutShippingDetails | null;
206
+ phone_number_collection: {
207
+ enabled: boolean;
208
+ };
209
+ tax_id_collection: {
210
+ enabled: boolean;
211
+ };
212
+ custom_fields: CheckoutCustomField[];
213
+ consent_collection: CheckoutConsentCollection | null;
214
+ consent: CheckoutConsent | null;
25
215
  /**
26
- * The seller the wrapped payment is made on behalf of (`ca_…`, or the
27
- * object with `expand[]=connected_account`), or `null` (ADR 0012 D5).
216
+ * The payment this session created (`pi_…`, expandable), once the payer
217
+ * confirmed; `null` before, and always in `setup` mode.
28
218
  */
219
+ payment_intent: string | PaymentIntent | null;
220
+ /** `setup` mode: the SetupIntent (`seti_…`, expandable) once confirmed. */
221
+ setup_intent: string | SetupIntent | null;
222
+ /** The seller an on-behalf payment pays (`ca_…`, expandable). */
29
223
  connected_account: string | ConnectedAccount | null;
224
+ /** The payment link this session was created from (`link_…`), if any. */
225
+ payment_link: string | null;
226
+ client_reference_id: string | null;
30
227
  metadata: Record<string, string>;
31
- success_url?: string;
32
- cancel_url?: string;
33
- /** Canonical `checkout.peable.to/c/<id>` URL. */
34
- url: string;
228
+ /** With `{CHECKOUT_SESSION_ID}` as given; checkout substitutes it. */
229
+ success_url: string | null;
230
+ cancel_url: string | null;
231
+ /** Hosted mode: the URL to send the payer to. `null` in embedded mode. */
232
+ url: string | null;
233
+ /** Embedded mode: what `PeableCheckout.mountCheckout` takes. `null` in hosted mode. */
234
+ client_secret: string | null;
235
+ expires_at: number;
35
236
  created: number;
36
- updated_at: number;
37
237
  }
38
238
  /**
39
- * What the checkout page loads at `/c/:id`, authorized by possession of the
40
- * wrapped intent's `client_secret` (never a service token). `paymentIntent`
41
- * reuses `toPaymentIntentDTO`'s output unchanged — it already carries
42
- * `clientSecret`, which the page needs to open the socket and to `submit_tx`.
239
+ * What the hosted/embedded checkout loads, authorized by the session's
240
+ * `client_secret` (or, for a session wrapping a payment, that payment's). No
241
+ * metadata, no client reference, no internal ids.
43
242
  */
44
243
  export interface CheckoutSessionPublic {
45
- /** Frozen commercial USD price and exact FAIR settlement quote; no payer metadata. */
46
- billing_quote?: BillingFaircoinFxQuote;
47
244
  id: string;
48
245
  object: 'checkout_session';
246
+ livemode: boolean;
247
+ mode: CheckoutSessionMode;
248
+ status: CheckoutSessionStatus;
249
+ payment_status: CheckoutSessionPaymentStatus;
250
+ ui_mode: CheckoutUiMode;
251
+ locale: CheckoutLocale | null;
252
+ submit_type: CheckoutSubmitType;
253
+ currency: CurrencyCode;
254
+ rail: PaymentIntentRail;
255
+ network: NetworkType | null;
256
+ line_items: CheckoutLineItem[];
257
+ amount_subtotal: string;
258
+ amount_total: string;
259
+ total_details: CheckoutTotalDetails;
49
260
  /**
50
- * Which of the provider's two worlds this object belongs to (ADR 0017):
51
- * `true` for a `production` merchant, `false` for every other environment.
261
+ * The discount applied, with what the payer sees — the code they typed (or
262
+ * the coupon's name) and how much it took off.
52
263
  */
53
- livemode: boolean;
54
- success_url?: string;
55
- cancel_url?: string;
264
+ discount: {
265
+ promotion_code: string | null;
266
+ coupon_name: string | null;
267
+ amount_off: string | null;
268
+ percent_off: number | null;
269
+ } | null;
270
+ allow_promotion_codes: boolean;
271
+ automatic_tax: CheckoutAutomaticTax;
272
+ /** Prefilled from `customer_email` / the customer; then what the payer entered. */
273
+ customer_details: CheckoutCustomerDetails;
274
+ /** Whether the email is fixed by the merchant (a `customer` or `customer_email`). */
275
+ customer_email_locked: boolean;
276
+ billing_address_collection: CheckoutBillingAddressCollection;
277
+ shipping_address_collection: {
278
+ allowed_countries: string[];
279
+ } | null;
280
+ shipping_details: CheckoutShippingDetails | null;
281
+ phone_number_collection: {
282
+ enabled: boolean;
283
+ };
284
+ tax_id_collection: {
285
+ enabled: boolean;
286
+ };
287
+ custom_fields: CheckoutCustomField[];
288
+ consent_collection: CheckoutConsentCollection | null;
289
+ consent: CheckoutConsent | null;
290
+ /** The merchant's terms URL when `consent_collection.terms_of_service` is required. */
291
+ terms_of_service_url: string | null;
292
+ /** The payment the payer confirmed — with its `client_secret`, the payer's capability. */
293
+ payment_intent: PaymentIntent | null;
294
+ /** `setup` mode: the SetupIntent id and client secret, once confirmed. */
295
+ setup_intent: {
296
+ id: string;
297
+ client_secret: string;
298
+ status: SetupIntent['status'];
299
+ } | null;
300
+ /** `success_url` with `{CHECKOUT_SESSION_ID}` substituted; only once `complete`. */
301
+ success_url: string | null;
302
+ /** Shown as "Back to <merchant>" before payment. */
303
+ cancel_url: string | null;
304
+ /** A payment link's hosted confirmation, shown once `complete`. */
305
+ confirmation_message: string | null;
56
306
  merchant: MerchantDisplay;
57
- payment_intent: PaymentIntent;
307
+ branding: CheckoutBranding;
308
+ /**
309
+ * The card provider's PUBLIC key for this session's mode (ADR 0017), so the
310
+ * payment fields can mount before the payment exists. `null` on FairCoin.
311
+ */
312
+ publishable_key: string | null;
313
+ /** FairCoin billing invoices: the frozen USD price and FAIR settlement quote. */
314
+ billing_quote?: BillingFaircoinFxQuote;
315
+ expires_at: number;
316
+ }
317
+ /** `POST /v1/checkout_sessions/:id/public` — what the payer changes before confirming. */
318
+ export interface UpdateCheckoutSessionPublicParams {
319
+ /** Adjust a line's quantity, within its `adjustable_quantity` bounds. */
320
+ line_items?: {
321
+ id: string;
322
+ quantity: number;
323
+ }[];
324
+ /** A code to redeem (`allow_promotion_codes`), or `''` to remove the one applied. */
325
+ promotion_code?: string;
326
+ customer_details?: {
327
+ email?: string;
328
+ name?: string;
329
+ phone?: string;
330
+ address?: AddressParams;
331
+ tax_ids?: CheckoutTaxId[];
332
+ };
333
+ shipping_details?: {
334
+ name: string;
335
+ address: AddressParams;
336
+ } | null;
337
+ /** By `key`: the payer's value for each custom field. */
338
+ custom_fields?: {
339
+ key: string;
340
+ value: string;
341
+ }[];
342
+ consent?: {
343
+ terms_of_service?: 'accepted';
344
+ };
345
+ }
346
+ /**
347
+ * `POST /v1/checkout_sessions/:id/public/confirm` — lock the order and create
348
+ * the payment (or setup). The answer is the session with `payment_intent` /
349
+ * `setup_intent` set; completing it is the payment's, and `complete` is only
350
+ * ever what the gateway says.
351
+ */
352
+ export type ConfirmCheckoutSessionPublicParams = Record<string, never>;
353
+ export interface CheckoutProductDataParams {
354
+ name: string;
355
+ description?: string;
356
+ images?: string[];
357
+ tax_code?: string;
358
+ }
359
+ export interface CheckoutPriceDataParams {
360
+ currency: CurrencyCode;
361
+ unit_amount: string;
362
+ /** Exactly one of `product` and `product_data`. */
363
+ product?: string;
364
+ product_data?: CheckoutProductDataParams;
365
+ recurring?: {
366
+ interval: 'day' | 'week' | 'month' | 'year';
367
+ interval_count?: number;
368
+ };
369
+ tax_behavior?: 'inclusive' | 'exclusive' | 'unspecified';
370
+ }
371
+ export interface CheckoutLineItemParams {
372
+ /** Exactly one of `price` and `price_data`. */
373
+ price?: string;
374
+ price_data?: CheckoutPriceDataParams;
375
+ quantity: number;
376
+ adjustable_quantity?: {
377
+ enabled: boolean;
378
+ minimum?: number;
379
+ maximum?: number;
380
+ };
381
+ }
382
+ export interface CheckoutCustomFieldParams {
383
+ key: string;
384
+ label: CheckoutCustomFieldLabel;
385
+ type: CheckoutCustomFieldType;
386
+ optional?: boolean;
387
+ dropdown?: {
388
+ options: CheckoutCustomFieldDropdownOption[];
389
+ };
390
+ text?: {
391
+ minimum_length?: number;
392
+ maximum_length?: number;
393
+ };
394
+ numeric?: {
395
+ minimum_length?: number;
396
+ maximum_length?: number;
397
+ };
58
398
  }
59
399
  export interface CreateCheckoutSessionParams {
60
- amount: string;
61
- /** Defaults to `'faircoin'`, so pre-ADR-0001 integrations keep working. */
62
- rail?: PaymentIntentRail;
63
- /** Required on the faircoin rail; refused on the card rail. */
64
- network?: NetworkType;
65
- /** Defaults to `'FAIR'` on the faircoin rail; required on the card rail. */
400
+ /** Default `payment`. `subscription` answers 400 until the billing engine fulfils it. */
401
+ mode?: CheckoutSessionMode;
402
+ /** Required in `payment` and `subscription` mode; refused in `setup` mode. */
403
+ line_items?: CheckoutLineItemParams[];
404
+ /** `setup` mode: the currency of the method being saved (card rail only). */
66
405
  currency?: CurrencyCode;
67
- metadata?: Record<string, string>;
406
+ /** At most one; mutually exclusive with `allow_promotion_codes`. */
407
+ discounts?: ({
408
+ coupon: string;
409
+ } | {
410
+ promotion_code: string;
411
+ })[];
412
+ allow_promotion_codes?: boolean;
413
+ /** `cus_…`; mutually exclusive with `customer_email`. */
414
+ customer?: string;
415
+ customer_email?: string;
416
+ /** Default `if_required` (a customer is created only when something needs one). */
417
+ customer_creation?: CheckoutCustomerCreation;
418
+ billing_address_collection?: CheckoutBillingAddressCollection;
419
+ shipping_address_collection?: {
420
+ allowed_countries: string[];
421
+ };
422
+ phone_number_collection?: {
423
+ enabled: boolean;
424
+ };
425
+ tax_id_collection?: {
426
+ enabled: boolean;
427
+ };
428
+ /** At most three. */
429
+ custom_fields?: CheckoutCustomFieldParams[];
430
+ consent_collection?: {
431
+ terms_of_service?: 'none' | 'required';
432
+ };
433
+ automatic_tax?: {
434
+ enabled: boolean;
435
+ };
436
+ /** `['card']` or `['faircoin']` — the rail the line items' currency allows. */
437
+ payment_method_types?: string[];
438
+ locale?: CheckoutLocale | 'auto';
439
+ ui_mode?: CheckoutUiMode;
440
+ /** Required in hosted mode; may carry `{CHECKOUT_SESSION_ID}`. */
68
441
  success_url?: string;
442
+ /** Hosted mode only: the "Back to merchant" link. */
69
443
  cancel_url?: string;
70
- /** Pay this seller (`ca_…`) rather than the merchant — see `CreatePaymentIntentParams.connectedAccount`. */
444
+ /** Unix seconds, 30 minutes to 24 hours from now. Default 24 hours. */
445
+ expires_at?: number;
446
+ client_reference_id?: string;
447
+ metadata?: Record<string, string>;
448
+ submit_type?: CheckoutSubmitType;
449
+ /** Pay this seller (`ca_…`) rather than the merchant (ADR 0012); FairCoin only. */
71
450
  connected_account?: string;
72
451
  }
73
452
  /** `POST /v1/checkout_sessions/:id` — the merchant's `metadata`, as a patch. */
@@ -1,8 +1,12 @@
1
+ import type { Account } from './account';
2
+ import type { ApplicationFee, Balance, Payout } from './balance';
1
3
  import type { Charge } from './charge';
4
+ import type { CheckoutSession } from './checkoutSession';
2
5
  import type { Coupon, Price, Product, PromotionCode } from './catalog';
3
6
  import type { Customer } from './customer';
4
7
  import type { Dispute } from './dispute';
5
8
  import type { PaymentIntent } from './paymentIntent';
9
+ import type { PaymentLink } from './paymentLink';
6
10
  import type { PaymentMethod } from './paymentMethod';
7
11
  import type { ConnectedAccount, Refund } from './settlement';
8
12
  import type { SetupIntent } from './setupIntent';
@@ -99,12 +103,43 @@ export interface WebhookEventPayload {
99
103
  'coupon.deleted': Coupon;
100
104
  'promotion_code.created': PromotionCode;
101
105
  'promotion_code.updated': PromotionCode;
106
+ /**
107
+ * Checkout (Orbit Phase 3). `completed` when the payer finished: the payment
108
+ * succeeded (`payment_status: paid`), was authorized for a manual capture,
109
+ * or — a FairCoin payment — was broadcast and is confirming (`unpaid`), in
110
+ * which case `async_payment_succeeded` or `async_payment_failed` follows
111
+ * when the chain decides. `expired` when it ran out or the merchant expired
112
+ * it. Each carries the session as `GET /v1/checkout_sessions/:id` returns it.
113
+ */
114
+ 'checkout.session.completed': CheckoutSession;
115
+ 'checkout.session.expired': CheckoutSession;
116
+ 'checkout.session.async_payment_succeeded': CheckoutSession;
117
+ 'checkout.session.async_payment_failed': CheckoutSession;
118
+ 'payment_link.created': PaymentLink;
119
+ 'payment_link.updated': PaymentLink;
102
120
  /**
103
121
  * A seller's account changed — their READINESS, in practice. Emitted when the
104
122
  * fields a merchant ACTS on change, not on every refresh. It names no payment
105
123
  * intent.
106
124
  */
107
125
  'connected_account.updated': ConnectedAccount;
126
+ /**
127
+ * The merchant's OWN fiat account changed (ADR 0015 §1) — readiness,
128
+ * requirements, settings. Emitted when a field the merchant acts on moved.
129
+ */
130
+ 'account.updated': Account;
131
+ /** Orbit's fee was taken on a succeeded charge (ADR 0015 §3). */
132
+ 'application_fee.created': ApplicationFee;
133
+ /** Part or all of a fee went back (a refund with `refund_application_fee`). */
134
+ 'application_fee.refunded': ApplicationFee;
135
+ /** A payout of the merchant's account, mirrored from the provider (ADR 0015 §5). */
136
+ 'payout.created': Payout;
137
+ 'payout.updated': Payout;
138
+ 'payout.paid': Payout;
139
+ 'payout.failed': Payout;
140
+ 'payout.canceled': Payout;
141
+ /** Funds became available in the account; carries the balance read from the ledger. */
142
+ 'balance.available': Balance;
108
143
  'billing.observation.updated': BillingObservation;
109
144
  /**
110
145
  * A synthetic event sent to ONE endpoint when its owner asks to test it
@@ -1,7 +1,7 @@
1
1
  export { UNITS_PER_COIN, isBaseUnitString, type CurrencyCode, type FiatCurrencyCode, CURRENCY_CODES, CURRENCY_DECIMALS, FIAT_CURRENCY_CODES, decimalsFor, isCurrencyCode, } from './money';
2
2
  export type { NetworkType } from './network';
3
3
  export type { ExpandParams, List, ListParams, RangeQuery } from './list';
4
- export { type Address, type AddressParams, type CancelPaymentIntentParams, type CapturePaymentIntentParams, type ConfirmPaymentIntentParams, type CreatePaymentIntentParams, type PaymentIntent, type PaymentIntentCancellationReason, type PaymentIntentCaptureMethod, type PaymentIntentFaircoin, type PaymentIntentLastPaymentError, type PaymentIntentNextAction, type PaymentIntentRail, type PaymentIntentSetupFutureUsage, type PaymentIntentStatus, type PaymentMethodType, type Shipping, type ShippingParams, type UpdatePaymentIntentParams, CARD_ONLY_STATUSES, EXPIRABLE_STATUSES, MERCHANT_CANCELLATION_REASONS, PAYMENT_INTENT_CANCELLATION_REASONS, PAYMENT_INTENT_CAPTURE_METHODS, PAYMENT_INTENT_RAILS, PAYMENT_INTENT_SETUP_FUTURE_USAGES, PAYMENT_INTENT_STATUSES, TERMINAL_STATUSES, canExpire, canStillBePaid, isValidStatusTransition, } from './paymentIntent';
4
+ export { type Address, type AddressParams, type CancelPaymentIntentParams, type CapturePaymentIntentParams, type ConfirmPaymentIntentParams, type CreatePaymentIntentParams, type PaymentIntent, type PaymentIntentCancellationReason, type PaymentIntentCaptureMethod, type PaymentIntentFaircoin, type PaymentIntentLastPaymentError, type PaymentIntentNextAction, type PaymentIntentRail, type PaymentIntentSetupFutureUsage, type PaymentIntentStatus, type PaymentIntentTransferData, type PaymentMethodType, type Shipping, type ShippingParams, type UpdatePaymentIntentParams, CARD_ONLY_STATUSES, EXPIRABLE_STATUSES, MERCHANT_CANCELLATION_REASONS, PAYMENT_INTENT_CANCELLATION_REASONS, PAYMENT_INTENT_CAPTURE_METHODS, PAYMENT_INTENT_RAILS, PAYMENT_INTENT_SETUP_FUTURE_USAGES, PAYMENT_INTENT_STATUSES, TERMINAL_STATUSES, canExpire, canStillBePaid, isValidStatusTransition, } from './paymentIntent';
5
5
  export type { CardDetails, Charge, ChargeOutcome } from './charge';
6
6
  export type { CreateCustomerParams, Customer, DeletedCustomer, UpdateCustomerParams, } from './customer';
7
7
  export type { AttachPaymentMethodParams, BillingDetails, PaymentMethod, UpdatePaymentMethodParams, } from './paymentMethod';
@@ -12,7 +12,10 @@ export { PRICE_BILLING_SCHEMES, PRICE_TIERS_MODES, PRICE_TYPES, RECURRING_INTERV
12
12
  export { DISPUTE_FILE_EVIDENCE_FIELDS, DISPUTE_REASONS, DISPUTE_TEXT_EVIDENCE_FIELDS, normalizeDisputeReason, type Dispute, type DisputeEvidence, type DisputeEvidenceDetails, type DisputeEvidenceField, type DisputeEvidenceParams, type DisputeFileEvidenceField, type DisputeReason, type DisputeStatus, type DisputeTextEvidenceField, type ListDisputesParams, type UpdateDisputeParams, } from './dispute';
13
13
  export { FILE_PURPOSES, FILE_PURPOSE_POLICIES, FILE_STATUSES, FILE_TYPES, type CreateFileFromOxyParams, type FileObject, type FilePurpose, type FileStatus, type FileType, type ListFilesParams, } from './file';
14
14
  export { CARD_RAIL_PAYMENT_METHOD_TYPES, PAYMENT_METHOD_CONFIGURATION_TYPES, PAYMENT_METHOD_CURRENCIES, type CardRailPaymentMethodType, type CreatePaymentMethodConfigurationParams, type CreatePaymentMethodDomainParams, type ListPaymentMethodDomainsParams, type PaymentMethodConfiguration, type PaymentMethodConfigurationEntry, type PaymentMethodConfigurationEntryParams, type PaymentMethodConfigurationType, type PaymentMethodDisplayPreference, type PaymentMethodDomain, type PaymentMethodDomainWalletStatus, type PaymentMethodUnavailableReason, type UpdatePaymentMethodConfigurationParams, type UpdatePaymentMethodDomainParams, } from './paymentMethodConfiguration';
15
- export type { CapabilityStatus, ConnectedAccount, ConnectedAccountFaircoin, ConnectedAccountFaircoinStatus, ConnectedAccountRail, Refund, RefundOrigin, RefundStatus, Settlement, Transfer, TransferReversal, TransferReversalStatus, TransferStatus, TransferWithReversal, } from './settlement';
15
+ export { PAYOUT_INTERVALS, PAYOUT_WEEKLY_ANCHORS, type Account, type AccountBusinessProfile, type AccountCapabilityStatus, type AccountPayoutSchedule, type AccountRequirements, type AccountSettings, type AccountType, type CreateAccountLinkParams, type PayoutInterval, type PayoutWeeklyAnchor, type UpdateAccountParams, } from './account';
16
+ export { BALANCE_TRANSACTION_STATUSES, BALANCE_TRANSACTION_TYPES, PAYOUT_STATUSES, RECONCILIATION_MISMATCH_KINDS, type ApplicationFee, type Balance, type BalanceAmount, type BalanceTransaction, type BalanceTransactionFeeDetail, type BalanceTransactionStatus, type BalanceTransactionType, type CreatePayoutParams, type FeeRefund, type ListBalanceTransactionsParams, type ListPayoutsParams, type Payout, type PayoutReconciliationReport, type PayoutStatus, type ReconciliationMismatch, type ReconciliationMismatchKind, } from './balance';
17
+ export { REFUND_REASONS } from './settlement';
18
+ export type { CapabilityStatus, ConnectedAccount, ConnectedAccountFaircoin, ConnectedAccountFaircoinStatus, ConnectedAccountRail, CreateRefundParams, Refund, RefundOrigin, RefundReason, RefundStatus, UpdateRefundParams, Settlement, Transfer, TransferReversal, TransferReversalStatus, TransferStatus, TransferWithReversal, } from './settlement';
16
19
  export type { WebhookDelivery, WebhookDeliveryStatus, } from './webhookDelivery';
17
20
  export { REQUEST_LOG_METHODS, REQUEST_LOG_RETENTION_DAYS, type RequestLog, type RequestLogListParams, type RequestLogMethod, type RequestLogStatusFilter, } from './requestLog';
18
21
  export { SIMULATED_FAIRCOIN_OUTCOMES, type SimulatedFaircoinOutcome, type SimulateFaircoinPaymentParams, } from './testHelpers';
@@ -20,8 +23,9 @@ export { signWebhook, verifyWebhook } from './webhookSigner';
20
23
  export { type MerchantEnvironment, type Merchant, MERCHANT_ENVIRONMENTS, } from './merchant';
21
24
  export type { MerchantDisplay } from './merchantDisplay';
22
25
  export type { AccountLink, ConnectOnboarding, ConnectOnboardingComplete, RegisterFaircoinKeyParams, } from './connect';
23
- export type { PaymentLink, PublicPaymentLink, CreatePaymentLinkParams, UpdatePaymentLinkParams, } from './paymentLink';
24
- export type { CheckoutSession, CheckoutSessionPublic, CreateCheckoutSessionParams, UpdateCheckoutSessionParams, } from './checkoutSession';
26
+ export { PAYMENT_LINK_LIMITS, type PaymentLink, type PublicPaymentLink, type PaymentLinkLineItemParams, type PaymentLinkAfterCompletionParams, type CreatePaymentLinkParams, type UpdatePaymentLinkParams, type CreatePaymentLinkSessionParams, type PaymentLinkSessionStart, } from './paymentLink';
27
+ export { CHECKOUT_SESSION_MODES, CHECKOUT_SESSION_STATUSES, CHECKOUT_PAYMENT_STATUSES, CHECKOUT_UI_MODES, CHECKOUT_LOCALES, CHECKOUT_SUBMIT_TYPES, CHECKOUT_CUSTOMER_CREATIONS, CHECKOUT_BILLING_ADDRESS_COLLECTIONS, CHECKOUT_CUSTOM_FIELD_TYPES, CHECKOUT_TAX_ID_TYPES, CHECKOUT_LIMITS, CHECKOUT_SESSION_ID_TEMPLATE, type CheckoutSessionMode, type CheckoutSessionStatus, type CheckoutSessionPaymentStatus, type CheckoutUiMode, type CheckoutLocale, type CheckoutSubmitType, type CheckoutCustomerCreation, type CheckoutBillingAddressCollection, type CheckoutCustomFieldType, type CheckoutTaxIdType, type CheckoutAdjustableQuantity, type CheckoutLineItem, type CheckoutTaxId, type CheckoutCustomerDetails, type CheckoutShippingDetails, type CheckoutCustomFieldLabel, type CheckoutCustomFieldDropdownOption, type CheckoutCustomField, type CheckoutDiscount, type CheckoutTotalDetails, type CheckoutAutomaticTax, type CheckoutConsentCollection, type CheckoutConsent, type CheckoutAfterCompletion, type CheckoutSession, type CheckoutSessionPublic, type UpdateCheckoutSessionPublicParams, type ConfirmCheckoutSessionPublicParams, type CheckoutProductDataParams, type CheckoutPriceDataParams, type CheckoutLineItemParams, type CheckoutCustomFieldParams, type CreateCheckoutSessionParams, type UpdateCheckoutSessionParams, } from './checkoutSession';
28
+ export { BRANDING_FONTS, BRANDING_BORDER_STYLES, BRANDING_COLOR_PATTERN, DEFAULT_BRANDING, type BrandingFont, type BrandingBorderStyle, type MerchantBranding, type UpdateMerchantBrandingParams, type CheckoutBranding, type MerchantEmailSettings, type UpdateMerchantEmailSettingsParams, } from './branding';
25
29
  export { SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, type SocialPaymentSource, type SocialNextAddressRequest, type SocialNextAddressResponse, type SocialReceiveCursorResponse, type SocialPaymentDirection, type SocialPayment, type SocialPaymentsResponse, type EnrichmentKind, type EnrichmentResult, type EnrichRequest, type EnrichResponse, } from './social';
26
30
  export { BILLING_SUBSCRIPTION_STATUSES, type BillingSubscriptionStatus, type CreateBillingTaxQuoteParams, type BillingTaxQuote, type BillingInvoiceAuthoritySource, type BillingFinalInvoice, type BillingFinalInvoiceAuthority, type BillingFaircoinRenewalChoice, type BillingFaircoinRenewalConsent, type BillingFaircoinRenewalRevocation, type BillingCheckoutSession, type BillingEmbeddedCheckoutSession, type BillingEmbeddedCheckoutConfiguration, type BillingEmbeddedCheckoutBinding, type BillingEmbeddedCheckoutAction, type BillingEmbeddedCheckoutScope, type BillingCheckoutObservation, type RetrieveBillingCheckoutOperationParams, type BillingCheckoutOperationSource, type BillingCheckoutOperationRecovery, type BillingPaidInvoice, type BillingInvoiceState, type BillingCustomer, type BillingRail, type BillingRailSettlement, type BillingRailOffer, type BillingRailOption, type BillingRailList, type EnsureBillingCustomerParams, type CreateBillingCheckoutParams, type CreateBillingPortalParams, type BillingHostedSession, type BillingSubscription, } from './billing';
27
31
  export { canonicalBillingAuthority, canonicalBillingTaxQuote, PEABLE_BILLING_AUTHORITY_KEYS, } from './billing-authority';
@@ -231,6 +231,21 @@ export interface PaymentIntent {
231
231
  * FairCoin only, and `faircoin.address` derives from that seller's own key.
232
232
  */
233
233
  connected_account: string | ConnectedAccount | null;
234
+ /**
235
+ * Orbit's fee on this card payment, taken by the provider from the
236
+ * destination account when the charge succeeds (ADR 0015 §3) — the
237
+ * INSTRUCTION; the fee actually taken is the `application_fee` object.
238
+ * `null` on a platform charge.
239
+ */
240
+ application_fee_amount: string | null;
241
+ /**
242
+ * A destination charge (ADR 0015 §2): the account (`ca_…`) the funds go to,
243
+ * and the amount transferred when the platform named one. `null` on a
244
+ * platform charge.
245
+ */
246
+ transfer_data: PaymentIntentTransferData | null;
247
+ /** The account (`ca_…`) that is the merchant of record, or `null` (the platform). */
248
+ on_behalf_of: string | null;
234
249
  client_secret: string;
235
250
  metadata: Record<string, string>;
236
251
  /** When an UNPAID intent expires. Meaningful only while `can_expire`. */
@@ -240,6 +255,13 @@ export interface PaymentIntent {
240
255
  created: number;
241
256
  updated_at: number;
242
257
  }
258
+ /** Where a destination charge's funds go (`transfer_data`). */
259
+ export interface PaymentIntentTransferData {
260
+ /** `ca_…` */
261
+ destination: string;
262
+ /** Base units transferred; `null` means the whole amount less `application_fee_amount`. */
263
+ amount: string | null;
264
+ }
243
265
  /** `POST /v1/payment_intents`. */
244
266
  export interface CreatePaymentIntentParams {
245
267
  /** Amount in the currency's smallest unit, as a canonical integer string. */
@@ -278,6 +300,19 @@ export interface CreatePaymentIntentParams {
278
300
  expires_in_seconds?: number;
279
301
  /** FairCoin only: pay this seller (`ca_…`, ADR 0012 D5). */
280
302
  connected_account?: string;
303
+ /**
304
+ * Card only, a platform acting for one of its connected accounts: Orbit's
305
+ * fee for this payment. Needs `transfer_data` (or `on_behalf_of`); refused
306
+ * beside `transfer_data.amount`.
307
+ */
308
+ application_fee_amount?: string;
309
+ /** Card only: a destination charge to one of the platform's connected accounts. */
310
+ transfer_data?: {
311
+ destination: string;
312
+ amount?: string;
313
+ };
314
+ /** Card only: make this connected account (`ca_…`) the merchant of record. */
315
+ on_behalf_of?: string;
281
316
  /** Card only, with `confirm`: where a redirect-based challenge returns. */
282
317
  return_url?: string;
283
318
  }