@openrails/billing-ui 0.235.0 → 0.236.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.md +103 -73
  3. package/dist/account/account-billing.d.ts +1 -3
  4. package/dist/account/payment-methods-panel.d.ts +1 -3
  5. package/dist/buy-button.d.ts +35 -0
  6. package/dist/cart.d.ts +18 -0
  7. package/dist/checkout.d.ts +1 -3
  8. package/dist/client/checkout.d.ts +28 -0
  9. package/dist/client/client.d.ts +71 -47
  10. package/dist/client/errors.d.ts +4 -0
  11. package/dist/client/generated/error-codes.d.ts +1 -1
  12. package/dist/client/generated/routes.d.ts +117 -88
  13. package/dist/client/generated/wire.d.ts +88 -66
  14. package/dist/client/index.d.ts +2 -2
  15. package/dist/client/types.d.ts +230 -17
  16. package/dist/{client-BpzCZes3.js → client-BuvolBPT.js} +477 -316
  17. package/dist/client-BuvolBPT.js.map +1 -0
  18. package/dist/client.js +2 -2
  19. package/dist/components/stripe-card.d.ts +8 -2
  20. package/dist/components/stripe-wallets.d.ts +12 -0
  21. package/dist/components/ui/badge.d.ts +1 -1
  22. package/dist/components/ui/button.d.ts +1 -1
  23. package/dist/frame.d.ts +5 -5
  24. package/dist/hooks-2d-XjpuI.js +526 -0
  25. package/dist/hooks-2d-XjpuI.js.map +1 -0
  26. package/dist/i18n/context.d.ts +1 -1
  27. package/dist/index.d.ts +7 -5
  28. package/dist/index.js +1966 -1655
  29. package/dist/index.js.map +1 -1
  30. package/dist/lib/money.d.ts +1 -0
  31. package/dist/lib/offer-label.d.ts +4 -0
  32. package/dist/locales/de.js +20 -0
  33. package/dist/locales/de.js.map +1 -1
  34. package/dist/locales/en.d.ts +20 -0
  35. package/dist/locales/en.js +20 -0
  36. package/dist/locales/en.js.map +1 -1
  37. package/dist/locales/es.js +20 -0
  38. package/dist/locales/es.js.map +1 -1
  39. package/dist/locales/ja.js +11 -0
  40. package/dist/locales/ja.js.map +1 -1
  41. package/dist/locales/ko.js +11 -0
  42. package/dist/locales/ko.js.map +1 -1
  43. package/dist/locales/zh.js +11 -0
  44. package/dist/locales/zh.js.map +1 -1
  45. package/dist/offers.d.ts +33 -0
  46. package/dist/order-checkout.d.ts +30 -0
  47. package/dist/react/hooks.d.ts +8 -7
  48. package/dist/react/index.d.ts +1 -1
  49. package/dist/react/provider.d.ts +24 -2
  50. package/dist/react.js +2 -33
  51. package/dist/save-payment-method.d.ts +0 -6
  52. package/dist/styles.css +1 -1
  53. package/dist/types.d.ts +16 -16
  54. package/docs/payment-form-contract.md +6 -6
  55. package/package.json +1 -1
  56. package/dist/client-BpzCZes3.js.map +0 -1
  57. package/dist/config-qLcHvK0Q.js +0 -341
  58. package/dist/config-qLcHvK0Q.js.map +0 -1
  59. package/dist/provider.d.ts +0 -18
  60. package/dist/react.js.map +0 -1
@@ -68,6 +68,14 @@ export type CardEntry = {
68
68
  exp_year?: number;
69
69
  cvc?: string;
70
70
  };
71
+ export type Cart = {
72
+ currency: string;
73
+ total: string;
74
+ lines: OrderPreviewLine[];
75
+ payment_options: OrderPaymentOption[];
76
+ last_changed_at: string | null;
77
+ expires_at: string | null;
78
+ };
71
79
  export type CheckoutSession = {
72
80
  id: string;
73
81
  status: string;
@@ -133,14 +141,20 @@ export type CheckoutSessionSavedMethod = {
133
141
  rail: string;
134
142
  card: CardDetails | null;
135
143
  };
136
- export type CreateOrderParams = {
144
+ export type CreateMyOrderParams = {
137
145
  lines?: OrderLineParams[];
146
+ cart?: boolean;
138
147
  expected_total?: string;
139
- payment?: OrderPayment;
148
+ payment?: OrderPaymentParams;
149
+ reusable?: boolean;
150
+ };
151
+ export type CreateNetworkLinkParams = {
152
+ challenge_id?: string;
153
+ id_token?: string;
140
154
  };
141
155
  export type CreatePaymentMethodParams = {
142
156
  psp_id?: string;
143
- payment_token?: string;
157
+ token?: string;
144
158
  card?: CardEntry;
145
159
  billing_details?: BillingDetails;
146
160
  };
@@ -179,6 +193,17 @@ export type CustomerEntitlement = {
179
193
  entitlement: string;
180
194
  quantity: number | null;
181
195
  };
196
+ export type CustomerLink = {
197
+ id: string;
198
+ merchant_id: string;
199
+ customer_id: string;
200
+ account_id: string;
201
+ method: "checkout" | "connect" | "sign_in";
202
+ status: "active" | "revoked";
203
+ linked_at: string;
204
+ revoked_at: string | null;
205
+ revoked_by: "account_deleted" | "customer" | "merchant_left" | null;
206
+ };
182
207
  export type CustomerNotificationLookup = {
183
208
  notifications: Record<string, Notification | null> | null;
184
209
  };
@@ -281,6 +306,11 @@ export type MintCheckoutSessionParams = {
281
306
  auto_renew?: boolean;
282
307
  success_url?: string;
283
308
  };
309
+ export type NetworkLinkChallenge = {
310
+ id: string;
311
+ nonce: string;
312
+ expires_at: string;
313
+ };
284
314
  export type NextAction = {
285
315
  type: string;
286
316
  url: string | null;
@@ -343,23 +373,30 @@ export type NotificationData = {
343
373
  export type Order = {
344
374
  id: string;
345
375
  customer_id: string;
346
- origin: "customer" | "merchant";
347
- status: "canceled" | "expired" | "open" | "paid" | "processing" | "requires_action";
376
+ origin: "customer" | "merchant" | "subscription";
377
+ status: "canceled" | "complete" | "expired" | "open" | "processing" | "void";
348
378
  number: string | null;
349
379
  currency: string;
350
380
  total: string;
351
381
  lines: OrderLine[];
352
- next_action: NextAction | null;
353
- last_payment_error: PaymentFailure | null;
382
+ payment: OrderPayment;
354
383
  payment_options: OrderPaymentOption[];
355
- payment_method_id: string | null;
356
- payment_id: string | null;
357
- expires_at: string;
358
- paid_at: string | null;
384
+ checkout: OrderCheckout | null;
385
+ renewal: OrderRenewal | null;
386
+ expires_at: string | null;
387
+ completed_at: string | null;
359
388
  canceled_at: string | null;
360
389
  expired_at: string | null;
390
+ voided_at: string | null;
361
391
  created_at: string;
362
392
  };
393
+ export type OrderCheckout = {
394
+ url: string | null;
395
+ expires_at: string;
396
+ success_url: string;
397
+ cancel_url: string | null;
398
+ saved_payment_methods: boolean;
399
+ };
363
400
  export type OrderLine = {
364
401
  id: string;
365
402
  price_id: string;
@@ -377,6 +414,7 @@ export type OrderLine = {
377
414
  export type OrderLineParams = {
378
415
  price_id?: string;
379
416
  quantity?: number;
417
+ amount?: string;
380
418
  };
381
419
  export type OrderLineRefusal = {
382
420
  code: string;
@@ -385,13 +423,25 @@ export type OrderLineRefusal = {
385
423
  hint: string | null;
386
424
  };
387
425
  export type OrderPayment = {
388
- payment_method_id?: string;
426
+ status: "processing" | "requires_action" | "requires_payment_method" | "succeeded";
427
+ next_action: NextAction | null;
428
+ last_payment_error: PaymentFailure | null;
429
+ payment_method_id: string | null;
430
+ payment_id: string | null;
389
431
  };
390
432
  export type OrderPaymentOption = {
391
433
  psp_id: string;
392
434
  rail: string;
393
435
  accepts: string[];
394
436
  };
437
+ export type OrderPaymentParams = {
438
+ payment_method_id?: string;
439
+ token?: string;
440
+ psp_id?: string;
441
+ billing_details?: BillingDetails;
442
+ token_symbol?: string;
443
+ return_url?: string;
444
+ };
395
445
  export type OrderPreview = {
396
446
  currency: string;
397
447
  total: string;
@@ -410,6 +460,12 @@ export type OrderPreviewLine = {
410
460
  access_duration_hours: number | null;
411
461
  refusal: OrderLineRefusal | null;
412
462
  };
463
+ export type OrderRenewal = {
464
+ subscription_id: string;
465
+ period_starts_at: string;
466
+ period_ends_at: string;
467
+ due_at: string;
468
+ };
413
469
  export type PSPLinkState = {
414
470
  status: "error" | "linked" | "pending_manual_link" | "sync_disabled";
415
471
  ids: Record<string, string> | null;
@@ -442,8 +498,9 @@ export type PayInvoiceParams = {
442
498
  payment_method_id?: string;
443
499
  };
444
500
  export type PayOrderParams = {
445
- payment?: OrderPayment;
501
+ payment?: OrderPaymentParams;
446
502
  expected_total?: string;
503
+ reusable?: boolean;
447
504
  };
448
505
  export type Payment = {
449
506
  id: string;
@@ -485,7 +542,8 @@ export type PaymentMethod = {
485
542
  customer_id: string;
486
543
  rail: string;
487
544
  psp_id: string | null;
488
- status: "active" | "closed" | "removed" | "replaced";
545
+ status: "active" | "closed" | "removed" | "replaced" | "requires_action";
546
+ next_action: NextAction | null;
489
547
  replaced_by: string | null;
490
548
  card: CardDetails | null;
491
549
  billing_details: BillingDetails | null;
@@ -503,17 +561,6 @@ export type PaymentMethodHealth = {
503
561
  last_charge_outcome: "failed" | "succeeded" | null;
504
562
  active: boolean;
505
563
  };
506
- export type PaymentMethodSetup = {
507
- id: string;
508
- status: string;
509
- setup_intent_id?: string;
510
- client_secret?: string;
511
- payment_method_id?: string;
512
- };
513
- export type PaymentMethodSetupParams = {
514
- psp_id?: string;
515
- consent?: boolean;
516
- };
517
564
  export type PaymentMethodSubscription = {
518
565
  id: string;
519
566
  display_name: string;
@@ -528,6 +575,7 @@ export type PaymentRecovery = {
528
575
  retryable: boolean;
529
576
  blocked_reason?: string;
530
577
  operation?: PaymentOperation;
578
+ order_id?: string;
531
579
  };
532
580
  export type PendingAction = {
533
581
  psp: string;
@@ -535,11 +583,9 @@ export type PendingAction = {
535
583
  hint: string;
536
584
  patch_required: Record<string, Record<string, Record<string, string>>> | null;
537
585
  };
538
- export type PortalResponse = {
539
- url: string;
540
- };
541
- export type PreviewOrderParams = {
586
+ export type PreviewMyOrderParams = {
542
587
  lines?: OrderLineParams[];
588
+ cart?: boolean;
543
589
  };
544
590
  export type PreviewSubscriptionChangeParams = {
545
591
  price_id?: string | null;
@@ -581,27 +627,6 @@ export type Product = {
581
627
  created_at: string;
582
628
  updated_at: string;
583
629
  };
584
- export type ProductAccessGrant = {
585
- id: string;
586
- customer_id: string;
587
- product_id: string;
588
- product_key: string;
589
- product_name: string;
590
- source_type: "grace" | "grant" | "purchase" | "subscription";
591
- source_id: string;
592
- payment_id: string | null;
593
- quantity: number | null;
594
- grant_reason: "comp" | "import" | "migration" | "staff" | null;
595
- granted_by: string | null;
596
- note: string | null;
597
- status: string;
598
- starts_at: string;
599
- ends_at: string | null;
600
- revoked_at: string | null;
601
- revoke_reason: string | null;
602
- created_at: string;
603
- updated_at: string;
604
- };
605
630
  export type ProductSummary = {
606
631
  id: string;
607
632
  key: string;
@@ -616,8 +641,14 @@ export type PublicConfig = {
616
641
  currencies: CurrencyUnits[];
617
642
  rails: RailDefinition[];
618
643
  payment: PaymentConfig | null;
644
+ merchant: PublicMerchant | null;
619
645
  captcha: CaptchaConfig | null;
620
646
  };
647
+ export type PublicMerchant = {
648
+ display_name: string;
649
+ logo_url: string | null;
650
+ support_url: string | null;
651
+ };
621
652
  export type Quantity = {
622
653
  min: number;
623
654
  max: number;
@@ -646,6 +677,10 @@ export type ScheduledChange = {
646
677
  price?: Price;
647
678
  product?: ProductSummary;
648
679
  };
680
+ export type SetCartLineParams = {
681
+ quantity?: number;
682
+ amount?: string;
683
+ };
649
684
  export type SetDefaultPaymentMethodParams = {
650
685
  payment_method_id?: string;
651
686
  };
@@ -677,28 +712,15 @@ export type SolanaPaymentToken = {
677
712
  preferred: boolean;
678
713
  recurring_eligible: boolean;
679
714
  };
680
- export type SpendLimits = {
681
- currency: string;
682
- invoker: string;
683
- windows: SpendWindow[];
684
- };
685
- export type SpendWindow = {
686
- scope: "invoker" | "invoker_tier" | "role";
687
- key: string;
688
- window_seconds: number;
689
- limit: string;
690
- currency: string;
691
- used: string;
692
- reserved: string;
693
- remaining: string;
694
- resets_at: string;
695
- };
696
715
  export type StripeEngineAuthentication = {
697
716
  operation: PaymentOperation;
698
717
  payment_intent_id?: string;
699
718
  client_secret?: string;
700
719
  provider_payment_method_id?: string;
701
720
  };
721
+ export type StripePortalSession = {
722
+ url: string;
723
+ };
702
724
  export type Subscription = {
703
725
  collection_policy: string;
704
726
  recovery?: PaymentRecovery;
@@ -1,4 +1,4 @@
1
- export { CANCEL_REASON_MAX, CANCEL_REASON_MIN, createBillingClient, isWalletAction, isWalletRejection, RETRY_BUDGET_MS, signWalletAction, WalletRejectedError, type BillingClient, type BillingClientOptions, type CheckoutSourceOptions, type ListOptions, type SendSolanaTransaction, type SubscriptionChangeInput, } from './client';
1
+ export { CANCEL_REASON_MAX, CANCEL_REASON_MIN, createBillingClient, isWalletAction, isWalletRejection, RETRY_BUDGET_MS, signWalletAction, WalletRejectedError, type BillingClient, type BillingClientOptions, type ListOptions, type OrderResult, type ProductListOptions, type SendSolanaTransaction, type SubscriptionChangeInput, } from './client';
2
2
  export { BillingError, isBillingError, isServerError, readBillingError, toBillingError, type BillingErrorBody, } from './errors';
3
- export type { Account, Balance, CaptchaConfig, CardSetup, CardSummary, Currency, CurrencyScales, PaymentConfig, PublicConfig, CheckoutSessionLink, Invoice, ListPage, NewCard, NextAction, Page, Payment, PaymentAuthentication, PaymentMethod, PaymentOperation, PaymentRecovery, Price, Product, SolanaToken, Subscription, SubscriptionDunning, SubscriptionProduct, SubscriptionStatus, SubscriptionChange, SubscriptionChangePreview, } from './types';
3
+ export type { Account, Balance, CaptchaConfig, CardSummary, Cart, Currency, CurrencyScales, PaymentConfig, PaymentFailure, PublicConfig, PublicMerchant, CheckoutSessionLink, Invoice, ListPage, NewCard, NextAction, Order, OrderLine, OrderLineRefusal, OrderNextAction, OrderPaymentInput, OrderPreviewLine, Page, Payment, PaymentAuthentication, PaymentMethod, PaymentOperation, PaymentRecovery, Price, Product, SolanaToken, Subscription, SubscriptionDunning, SubscriptionProduct, SubscriptionStatus, SubscriptionChange, SubscriptionChangePreview, } from './types';
4
4
  export { amountToDecimal, decimalToAmount, formatAmount, type Amount, } from '../lib/money';
@@ -95,6 +95,7 @@ export declare const paymentRecoverySchema: z.ZodObject<{
95
95
  id: z.ZodString;
96
96
  status: z.ZodString;
97
97
  }, z.core.$strip>>>;
98
+ order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
99
  }, z.core.$strip>;
99
100
  export type PaymentRecovery = z.infer<typeof paymentRecoverySchema>;
100
101
  /**
@@ -245,6 +246,7 @@ export declare const subscriptionSchema: z.ZodObject<{
245
246
  id: z.ZodString;
246
247
  status: z.ZodString;
247
248
  }, z.core.$strip>>>;
249
+ order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
248
250
  }, z.core.$strip>>>;
249
251
  next_action: z.ZodOptional<z.ZodNullable<z.ZodObject<{
250
252
  type: z.ZodString;
@@ -275,6 +277,12 @@ export declare const billingDetailsSchema: z.ZodObject<{
275
277
  export type BillingDetails = z.infer<typeof billingDetailsSchema>;
276
278
  export declare const paymentMethodSchema: z.ZodObject<{
277
279
  id: z.ZodString;
280
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
281
+ next_action: z.ZodOptional<z.ZodNullable<z.ZodObject<{
282
+ type: z.ZodString;
283
+ psp_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
284
+ payload: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
285
+ }, z.core.$strip>>>;
278
286
  rail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
279
287
  psp_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
280
288
  card: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -296,6 +304,7 @@ export declare const paymentMethodSchema: z.ZodObject<{
296
304
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
305
  }, z.core.$strip>>>;
298
306
  }, z.core.$strip>>>;
307
+ reusable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
299
308
  health: z.ZodOptional<z.ZodNullable<z.ZodObject<{
300
309
  expiry_status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
301
310
  last_charged_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -310,6 +319,205 @@ export declare const paymentMethodSchema: z.ZodObject<{
310
319
  created_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
311
320
  }, z.core.$strip>;
312
321
  export type PaymentMethod = z.infer<typeof paymentMethodSchema>;
322
+ /** Why the latest payment attempt failed, in the customer's words. */
323
+ export declare const paymentFailureSchema: z.ZodObject<{
324
+ reason: z.ZodString;
325
+ message: z.ZodString;
326
+ field: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
+ }, z.core.$strip>;
328
+ export type PaymentFailure = z.infer<typeof paymentFailureSchema>;
329
+ /**
330
+ * What the customer completes before a payment can finish: `authenticate`
331
+ * runs the PSP's own script with `payload` (Stripe.js `handleNextAction`
332
+ * with `client_secret`); `redirect_to_url` leaves for `url`.
333
+ */
334
+ export declare const orderNextActionSchema: z.ZodObject<{
335
+ type: z.ZodString;
336
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
337
+ psp_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
338
+ transactions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
339
+ payload: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
340
+ }, z.core.$strip>;
341
+ export type OrderNextAction = z.infer<typeof orderNextActionSchema>;
342
+ export declare const orderLineSchema: z.ZodObject<{
343
+ id: z.ZodString;
344
+ price_id: z.ZodString;
345
+ product_id: z.ZodString;
346
+ description: z.ZodString;
347
+ quantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
348
+ unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
349
+ amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
350
+ billing_interval_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
351
+ access_duration_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
352
+ subscription_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
353
+ product_access_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
354
+ }, z.core.$strip>;
355
+ export type OrderLine = z.infer<typeof orderLineSchema>;
356
+ /**
357
+ * A purchase, or a subscription's renewal (`origin: subscription`): frozen
358
+ * lines and total, read and paid by its own customer. `status` is the
359
+ * order's (`open | processing | complete | canceled | expired | void`);
360
+ * `payment.status` its payment's (`requires_payment_method |
361
+ * requires_action | processing | succeeded`).
362
+ */
363
+ export declare const orderSchema: z.ZodObject<{
364
+ id: z.ZodString;
365
+ customer_id: z.ZodString;
366
+ origin: z.ZodString;
367
+ status: z.ZodString;
368
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
369
+ currency: z.ZodString;
370
+ total: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
371
+ lines: z.ZodArray<z.ZodObject<{
372
+ id: z.ZodString;
373
+ price_id: z.ZodString;
374
+ product_id: z.ZodString;
375
+ description: z.ZodString;
376
+ quantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
377
+ unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
378
+ amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
379
+ billing_interval_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
380
+ access_duration_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
381
+ subscription_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
382
+ product_access_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
383
+ }, z.core.$strip>>;
384
+ payment: z.ZodObject<{
385
+ status: z.ZodString;
386
+ next_action: z.ZodOptional<z.ZodNullable<z.ZodObject<{
387
+ type: z.ZodString;
388
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
389
+ psp_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
390
+ transactions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
391
+ payload: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
392
+ }, z.core.$strip>>>;
393
+ last_payment_error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
394
+ reason: z.ZodString;
395
+ message: z.ZodString;
396
+ field: z.ZodOptional<z.ZodNullable<z.ZodString>>;
397
+ }, z.core.$strip>>>;
398
+ payment_method_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
399
+ payment_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
400
+ }, z.core.$strip>;
401
+ payment_options: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
402
+ psp_id: z.ZodString;
403
+ rail: z.ZodString;
404
+ accepts: z.ZodArray<z.ZodString>;
405
+ }, z.core.$strip>>>>, z.ZodTransform<{
406
+ psp_id: string;
407
+ rail: string;
408
+ accepts: string[];
409
+ }[], {
410
+ psp_id: string;
411
+ rail: string;
412
+ accepts: string[];
413
+ }[] | null | undefined>>;
414
+ checkout: z.ZodOptional<z.ZodNullable<z.ZodObject<{
415
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
416
+ success_url: z.ZodString;
417
+ cancel_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
418
+ saved_payment_methods: z.ZodBoolean;
419
+ }, z.core.$strip>>>;
420
+ renewal: z.ZodOptional<z.ZodNullable<z.ZodObject<{
421
+ subscription_id: z.ZodString;
422
+ period_starts_at: z.ZodString;
423
+ period_ends_at: z.ZodString;
424
+ due_at: z.ZodString;
425
+ }, z.core.$strip>>>;
426
+ expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
427
+ completed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
428
+ canceled_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
429
+ expired_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
430
+ voided_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
431
+ created_at: z.ZodString;
432
+ }, z.core.$strip>;
433
+ export type Order = z.infer<typeof orderSchema>;
434
+ /** Why a line cannot be bought: `already_owned`, `unavailable`, ... */
435
+ export declare const orderLineRefusalSchema: z.ZodObject<{
436
+ code: z.ZodString;
437
+ message: z.ZodString;
438
+ owned_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
439
+ hint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
440
+ }, z.core.$strip>;
441
+ export type OrderLineRefusal = z.infer<typeof orderLineRefusalSchema>;
442
+ /** One line priced as an order would freeze it, or why it cannot be bought. */
443
+ export declare const orderPreviewLineSchema: z.ZodObject<{
444
+ price_id: z.ZodString;
445
+ product_id: z.ZodString;
446
+ description: z.ZodString;
447
+ quantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
448
+ unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
449
+ amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
450
+ ownership: z.ZodString;
451
+ billing_interval_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
452
+ access_duration_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
453
+ refusal: z.ZodOptional<z.ZodNullable<z.ZodObject<{
454
+ code: z.ZodString;
455
+ message: z.ZodString;
456
+ owned_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
457
+ hint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
458
+ }, z.core.$strip>>>;
459
+ }, z.core.$strip>;
460
+ export type OrderPreviewLine = z.infer<typeof orderPreviewLineSchema>;
461
+ /**
462
+ * The customer's cart, priced live: one per customer of a merchant, shared by
463
+ * the merchant's sites. `last_changed_at` and `expires_at` are null while it
464
+ * is empty.
465
+ */
466
+ export declare const cartSchema: z.ZodObject<{
467
+ currency: z.ZodString;
468
+ total: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
469
+ lines: z.ZodArray<z.ZodObject<{
470
+ price_id: z.ZodString;
471
+ product_id: z.ZodString;
472
+ description: z.ZodString;
473
+ quantity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
474
+ unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
475
+ amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
476
+ ownership: z.ZodString;
477
+ billing_interval_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
478
+ access_duration_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
479
+ refusal: z.ZodOptional<z.ZodNullable<z.ZodObject<{
480
+ code: z.ZodString;
481
+ message: z.ZodString;
482
+ owned_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
483
+ hint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
484
+ }, z.core.$strip>>>;
485
+ }, z.core.$strip>>;
486
+ payment_options: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
487
+ psp_id: z.ZodString;
488
+ rail: z.ZodString;
489
+ accepts: z.ZodArray<z.ZodString>;
490
+ }, z.core.$strip>>>>, z.ZodTransform<{
491
+ psp_id: string;
492
+ rail: string;
493
+ accepts: string[];
494
+ }[], {
495
+ psp_id: string;
496
+ rail: string;
497
+ accepts: string[];
498
+ }[] | null | undefined>>;
499
+ last_changed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
500
+ expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
501
+ }, z.core.$strip>;
502
+ export type Cart = z.infer<typeof cartSchema>;
503
+ /**
504
+ * How to pay an order: a saved card, a card just entered (the token of the
505
+ * PSP's own fields, its `psp_id`), a Solana wallet (`token_symbol`, the
506
+ * token it pays in) or the PSP's hosted page (`return_url`).
507
+ */
508
+ export type OrderPaymentInput = {
509
+ payment_method_id: string;
510
+ } | {
511
+ token: string;
512
+ psp_id?: string;
513
+ billing_details?: NewCard["billing_details"];
514
+ } | {
515
+ token_symbol: string;
516
+ psp_id?: string;
517
+ } | {
518
+ return_url: string;
519
+ psp_id?: string;
520
+ };
313
521
  /** A price's state on one PSP; public routes carry the status only. */
314
522
  export declare const productSchema: z.ZodObject<{
315
523
  id: z.ZodString;
@@ -516,6 +724,7 @@ export declare const invoiceSchema: z.ZodObject<{
516
724
  id: z.ZodString;
517
725
  status: z.ZodString;
518
726
  }, z.core.$strip>>>;
727
+ order_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
519
728
  }, z.core.$strip>>>;
520
729
  created_at: z.ZodString;
521
730
  }, z.core.$strip>;
@@ -744,6 +953,13 @@ export type CaptchaConfig = z.infer<typeof captchaConfigSchema>;
744
953
  * merchant's payment setup (null when the request resolves no merchant) and
745
954
  * the captcha (null when the deployment challenges nobody).
746
955
  */
956
+ /** The merchant as its customers see it; logo and support are https. */
957
+ export declare const publicMerchantSchema: z.ZodObject<{
958
+ display_name: z.ZodString;
959
+ logo_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
960
+ support_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
961
+ }, z.core.$strip>;
962
+ export type PublicMerchant = z.infer<typeof publicMerchantSchema>;
747
963
  export declare const publicConfigSchema: z.ZodObject<{
748
964
  capabilities: z.ZodObject<{
749
965
  route_groups: z.ZodRecord<z.ZodString, z.ZodBoolean>;
@@ -825,6 +1041,11 @@ export declare const publicConfigSchema: z.ZodObject<{
825
1041
  }[] | null | undefined>>;
826
1042
  }, z.core.$strip>>>;
827
1043
  }, z.core.$strip>>>;
1044
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1045
+ display_name: z.ZodString;
1046
+ logo_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1047
+ support_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1048
+ }, z.core.$strip>>>;
828
1049
  captcha: z.ZodOptional<z.ZodNullable<z.ZodObject<{
829
1050
  provider: z.ZodString;
830
1051
  site_key: z.ZodString;
@@ -834,14 +1055,6 @@ export declare const publicConfigSchema: z.ZodObject<{
834
1055
  }, z.core.$strip>>>;
835
1056
  }, z.core.$strip>;
836
1057
  export type PublicConfig = z.infer<typeof publicConfigSchema>;
837
- /** An in-page card setup; `payment_method_id` is set once the card is saved. */
838
- export declare const cardSetupSchema: z.ZodObject<{
839
- id: z.ZodString;
840
- status: z.ZodString;
841
- client_secret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
842
- payment_method_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
843
- }, z.core.$strip>;
844
- export type CardSetup = z.infer<typeof cardSetupSchema>;
845
1058
  export declare const paymentAuthenticationSchema: z.ZodObject<{
846
1059
  client_secret: z.ZodOptional<z.ZodNullable<z.ZodString>>;
847
1060
  }, z.core.$strip>;
@@ -863,22 +1076,22 @@ interface NewCardFields {
863
1076
  };
864
1077
  }
865
1078
  /**
866
- * A card to save: a token from the PSP's own fields (`payment_token`), or,
867
- * for a PSP whose card_entry is server (`cardSetupDriver` "card"), the card
868
- * itself, posted to OpenRails and never kept by this package.
1079
+ * A card to save: the single-use token of the PSP's own fields (a Collect.js
1080
+ * token, a Stripe `pm_`), or, for a PSP whose card_entry is server
1081
+ * (`cardSetupDriver` "card"), the card itself, posted to OpenRails and never
1082
+ * kept by this package.
869
1083
  */
870
1084
  export type NewCard = NewCardFields & ({
871
- payment_token: string;
1085
+ token: string;
872
1086
  card?: never;
873
1087
  } | {
874
1088
  card: CardEntry;
875
- payment_token?: never;
1089
+ token?: never;
876
1090
  });
877
1091
  /**
878
- * A minted checkout session. `id` reads and pays it with no other credential
879
- * (`client.checkoutSource(id)`); hand it to this customer's browser only.
880
- * `url` is the shared payment page (`<CheckoutFrame url>`), null when the app
881
- * renders `<Checkout>` itself.
1092
+ * A minted checkout session. `id` reads and pays it with no other credential;
1093
+ * hand it to this customer's browser only. `url` is the shared payment page
1094
+ * (`<CheckoutFrame url>`), null when BuyButton renders the checkout itself.
882
1095
  */
883
1096
  export declare const checkoutSessionLinkSchema: z.ZodObject<{
884
1097
  id: z.ZodString;