palbase 0.78.1 → 0.80.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 (62) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai-sdk/index.js +2 -2
  3. package/dist/backend/engine.js +2 -2
  4. package/dist/backend/env.js +1 -1
  5. package/dist/backend/index.js +3 -3
  6. package/dist/backend/stack.js +1 -1
  7. package/dist/backend/test.js +2 -2
  8. package/dist/chunks/{35KQJQ77.js → 2NB7UENO.js} +2 -2
  9. package/dist/chunks/{3XF644A5.js → 5BQM5XTX.js} +2 -2
  10. package/dist/chunks/{VNUCKM7H.js → 6INSGN37.js} +1 -1
  11. package/dist/chunks/{ROV6TJZK.js → 6PUARVHY.js} +1 -1
  12. package/dist/chunks/{TFPVJ3C3.js → 7NOXAQOX.js} +2 -2
  13. package/dist/chunks/{L63FWRZX.js → 7QS5ABCT.js} +2 -2
  14. package/dist/chunks/{RB4JQXKZ.js → 7XQVUV65.js} +2 -2
  15. package/dist/chunks/{UUDOMSKW.js → BQUNZH5E.js} +2 -2
  16. package/dist/chunks/{FCCX2OTM.js → DP6WZPTF.js} +2 -2
  17. package/dist/chunks/{WTFMJKDB.js → FUNHIQCH.js} +2 -2
  18. package/dist/chunks/G4PGGIAO.js +2 -0
  19. package/dist/chunks/{LXS7JHPJ.js → IK4MB3HQ.js} +2 -2
  20. package/dist/chunks/{JY7YG3BO.js → IS5HMTJX.js} +2 -2
  21. package/dist/chunks/{2T3EX52E.js → LZXD4SBY.js} +1 -1
  22. package/dist/chunks/{6Y4ICGZ7.js → N767RMLK.js} +2 -2
  23. package/dist/chunks/{ZIHVYOXE.js → OY6JSD3B.js} +2 -2
  24. package/dist/chunks/{EUMY6SCM.js → QV53HO4D.js} +1 -1
  25. package/dist/chunks/{ZBTOHVML.js → RGCK6WN2.js} +2 -2
  26. package/dist/chunks/{QWKOKJKM.js → RU3A4ASQ.js} +1 -1
  27. package/dist/chunks/{25KG2TVU.js → T2XBJBUC.js} +1 -1
  28. package/dist/chunks/TNNTPBI3.js +23 -0
  29. package/dist/chunks/{5KGMQFET.js → TOGOOVTU.js} +1 -1
  30. package/dist/chunks/{LONPNPNX.js → UKM6LWJ3.js} +2 -2
  31. package/dist/chunks/{IO5HB5B6.js → VZQI2MW2.js} +2 -2
  32. package/dist/chunks/WUOSCBJ3.js +13 -0
  33. package/dist/cli.js +5 -4
  34. package/dist/cloud/index.js +2 -2
  35. package/dist/refuse/ai-sdk.js +1 -1
  36. package/dist/refuse/ai.js +1 -1
  37. package/dist/refuse/backend.js +1 -1
  38. package/dist/refuse/cloud.js +1 -1
  39. package/dist/refuse/server.js +1 -1
  40. package/dist/server/index.js +2 -2
  41. package/dist/server/testing.js +2 -2
  42. package/dist/web/index.js +2 -2
  43. package/dist/web/message.js +2 -2
  44. package/dist/web/palbe.js +2 -2
  45. package/dist/web/payments-ui.js +2 -2
  46. package/dist/web/paywall.js +2 -2
  47. package/dist/web/push-sw.js +1 -1
  48. package/dist/web/ssr.js +2 -2
  49. package/dist/web/vite.js +2 -2
  50. package/package.json +2 -2
  51. package/types/cloud/src/generated/project.d.ts +2 -2
  52. package/types/internal/src/chat.d.ts +17 -0
  53. package/types/internal/src/modules/ai.d.ts +48 -3
  54. package/types/internal/src/modules/commerce.d.ts +38 -12
  55. package/types/internal/src/modules/events.d.ts +2 -2
  56. package/types/internal/src/modules/iap.d.ts +112 -101
  57. package/types/internal/src/modules/payments.d.ts +828 -18
  58. package/types/web/src/chat.d.ts +4 -2
  59. package/types/web/src/iap.d.ts +6 -0
  60. package/dist/chunks/3TJFV35H.js +0 -2
  61. package/dist/chunks/426QPZNS.js +0 -13
  62. package/dist/chunks/4XE4HLPK.js +0 -23
@@ -138,6 +138,7 @@ export type AttemptView = {
138
138
  * Whether the attempt failure is retryable.
139
139
  */
140
140
  retryable: boolean;
141
+ returned?: ReturnedCharge;
141
142
  /**
142
143
  * Attempt settlement timestamp.
143
144
  */
@@ -356,6 +357,18 @@ export type Capabilities = {
356
357
  * Whether 3D Secure authentication is supported.
357
358
  */
358
359
  three_ds: boolean;
360
+ /**
361
+ * A subscription can be of several of its unit (seats), and the count changed within a period.
362
+ */
363
+ subscription_quantity: boolean;
364
+ /**
365
+ * A subscription can begin at a percentage off — its first charge, or those of some months: how an In-App Purchases offer's discount is sold on the web. Where it is false, a checkout with such an offer is refused (`422 discount_not_supported`) rather than sold at the full price.
366
+ */
367
+ subscription_discount: boolean;
368
+ /**
369
+ * Whether the channel's provider makes invoices (Stripe: yes; iyzico: no).
370
+ */
371
+ invoices?: boolean;
359
372
  };
360
373
  /**
361
374
  * Resolved payment capabilities and active wallets for checkout rendering.
@@ -789,7 +802,7 @@ export type CreateSpendTokenRequest = {
789
802
  */
790
803
  export type CreateSubscriptionRequest = {
791
804
  /**
792
- * Recurring charge amount in minor units.
805
+ * What one of the quantity costs a period, in minor units (the whole period's when no `quantity` is given).
793
806
  */
794
807
  amount: number;
795
808
  /**
@@ -850,6 +863,10 @@ export type CreateSubscriptionRequest = {
850
863
  * Optional trial duration in days.
851
864
  */
852
865
  trial_days?: number;
866
+ /**
867
+ * How many of the unit the subscription is of (seats); 1 when not given. `amount` is what one costs: a period costs `amount` by `quantity`. Refused with `422 quantity_not_supported` on a channel whose capabilities do not say `subscription_quantity`.
868
+ */
869
+ quantity?: number;
853
870
  };
854
871
  /**
855
872
  * Grant promotional reward or administrative adjustment to a customer wallet.
@@ -910,6 +927,10 @@ export type DisputeEvent = {
910
927
  * Disputed amount in minor units.
911
928
  */
912
929
  amount: number;
930
+ /**
931
+ * The attempt that took the disputed charge, when it is a returned charge's.
932
+ */
933
+ attempt_id?: string;
913
934
  /**
914
935
  * The channel the payment was taken through.
915
936
  */
@@ -936,10 +957,18 @@ export type DisputeEvent = {
936
957
  * Disputed PaymentIntent UUID.
937
958
  */
938
959
  intent_id: string;
960
+ /**
961
+ * A subscription's charge after its first (kind subscription_charge: a renewal, seats charged within a period): the provider's invoice it is — the transaction id its subscription's payments.subscription.changed told. Absent for any other payment, a subscription's first payment among them, which keeps the names its own event gave it.
962
+ */
963
+ invoice_id?: string;
939
964
  /**
940
965
  * Whether the payment's channel takes live payments.
941
966
  */
942
967
  livemode?: boolean;
968
+ /**
969
+ * A subscription's payment (its first, or a charge after it): what the payment took, in minor units.
970
+ */
971
+ payment_amount?: number;
943
972
  /**
944
973
  * Provider name.
945
974
  */
@@ -949,7 +978,7 @@ export type DisputeEvent = {
949
978
  */
950
979
  provider_dispute_id?: string;
951
980
  /**
952
- * What the provider calls the payment, as the payment's own event told it.
981
+ * What the provider calls the payment, as the payment's own event told it; for a subscription's charge after its first, the charge that paid its invoice (Stripe's PaymentIntent).
953
982
  */
954
983
  provider_payment_id?: string;
955
984
  /**
@@ -960,10 +989,30 @@ export type DisputeEvent = {
960
989
  * Dispute reason.
961
990
  */
962
991
  reason?: string;
992
+ /**
993
+ * A subscription's payment: how much of it is given back by now, this refund included, in minor units.
994
+ */
995
+ refunded_amount?: number;
996
+ /**
997
+ * true: the disputed charge is one that was given back as no money of its payment's (payments.payment.charge_returned); nothing of the payment is moved by it, and the event carries no iap_context.
998
+ */
999
+ returned_charge?: boolean;
963
1000
  /**
964
1001
  * Dispute status.
965
1002
  */
966
1003
  status: string;
1004
+ /**
1005
+ * The disputed card's fingerprint: the same card saved again, by this payer or another, has the same one.
1006
+ */
1007
+ card_fingerprint?: string;
1008
+ /**
1009
+ * An invoice Palbase made for a payer (POST /payments/customers/{customer_id}/invoices) that the payment paid (kind invoice): its id.
1010
+ */
1011
+ payer_invoice_id?: string;
1012
+ /**
1013
+ * That invoice's number.
1014
+ */
1015
+ payer_invoice_number?: string;
967
1016
  };
968
1017
  /**
969
1018
  * Paginated list of disputes.
@@ -1282,7 +1331,7 @@ export type IntentSummary = {
1282
1331
  */
1283
1332
  capture_method: string;
1284
1333
  /**
1285
- * Captured amount in minor units.
1334
+ * Captured amount in minor units: what was taken, and what a refund can give back. For a payment that started a subscription, what the card was charged — at an offer's discount, or nothing for a free trial — not the plan's price.
1286
1335
  */
1287
1336
  captured_amount: number;
1288
1337
  /**
@@ -1318,7 +1367,7 @@ export type IntentSummary = {
1318
1367
  */
1319
1368
  id: string;
1320
1369
  /**
1321
- * Intent kind.
1370
+ * Intent kind (payment, top_up, subscription_initial, iap_web, subscription_charge).
1322
1371
  */
1323
1372
  kind: string;
1324
1373
  /**
@@ -1371,7 +1420,7 @@ export type IntentView = {
1371
1420
  */
1372
1421
  capture_method: string;
1373
1422
  /**
1374
- * Total captured amount in minor units.
1423
+ * Total captured amount in minor units: what was taken, and what a refund can give back. For a payment that started a subscription, what the card was charged — at an offer's discount, or nothing for a free trial — not the plan's price.
1375
1424
  */
1376
1425
  captured_amount: number;
1377
1426
  /**
@@ -1415,7 +1464,7 @@ export type IntentView = {
1415
1464
  */
1416
1465
  id: string;
1417
1466
  /**
1418
- * Intent kind (payment, top_up, subscription_initial, iap_checkout).
1467
+ * Intent kind: payment, top_up, subscription_initial (a subscription's first payment), iap_web (iap's web checkout), or subscription_charge — a subscription's charge after its first (a period's renewal, seats charged within a period), made paid when the module hears of its invoice: never told as payments.payment.succeeded, refunded like any payment; invoice: the card payment that paid an invoice Palbase made for a payer.
1419
1468
  */
1420
1469
  kind: string;
1421
1470
  /**
@@ -1686,7 +1735,7 @@ export type PaymentLifecycleEvent = {
1686
1735
  */
1687
1736
  cancel_at_period_end?: boolean;
1688
1737
  /**
1689
- * Captured amount in minor units.
1738
+ * Captured amount in minor units: what was taken, and what a refund can give back. For a payment that started a subscription, what the card was charged — at an offer's discount, or nothing for a free trial — not the plan's price.
1690
1739
  */
1691
1740
  captured_amount?: number;
1692
1741
  /**
@@ -1694,7 +1743,7 @@ export type PaymentLifecycleEvent = {
1694
1743
  */
1695
1744
  channel_key?: string;
1696
1745
  /**
1697
- * For a payment that started a subscription: what the card was charged, in minor units — nothing for a free trial.
1746
+ * For a payment that started a subscription: what the card was charged, in minor units — less than `amount` at an offer's discount, nothing for a free trial.
1698
1747
  */
1699
1748
  charged_amount?: number;
1700
1749
  /**
@@ -1775,6 +1824,14 @@ export type PaymentLifecycleEvent = {
1775
1824
  * For a payment that started a subscription: when its free trial ends.
1776
1825
  */
1777
1826
  trial_end?: string | null;
1827
+ /**
1828
+ * On the payment that started a subscription: how many of its unit the subscription is of (seats).
1829
+ */
1830
+ quantity?: number;
1831
+ /**
1832
+ * On the payment that started a subscription: what one of the quantity costs a period, in minor units.
1833
+ */
1834
+ unit_amount?: number;
1778
1835
  };
1779
1836
  /**
1780
1837
  * List of payment splits.
@@ -1936,6 +1993,10 @@ export type RefundListResponse = {
1936
1993
  * Emitted when a refund completes (original payment method or instant wallet credit).
1937
1994
  */
1938
1995
  export type RefundSucceededEvent = {
1996
+ /**
1997
+ * Who made the refund: provider — made at the provider (Stripe's dashboard) and read from it (charge.refunded); absent when the module made it.
1998
+ */
1999
+ actor?: string;
1939
2000
  /**
1940
2001
  * Refund amount in minor units.
1941
2002
  */
@@ -1970,10 +2031,18 @@ export type RefundSucceededEvent = {
1970
2031
  * PaymentIntent UUID.
1971
2032
  */
1972
2033
  intent_id: string;
2034
+ /**
2035
+ * A subscription's charge after its first (kind subscription_charge: a renewal, seats charged within a period): the provider's invoice it is — the transaction id its subscription's payments.subscription.changed told. Absent for any other payment, a subscription's first payment among them, which keeps the names its own event gave it.
2036
+ */
2037
+ invoice_id?: string;
1973
2038
  /**
1974
2039
  * Whether the payment's channel takes live payments.
1975
2040
  */
1976
2041
  livemode?: boolean;
2042
+ /**
2043
+ * A subscription's payment (its first, or a charge after it): what the payment took, in minor units.
2044
+ */
2045
+ payment_amount?: number;
1977
2046
  /**
1978
2047
  * Provider name.
1979
2048
  */
@@ -1983,7 +2052,7 @@ export type RefundSucceededEvent = {
1983
2052
  */
1984
2053
  provider_op?: string;
1985
2054
  /**
1986
- * What the provider calls the payment, as the payment's own event told it.
2055
+ * What the provider calls the payment, as the payment's own event told it; for a subscription's charge after its first, the charge that paid its invoice (Stripe's PaymentIntent).
1987
2056
  */
1988
2057
  provider_payment_id?: string;
1989
2058
  /**
@@ -1998,6 +2067,10 @@ export type RefundSucceededEvent = {
1998
2067
  * Refund UUID.
1999
2068
  */
2000
2069
  refund_id: string;
2070
+ /**
2071
+ * A subscription's payment: how much of it is given back by now, this refund included, in minor units.
2072
+ */
2073
+ refunded_amount?: number;
2001
2074
  /**
2002
2075
  * What went back to the wallet, in minor units.
2003
2076
  */
@@ -2010,6 +2083,14 @@ export type RefundSucceededEvent = {
2010
2083
  * Ledger transaction UUID when refunded to wallet.
2011
2084
  */
2012
2085
  wallet_tx_id?: string;
2086
+ /**
2087
+ * An invoice Palbase made for a payer (POST /payments/customers/{customer_id}/invoices) that the payment paid (kind invoice): its id.
2088
+ */
2089
+ payer_invoice_id?: string;
2090
+ /**
2091
+ * That invoice's number.
2092
+ */
2093
+ payer_invoice_number?: string;
2013
2094
  };
2014
2095
  /**
2015
2096
  * Refund record.
@@ -2097,7 +2178,7 @@ export type RoutingRule = {
2097
2178
  */
2098
2179
  id?: string;
2099
2180
  /**
2100
- * Optional payment kind match (payment, top_up, subscription_initial, iap_checkout).
2181
+ * Optional payment kind match: payment, top_up, subscription_initial or iap_web (iap's web checkout). A subscription_charge is never routed: it is charged on its subscription's own channel.
2101
2182
  */
2102
2183
  payment_kind?: string | null;
2103
2184
  /**
@@ -2542,6 +2623,10 @@ export type StripeOptions = {
2542
2623
  * Use Stripe Managed Payments where available.
2543
2624
  */
2544
2625
  managed_payments?: boolean;
2626
+ /**
2627
+ * Whether the amount holds the tax (inclusive) or Stripe adds it (exclusive), when Stripe calculates tax. Left out, the Stripe account's default decides: its "Automatic" adds tax to USD and CAD prices and holds it in every other currency.
2628
+ */
2629
+ tax_behavior?: "inclusive" | "exclusive";
2545
2630
  /**
2546
2631
  * Optional Stripe tax code.
2547
2632
  */
@@ -2678,7 +2763,7 @@ export type SubmitOTPRequest = {
2678
2763
  */
2679
2764
  export type SubscriptionEvent = {
2680
2765
  /**
2681
- * What a period costs, in minor units.
2766
+ * What a period costs, in minor units: `unit_amount` by `quantity`.
2682
2767
  */
2683
2768
  amount?: number;
2684
2769
  /**
@@ -2694,9 +2779,9 @@ export type SubscriptionEvent = {
2694
2779
  */
2695
2780
  cancel_at_period_end?: boolean;
2696
2781
  /**
2697
- * What happened: started (its first payment was made), renewed (a period's payment, in transaction), payment_failed (a renewal was not charged), canceled (its renewal was turned off, or it ended), updated (anything else of it moved: its period, its status).
2782
+ * What happened: started (its first payment was made), renewed (a period's payment, in transaction), payment_failed (a renewal was not charged), charged (a payment within its period — seats added and charged at once —, in transaction, of no period of its own), canceled (its renewal was turned off, or it ended), updated (anything else of it moved: its period, its status).
2698
2783
  */
2699
- change?: "started" | "renewed" | "payment_failed" | "canceled" | "updated";
2784
+ change?: "started" | "renewed" | "payment_failed" | "charged" | "canceled" | "updated";
2700
2785
  /**
2701
2786
  * The channel it is billed through.
2702
2787
  */
@@ -2764,6 +2849,26 @@ export type SubscriptionEvent = {
2764
2849
  * When its free trial ends.
2765
2850
  */
2766
2851
  trial_end?: string | null;
2852
+ /**
2853
+ * What one of the quantity costs a period, in minor units. `amount` is this by `quantity`.
2854
+ */
2855
+ unit_amount?: number;
2856
+ /**
2857
+ * How many of the unit the subscription has in the current period (seats, for an app sold by the seat). 1 for a subscription sold as one.
2858
+ */
2859
+ quantity?: number;
2860
+ /**
2861
+ * Present when fewer were asked for than are paid for: how many the next renewal bills. The ones paid for stay until the period's end.
2862
+ */
2863
+ renewal_quantity?: number;
2864
+ /**
2865
+ * Present while a quantity change made at the payment provider itself waits there for its invoice to be paid: how many it would be of. Nothing this API is asked leaves one waiting; asking for the quantity the subscription has drops it.
2866
+ */
2867
+ pending_quantity?: number;
2868
+ /**
2869
+ * When the payment provider lets go of the waiting quantity if its invoice is not paid.
2870
+ */
2871
+ pending_expires_at?: string;
2767
2872
  };
2768
2873
  /**
2769
2874
  * Paginated list of subscriptions.
@@ -2783,7 +2888,7 @@ export type SubscriptionListResponse = {
2783
2888
  */
2784
2889
  export type SubscriptionSummary = {
2785
2890
  /**
2786
- * Recurring amount in minor units.
2891
+ * What a period costs, in minor units: `unit_amount` by `quantity`.
2787
2892
  */
2788
2893
  amount: number;
2789
2894
  /**
@@ -2852,13 +2957,45 @@ export type SubscriptionSummary = {
2852
2957
  * Trial end timestamp.
2853
2958
  */
2854
2959
  trial_end?: string | null;
2960
+ /**
2961
+ * What one of the quantity costs a period, in minor units. `amount` is this by `quantity`.
2962
+ */
2963
+ unit_amount: number;
2964
+ /**
2965
+ * How many of the unit the subscription has in the current period (seats, for an app sold by the seat). 1 for a subscription sold as one.
2966
+ */
2967
+ quantity: number;
2968
+ /**
2969
+ * Present when fewer were asked for than are paid for: how many the next renewal bills. The ones paid for stay until the period's end.
2970
+ */
2971
+ renewal_quantity?: number;
2972
+ /**
2973
+ * Present while a quantity change made at the payment provider itself waits there for its invoice to be paid: how many it would be of. Nothing this API is asked leaves one waiting; asking for the quantity the subscription has drops it.
2974
+ */
2975
+ pending_quantity?: number;
2976
+ /**
2977
+ * When the payment provider lets go of the waiting quantity if its invoice is not paid.
2978
+ */
2979
+ pending_expires_at?: string;
2980
+ /**
2981
+ * For a subscription bought through In-App Purchases' web checkout: the catalog's product it was bought as. Absent for a subscription of Payments' own.
2982
+ */
2983
+ iap_product?: string;
2984
+ /**
2985
+ * For a subscription bought through In-App Purchases' web checkout: the catalog's plan it was bought as.
2986
+ */
2987
+ iap_plan?: string;
2988
+ /**
2989
+ * In the answer of POST /payments/subscriptions/{subscription_id}/quantity alone: what that change charged at once, in minor units — the added seats' days left with proration charge_now, 0 where it charged nothing then (fewer seats, seats already paid for in the period, next_invoice).
2990
+ */
2991
+ charged_now?: number;
2855
2992
  };
2856
2993
  /**
2857
2994
  * Recurring subscription representation.
2858
2995
  */
2859
2996
  export type SubscriptionView = {
2860
2997
  /**
2861
- * Recurring amount in minor units.
2998
+ * What a period costs, in minor units: `unit_amount` by `quantity`.
2862
2999
  */
2863
3000
  amount: number;
2864
3001
  /**
@@ -2928,6 +3065,26 @@ export type SubscriptionView = {
2928
3065
  * Trial end timestamp.
2929
3066
  */
2930
3067
  trial_end?: string | null;
3068
+ /**
3069
+ * What one of the quantity costs a period, in minor units. `amount` is this by `quantity`.
3070
+ */
3071
+ unit_amount: number;
3072
+ /**
3073
+ * How many of the unit the subscription has in the current period (seats, for an app sold by the seat). 1 for a subscription sold as one.
3074
+ */
3075
+ quantity: number;
3076
+ /**
3077
+ * Present when fewer were asked for than are paid for: how many the next renewal bills. The ones paid for stay until the period's end.
3078
+ */
3079
+ renewal_quantity?: number;
3080
+ /**
3081
+ * Present while a quantity change made at the payment provider itself waits there for its invoice to be paid: how many it would be of. Nothing this API is asked leaves one waiting; asking for the quantity the subscription has drops it.
3082
+ */
3083
+ pending_quantity?: number;
3084
+ /**
3085
+ * When the payment provider lets go of the waiting quantity if its invoice is not paid.
3086
+ */
3087
+ pending_expires_at?: string;
2931
3088
  };
2932
3089
  /**
2933
3090
  * Initiate a real-money wallet top-up.
@@ -3476,7 +3633,7 @@ export type DeleteCustomerResponse = {
3476
3633
  provider_records_kept: ProviderRecordKept[];
3477
3634
  };
3478
3635
  /**
3479
- * The payment of a subscription's renewal: the provider's invoice, what was paid for it, and the period it pays for.
3636
+ * The payment told with a change: a renewal's — the provider's invoice, what was paid for it, and the period it pays for — or, with change charged, a payment within the period (seats added), of no period of its own.
3480
3637
  */
3481
3638
  export type SubscriptionRenewalPayment = {
3482
3639
  /**
@@ -3503,6 +3660,536 @@ export type SubscriptionRenewalPayment = {
3503
3660
  * The tax in what was paid, in minor units.
3504
3661
  */
3505
3662
  tax_amount?: number;
3663
+ /**
3664
+ * When it was paid, as the provider says: a payment told late (its word lost, read from its invoice) was made then.
3665
+ */
3666
+ paid_at?: string | null;
3667
+ };
3668
+ /**
3669
+ * Emitted when money taken on a closed payment, or money its payment did not ask for, was given back — or could not be (status failed: the money is the project's to give back).
3670
+ */
3671
+ export type ChargeReturnedEvent = {
3672
+ /**
3673
+ * What was given back, in minor units: all the attempt took.
3674
+ */
3675
+ amount?: number;
3676
+ /**
3677
+ * The attempt that took the money; it is closed (status canceled, provider_code returned).
3678
+ */
3679
+ attempt_id?: string;
3680
+ /**
3681
+ * The channel the money was taken through.
3682
+ */
3683
+ channel_key?: string;
3684
+ /**
3685
+ * ISO 4217 currency code.
3686
+ */
3687
+ currency?: string;
3688
+ /**
3689
+ * Customer UID.
3690
+ */
3691
+ customer_id?: string;
3692
+ /**
3693
+ * Why it is not given back (status pending or failed).
3694
+ */
3695
+ detail?: string;
3696
+ /**
3697
+ * PaymentIntent UUID.
3698
+ */
3699
+ intent_id?: string;
3700
+ /**
3701
+ * The payment's kind.
3702
+ */
3703
+ kind?: string;
3704
+ /**
3705
+ * Whether the channel takes live payments.
3706
+ */
3707
+ livemode?: boolean;
3708
+ /**
3709
+ * Provider name.
3710
+ */
3711
+ provider?: string;
3712
+ /**
3713
+ * What the provider was asked: void (a hold let go of), cancel or refund, or end_subscription (a subscription the money began was ended; nothing to refund where it began with a free trial).
3714
+ */
3715
+ provider_op?: string;
3716
+ /**
3717
+ * What the provider calls the charge that was given back.
3718
+ */
3719
+ provider_payment_id?: string;
3720
+ /**
3721
+ * What the provider calls the giving back.
3722
+ */
3723
+ provider_refund_id?: string;
3724
+ /**
3725
+ * The payment's reference.
3726
+ */
3727
+ reference?: string;
3728
+ /**
3729
+ * The record of the giving back.
3730
+ */
3731
+ returned_id?: string;
3732
+ /**
3733
+ * succeeded: given back; pending: it cannot be given back until the project mends something (the channel's keys) — asked again meanwhile, told once; failed: the provider refused for good, or its channel is gone, and the money is the project's to give back.
3734
+ */
3735
+ status?: "succeeded" | "pending" | "failed";
3736
+ /**
3737
+ * canceled or expired (the payment was closed so when the money came), paid_by_another (another attempt had paid it), or mismatch (the money did not match its payment: another currency, less than its card's share; the payment stays payable).
3738
+ */
3739
+ why?: "canceled" | "expired" | "paid_by_another" | "mismatch";
3740
+ };
3741
+ /**
3742
+ * Money taken on a closed payment, given back.
3743
+ */
3744
+ export type ReturnedCharge = {
3745
+ /**
3746
+ * What the attempt took, in minor units.
3747
+ */
3748
+ amount: number;
3749
+ /**
3750
+ * ISO 4217 currency code.
3751
+ */
3752
+ currency: string;
3753
+ /**
3754
+ * What the provider calls the giving back, once done.
3755
+ */
3756
+ provider_refund_id?: string;
3757
+ /**
3758
+ * pending: asked again until the provider takes it; failed: the provider refused for good, and it is the project's to give back.
3759
+ */
3760
+ status: "pending" | "succeeded" | "failed";
3761
+ /**
3762
+ * Why the money was not the payment's.
3763
+ */
3764
+ why: "canceled" | "expired" | "paid_by_another" | "mismatch";
3765
+ };
3766
+ /**
3767
+ * The quantity a subscription is to be of.
3768
+ */
3769
+ export type ChangeSubscriptionQuantityRequest = {
3770
+ /**
3771
+ * How many the subscription is to be of.
3772
+ */
3773
+ quantity: number;
3774
+ /**
3775
+ * What becomes of the money. Seats added: `charge_now` (the default) invoices the days left and charges them at once, off session, and adds nothing if the charge is not paid (with a payment method that takes days to pay, a bank debit, they are added at once and their charge is in process: if the debit later fails, the provider follows it by its own rules for a failed payment of the subscription, which can end it); `next_invoice` adds them at once and puts the days left on the next invoice; `none` is refused (`400 invalid_proration`) — seats are sold, now or on the next invoice. Fewer: `none` (the default) gives no money back, keeps the seats until the period's end and bills the fewer from the next renewal; `next_invoice` takes them off at once and credits the days left on the next invoice; `charge_now` is refused (`400 invalid_proration`). Back up to what the subscription has, nothing is charged whatever is asked.
3776
+ */
3777
+ proration?: "charge_now" | "next_invoice" | "none";
3778
+ };
3779
+ /**
3780
+ * A line of an invoice to make.
3781
+ */
3782
+ export type InvoiceLineRequest = {
3783
+ /**
3784
+ * What it is, as the invoice shows it: 1 to 500 characters.
3785
+ */
3786
+ description: string;
3787
+ /**
3788
+ * How many (1).
3789
+ */
3790
+ quantity?: number;
3791
+ /**
3792
+ * The net price of one, in minor units.
3793
+ */
3794
+ unit_amount: number;
3795
+ /**
3796
+ * Stripe Tax's code for what it is (txcd_…); the account's default when left out.
3797
+ */
3798
+ tax_code?: string;
3799
+ };
3800
+ /**
3801
+ * An invoice to make for a payer.
3802
+ */
3803
+ export type CreateInvoiceRequest = {
3804
+ /**
3805
+ * The channel to invoice on: the card's channel when `method_id` is named, else the project's routing (currency) and default.
3806
+ */
3807
+ channel?: string;
3808
+ /**
3809
+ * ISO 4217 currency code.
3810
+ */
3811
+ currency: string;
3812
+ /**
3813
+ * 1 to 50 lines: what was sold, a card fee…
3814
+ */
3815
+ lines: InvoiceLineRequest[];
3816
+ /**
3817
+ * The saved card to charge (a card's invoice): the payer's default card on the channel when left out.
3818
+ */
3819
+ method_id?: string;
3820
+ /**
3821
+ * charge_automatically (a saved card is charged: the default) or send_invoice (paid on its page).
3822
+ */
3823
+ collection_method?: string;
3824
+ /**
3825
+ * send_invoice: days after it is made that it is due, 0 to 365 (30).
3826
+ */
3827
+ days_until_due?: number;
3828
+ /**
3829
+ * Stripe Tax computes the tax on top of the lines (true).
3830
+ */
3831
+ automatic_tax?: boolean;
3832
+ /**
3833
+ * A card's invoice is charged as it is made (true); false leaves it open, to pay later.
3834
+ */
3835
+ pay?: boolean;
3836
+ /**
3837
+ * What the invoice is for, shown on it: up to 500 characters.
3838
+ */
3839
+ description?: string;
3840
+ /**
3841
+ * Words at its foot: up to 500 characters.
3842
+ */
3843
+ footer?: string;
3844
+ /**
3845
+ * The project's own reference: up to 255 characters.
3846
+ */
3847
+ reference?: string;
3848
+ /**
3849
+ * Up to 20 keys of the project's own (none starting palbase_), copied onto the provider's invoice.
3850
+ */
3851
+ metadata?: {
3852
+ [key: string]: string;
3853
+ };
3854
+ };
3855
+ /**
3856
+ * How to pay an invoice again.
3857
+ */
3858
+ export type PayInvoiceRequest = {
3859
+ /**
3860
+ * The saved card to charge: the invoice's own card, or the payer's default, when left out.
3861
+ */
3862
+ method_id?: string;
3863
+ };
3864
+ /**
3865
+ * A line of an invoice.
3866
+ */
3867
+ export type InvoiceLine = {
3868
+ /**
3869
+ * What it is.
3870
+ */
3871
+ description?: string;
3872
+ /**
3873
+ * How many.
3874
+ */
3875
+ quantity?: number;
3876
+ /**
3877
+ * The net price of one, in minor units.
3878
+ */
3879
+ unit_amount?: number;
3880
+ /**
3881
+ * Its net amount: quantity times unit_amount.
3882
+ */
3883
+ amount?: number;
3884
+ /**
3885
+ * Stripe Tax's code for what it is.
3886
+ */
3887
+ tax_code?: string;
3888
+ };
3889
+ /**
3890
+ * Whom the invoice is made out to, as its provider copied the payer's record onto it when it was finalized.
3891
+ */
3892
+ export type InvoiceBilledTo = {
3893
+ /**
3894
+ * The payer's name.
3895
+ */
3896
+ name?: string;
3897
+ /**
3898
+ * The payer's billing email.
3899
+ */
3900
+ email?: string;
3901
+ address?: Address;
3902
+ /**
3903
+ * The payer's tax ids.
3904
+ */
3905
+ tax_ids?: string[];
3906
+ };
3907
+ /**
3908
+ * An invoice Palbase made for a payer at its channel's provider.
3909
+ */
3910
+ export type Invoice = {
3911
+ /**
3912
+ * The invoice's id.
3913
+ */
3914
+ id?: string;
3915
+ /**
3916
+ * The payer; empty once the payer was erased.
3917
+ */
3918
+ customer_id?: string;
3919
+ /**
3920
+ * The channel it was made on.
3921
+ */
3922
+ channel_key?: string;
3923
+ /**
3924
+ * Its provider: stripe.
3925
+ */
3926
+ provider?: string;
3927
+ /**
3928
+ * What the provider calls it (in_…).
3929
+ */
3930
+ provider_invoice_id?: string;
3931
+ /**
3932
+ * creating (its making is being carried on), draft, open, paid, void, uncollectible — or refused: its provider refused to make it, nothing is owed on it, and the refusal is told again under its key (which is free to ask again).
3933
+ */
3934
+ status?: string;
3935
+ /**
3936
+ * charge_automatically or send_invoice.
3937
+ */
3938
+ collection_method?: string;
3939
+ /**
3940
+ * send_invoice: days it is due after it was made.
3941
+ */
3942
+ days_until_due?: number;
3943
+ /**
3944
+ * The saved card it is charged to.
3945
+ */
3946
+ method_id?: string;
3947
+ /**
3948
+ * ISO 4217 currency code.
3949
+ */
3950
+ currency?: string;
3951
+ /**
3952
+ * Its net amount, before tax.
3953
+ */
3954
+ subtotal?: number;
3955
+ /**
3956
+ * The tax computed on it.
3957
+ */
3958
+ tax?: number;
3959
+ /**
3960
+ * What it totals: subtotal and tax.
3961
+ */
3962
+ total?: number;
3963
+ /**
3964
+ * What was paid of it.
3965
+ */
3966
+ amount_paid?: number;
3967
+ /**
3968
+ * What is due on it.
3969
+ */
3970
+ amount_due?: number;
3971
+ /**
3972
+ * What was given back of what was paid — refunds of its payment through Palbase, and ones made at Stripe itself: the provider's invoice does not show it.
3973
+ */
3974
+ refunded_amount?: number;
3975
+ /**
3976
+ * How many times it was charged: each declined payment, and the one that paid it.
3977
+ */
3978
+ attempt_count?: number;
3979
+ /**
3980
+ * Its number, given as it is finalized.
3981
+ */
3982
+ number?: string;
3983
+ /**
3984
+ * Its page, where the payer sees and pays it.
3985
+ */
3986
+ hosted_url?: string;
3987
+ /**
3988
+ * Its PDF.
3989
+ */
3990
+ pdf_url?: string;
3991
+ /**
3992
+ * Its last payment's decline, while it is unpaid.
3993
+ */
3994
+ decline_code?: string;
3995
+ /**
3996
+ * Its card asks for its holder's own confirmation: the invoice's page finishes it.
3997
+ */
3998
+ action_required?: boolean;
3999
+ billed_to?: InvoiceBilledTo;
4000
+ /**
4001
+ * The payment its card made (a payment of kind invoice): refund it to give back what was paid. Empty when no card paid it (marked paid outside Stripe, or by the payer's Stripe balance).
4002
+ */
4003
+ payment_intent_id?: string;
4004
+ /**
4005
+ * What it is for.
4006
+ */
4007
+ description?: string;
4008
+ /**
4009
+ * The project's own reference.
4010
+ */
4011
+ reference?: string;
4012
+ /**
4013
+ * The project's own keys.
4014
+ */
4015
+ metadata?: {
4016
+ [key: string]: string;
4017
+ };
4018
+ /**
4019
+ * Its lines.
4020
+ */
4021
+ lines?: InvoiceLine[];
4022
+ /**
4023
+ * When it was finalized.
4024
+ */
4025
+ finalized_at?: string;
4026
+ /**
4027
+ * When it was paid.
4028
+ */
4029
+ paid_at?: string;
4030
+ /**
4031
+ * When it was voided.
4032
+ */
4033
+ voided_at?: string;
4034
+ /**
4035
+ * When it was marked uncollectible.
4036
+ */
4037
+ uncollectible_at?: string;
4038
+ /**
4039
+ * When it was made.
4040
+ */
4041
+ created_at?: string;
4042
+ /**
4043
+ * When it last changed.
4044
+ */
4045
+ updated_at?: string;
4046
+ };
4047
+ /**
4048
+ * A payer's invoices.
4049
+ */
4050
+ export type InvoiceListResponse = {
4051
+ /**
4052
+ * Newest first.
4053
+ */
4054
+ invoices?: Invoice[];
4055
+ /**
4056
+ * Cursor for the next page (absent on the last page).
4057
+ */
4058
+ next_cursor?: string;
4059
+ };
4060
+ /**
4061
+ * Emitted when an invoice Palbase made is finalized, paid, fails a payment (once per failed charge), is voided or is marked uncollectible.
4062
+ */
4063
+ export type InvoiceEvent = {
4064
+ /**
4065
+ * The invoice.
4066
+ */
4067
+ invoice_id?: string;
4068
+ /**
4069
+ * The payer.
4070
+ */
4071
+ customer_id?: string;
4072
+ /**
4073
+ * Its provider.
4074
+ */
4075
+ provider?: string;
4076
+ /**
4077
+ * The channel it was made on.
4078
+ */
4079
+ channel_key?: string;
4080
+ /**
4081
+ * Whether the channel takes live payments.
4082
+ */
4083
+ livemode?: boolean;
4084
+ /**
4085
+ * What the provider calls it.
4086
+ */
4087
+ provider_invoice_id?: string;
4088
+ /**
4089
+ * Its number.
4090
+ */
4091
+ number?: string;
4092
+ /**
4093
+ * What it is now: open, paid, void or uncollectible.
4094
+ */
4095
+ status?: string;
4096
+ /**
4097
+ * ISO 4217 currency code.
4098
+ */
4099
+ currency?: string;
4100
+ /**
4101
+ * Its net amount.
4102
+ */
4103
+ subtotal?: number;
4104
+ /**
4105
+ * Its tax.
4106
+ */
4107
+ tax?: number;
4108
+ /**
4109
+ * What it totals.
4110
+ */
4111
+ total?: number;
4112
+ /**
4113
+ * Its page.
4114
+ */
4115
+ hosted_url?: string;
4116
+ /**
4117
+ * The project's own reference.
4118
+ */
4119
+ reference?: string;
4120
+ /**
4121
+ * paid: what was paid.
4122
+ */
4123
+ amount_paid?: number;
4124
+ /**
4125
+ * paid: the payment its card made (kind invoice); empty when no card paid it.
4126
+ */
4127
+ intent_id?: string;
4128
+ /**
4129
+ * paid: what the provider calls that payment.
4130
+ */
4131
+ provider_payment_id?: string;
4132
+ /**
4133
+ * paid, payment_failed: how many times it was charged.
4134
+ */
4135
+ attempt_count?: number;
4136
+ /**
4137
+ * payment_failed: the card's decline.
4138
+ */
4139
+ decline_code?: string;
4140
+ /**
4141
+ * payment_failed: the card asks for its holder's own confirmation (its page finishes it).
4142
+ */
4143
+ action_required?: boolean;
4144
+ /**
4145
+ * paid: what its card payment took — less than amount_paid where the payer's Stripe balance paid a part, nothing where it was marked paid outside Stripe (then no payment is written, and intent_id is empty).
4146
+ */
4147
+ card_charged?: number;
4148
+ };
4149
+ /**
4150
+ * Emitted when a refund of the payment that paid an invoice settled.
4151
+ */
4152
+ export type InvoiceRefundedEvent = {
4153
+ /**
4154
+ * The invoice.
4155
+ */
4156
+ invoice_id?: string;
4157
+ /**
4158
+ * The payer.
4159
+ */
4160
+ customer_id?: string;
4161
+ /**
4162
+ * What the provider calls it.
4163
+ */
4164
+ provider_invoice_id?: string;
4165
+ /**
4166
+ * Its number.
4167
+ */
4168
+ number?: string;
4169
+ /**
4170
+ * The refund.
4171
+ */
4172
+ refund_id?: string;
4173
+ /**
4174
+ * The payment refunded.
4175
+ */
4176
+ intent_id?: string;
4177
+ /**
4178
+ * What this refund gave back.
4179
+ */
4180
+ amount?: number;
4181
+ /**
4182
+ * ISO 4217 currency code.
4183
+ */
4184
+ currency?: string;
4185
+ /**
4186
+ * What was given back of the invoice so far.
4187
+ */
4188
+ refunded_amount?: number;
4189
+ /**
4190
+ * What was paid of it.
4191
+ */
4192
+ amount_paid?: number;
3506
4193
  };
3507
4194
  /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
3508
4195
  export interface Events {
@@ -3518,6 +4205,10 @@ export interface Events {
3518
4205
  * payments.payment.canceled: a PaymentIntent was canceled and any split wallet hold released.
3519
4206
  */
3520
4207
  "payments.payment.canceled": PaymentLifecycleEvent;
4208
+ /**
4209
+ * payments.payment.charge_returned: money a provider took on a payment that was closed by then (canceled, expired, or paid by another of its attempts), or that did not match its payment, was given back: a hold voided or the charge refunded in full (status succeeded) — or waits on the project (status pending: the channel's keys refused, told once) or could not be, and is the project's to give back (status failed). The payment is not made paid by it, and none of its refunds counts it.
4210
+ */
4211
+ "payments.payment.charge_returned": ChargeReturnedEvent;
3521
4212
  /**
3522
4213
  * payments.payment.failed: a payment attempt failed with a canonical decline code.
3523
4214
  */
@@ -3531,7 +4222,7 @@ export interface Events {
3531
4222
  */
3532
4223
  "payments.payment.succeeded": PaymentLifecycleEvent;
3533
4224
  /**
3534
- * payments.refund.succeeded: a refund settled to the original card or instantly to the customer's wallet.
4225
+ * payments.refund.succeeded: a refund settled to the original card or instantly to the customer's wallet — or, of a subscription's payment, one made at the provider (Stripe's dashboard), read from it (actor provider).
3535
4226
  */
3536
4227
  "payments.refund.succeeded": RefundSucceededEvent;
3537
4228
  /**
@@ -3566,6 +4257,30 @@ export interface Events {
3566
4257
  * payments.wallet.vested: a pending cashback or referral wallet lot vested into spendable balance.
3567
4258
  */
3568
4259
  "payments.wallet.vested": WalletVestedEvent;
4260
+ /**
4261
+ * payments.invoice.finalized: an invoice Palbase made was finalized: numbered, its tax computed, open.
4262
+ */
4263
+ "payments.invoice.finalized": InvoiceEvent;
4264
+ /**
4265
+ * payments.invoice.paid: an invoice was paid: by its card, on its page, or after it was marked uncollectible; its payment (kind invoice) is written once.
4266
+ */
4267
+ "payments.invoice.paid": InvoiceEvent;
4268
+ /**
4269
+ * payments.invoice.payment_failed: a payment of an invoice failed: the card's decline, told once per failed charge; it stays open.
4270
+ */
4271
+ "payments.invoice.payment_failed": InvoiceEvent;
4272
+ /**
4273
+ * payments.invoice.voided: an invoice was voided.
4274
+ */
4275
+ "payments.invoice.voided": InvoiceEvent;
4276
+ /**
4277
+ * payments.invoice.uncollectible: an invoice was marked uncollectible: it stays payable.
4278
+ */
4279
+ "payments.invoice.uncollectible": InvoiceEvent;
4280
+ /**
4281
+ * payments.invoice.refunded: a refund of what paid an invoice settled — through Palbase, or made at Stripe itself; the invoice's refunded_amount says how much was given back.
4282
+ */
4283
+ "payments.invoice.refunded": InvoiceRefundedEvent;
3569
4284
  }
3570
4285
  /** Palbase Payments */
3571
4286
  export declare function client(t: Transport): {
@@ -3872,7 +4587,7 @@ export declare function client(t: Transport): {
3872
4587
  /**
3873
4588
  * Confirm payment intent
3874
4589
  *
3875
- * Creates a new PaymentAttempt for the PaymentIntent (saved card, Masterpass OTP, Stripe Elements, or hosted/embedded 3DS form) and returns the canonical NextAction. A card is charged once for a payment. One confirmation of a payment runs at a time (`409 payment_busy` to one that waited too long). Before a saved card is charged, every other attempt of the payment that could still take money is closed at the provider — a hosted page left open is expired, one whose buyer's card was declined on it too — and one found paid is the payment: its view is answered and no card is charged. When the provider does not say whether a card was charged, the answer is `503 payment_outcome_unknown` and the payment reads `processing`: confirming again asks the provider first and charges nothing twice; left alone, the payment is settled paid or failed within minutes. A saved card that was removed on the provider's own pages is declined `method_gone` and listed no more. When the customer's record itself was deleted on the provider's pages, it is let go of here with the cards that went with it, and the answer is `409 provider_customer_gone` (`method_gone` when a saved card was named): confirming again makes a new record. An answer is kept with its Idempotency-Key, a decline too: confirm under a new key to try again. Opening a second hosted page for a payment does not close the first, and each is payable: send a buyer to one page per payment.
4590
+ * Creates a new PaymentAttempt for the PaymentIntent (saved card, Masterpass OTP, Stripe Elements, or hosted/embedded 3DS form) and returns the canonical NextAction. A card is charged once for a payment. One confirmation of a payment runs at a time (`409 payment_busy` to one that waited too long). Before a saved card is charged, every other attempt of the payment that could still take money is closed at the provider — a hosted page left open is expired, one whose buyer's card was declined on it too — and one found paid is the payment: its view is answered and no card is charged. When the provider does not say whether a card was charged, the answer is `503 payment_outcome_unknown` and the payment reads `processing`: confirming again asks the provider first and charges nothing twice; left alone, the payment is settled paid or failed within minutes. A saved card that was removed on the provider's own pages is declined `method_gone` and listed no more. When the customer's record itself was deleted on the provider's pages, it is let go of here with the cards that went with it, and the answer is `409 provider_customer_gone` (`method_gone` when a saved card was named): confirming again makes a new record. An answer is kept with its Idempotency-Key, a decline too: confirm under a new key to try again. One page per payment: the same confirmation sent again (the same terms) is answered with the hosted page that is open, and no new one is opened; other terms close the open page at its provider first and open another. A provider that cannot close its page (iyzico) is asked of it first instead: found paid, it is the payment; unpaid, it stays open there, and money taken on it after its payment was paid another way, canceled or expired is given back (payments.payment.charge_returned). A charge whose provider did not say how it stands is answered 503 payment_outcome_unknown (with intent_id): confirming again asks the provider first and charges nothing twice. A refusal's error_description is the provider's sentence for a card's own decline, and the module's own sentence for every other refusal.
3876
4591
  */
3877
4592
  confirmIntent(input: {
3878
4593
  path: {
@@ -4296,6 +5011,18 @@ export declare function client(t: Transport): {
4296
5011
  body: ExtendSubscriptionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4297
5012
  signal?: AbortSignal;
4298
5013
  }): Promise<Reply<200, ExtendSubscriptionResponse>>;
5014
+ /**
5015
+ * Change a subscription's quantity
5016
+ *
5017
+ * Makes the subscription of another quantity (seats). Seats added are charged at once for the days left of the period — off session: nobody is on a payment page when a server asks — and added only when that charge is paid. Not paid, nothing is added and nothing is left waiting at the provider: a card that declines is `402 seat_payment_failed` (ask again once the customer has a card that pays); a card that asks for its customer's own confirmation of every charge — 3-D Secure, which a server's call cannot give — is `402 seat_payment_requires_action` (ask again once the customer pays with a card that asks for none, or add them with `proration` `next_invoice` — added at once, their charge put on the next invoice). A card confirmed once, when the customer paid at checkout or saved it, is charged without asking again. Fewer give no money back: the seats stay until the period's end (`quantity`), and the next renewal bills the fewer (`renewal_quantity`). `proration` asks otherwise. Asked again, the call sets the quantity it names and charges nothing twice: no refusal of it is kept against an `Idempotency-Key`, and a call that failed is asked again the same way. A quantity changed on the provider's own pages (its customer portal, where that is turned on) is followed — more at once, fewer from the next renewal — and settled by the provider's settings, not by this call's rules. The subscription must be paid for and running (`409 subscription_not_active`), on a channel whose capabilities say `subscription_quantity` (`422 quantity_not_supported`); one change is made at a time (`409 subscription_busy`: ask again). Tells `payments.subscription.changed`.
5018
+ */
5019
+ changeSubscriptionQuantity(input: {
5020
+ path: {
5021
+ subscription_id: string;
5022
+ };
5023
+ body: ChangeSubscriptionQuantityRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5024
+ signal?: AbortSignal;
5025
+ }): Promise<Reply<200, SubscriptionSummary>>;
4299
5026
  /**
4300
5027
  * List wallet definitions
4301
5028
  *
@@ -4542,5 +5269,88 @@ export declare function client(t: Transport): {
4542
5269
  body: PortalRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4543
5270
  signal?: AbortSignal;
4544
5271
  }): Promise<Reply<200, PortalResponse>>;
5272
+ /**
5273
+ * List a payer's invoices
5274
+ *
5275
+ * Lists the invoices made for the payer, newest first, a page at a time (next_cursor). An invoice its provider refused to make is not listed: nothing is owed on it.
5276
+ */
5277
+ listCustomerInvoices(input: {
5278
+ path: {
5279
+ customer_id: string;
5280
+ };
5281
+ query?: {
5282
+ limit?: number; /** Opaque pagination cursor from the previous response's next_cursor. */
5283
+ cursor?: string;
5284
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5285
+ signal?: AbortSignal;
5286
+ }): Promise<Reply<200, InvoiceListResponse>>;
5287
+ /**
5288
+ * Invoice a payer
5289
+ *
5290
+ * Makes an invoice for the payer at the channel's provider — Stripe's own invoice: its number, its page, its PDF and its e-mail are Stripe's — and, unless `pay` is false, charges it to the card named, or the payer's default card on the channel, with the payer away. Each line's net amount is its quantity times its unit_amount; with `automatic_tax` (the default) Stripe Tax computes the tax on top, from the payer's billing address. The payer's profile (name, address, tax id) is written on the provider's record first: Stripe copies it onto the invoice as it is finalized; an address or tax id the provider refuses is answered with `billing_address_invalid` or `tax_id_invalid` and nothing is made. `collection_method` `send_invoice` makes one the payer pays on its page (`hosted_url`), due `days_until_due` days later (30); `send` e-mails it. Answers `201` with the invoice: `paid`, or `open` when not charged yet. A card the payer's bank declines answers `402` with the card's decline code (and `authentication_required` for a card that asks for its holder's own confirmation, which the invoice's page can finish) and the invoice beside the error, still `open`: pay it again with another card. `422 invoices_not_supported` on a channel whose provider makes no invoice (iyzico); `409 invoice_permission_required` when the channel may not write invoices (grant invoice write to its Stripe key, or accept the Stripe app's new permission); `422 method_required` for a card's invoice with no card to charge. `503 provider_unavailable` when its making was cut short at the provider: it is carried on, and asking again under the same `Idempotency-Key` answers it — made once, charged once. `409 invoice_in_progress` while the same invoice is being made by another asking. A refusal (4xx) is not kept under the `Idempotency-Key`: asked again under it once what was refused is fixed, the invoice is made.
5291
+ */
5292
+ createCustomerInvoice(input: {
5293
+ path: {
5294
+ customer_id: string;
5295
+ };
5296
+ body: CreateInvoiceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5297
+ signal?: AbortSignal;
5298
+ }): Promise<Reply<201, Invoice>>;
5299
+ /**
5300
+ * Get an invoice
5301
+ *
5302
+ * Answers the invoice. One not paid, voided or refused yet is read again from its provider first: paid on its page, or marked at the provider, it says so. One whose making was cut short (status creating or draft) is carried on by this reading — a write at the provider, never a second invoice.
5303
+ */
5304
+ getInvoice(input: {
5305
+ path: {
5306
+ invoice_id: string;
5307
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5308
+ signal?: AbortSignal;
5309
+ }): Promise<Reply<200, Invoice>>;
5310
+ /**
5311
+ * Pay an invoice again
5312
+ *
5313
+ * Charges an open or uncollectible invoice with the card named, or the one it was made with, or the payer's default, with the payer away. Answers the invoice `paid`; `402` with the card's decline code and the invoice beside the error; `409 invoice_not_payable` for one paid, void or refused. `409 invoice_permission_required` when the channel may not write invoices.
5314
+ */
5315
+ payInvoice(input: {
5316
+ path: {
5317
+ invoice_id: string;
5318
+ };
5319
+ body?: PayInvoiceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5320
+ signal?: AbortSignal;
5321
+ }): Promise<Reply<200, Invoice>>;
5322
+ /**
5323
+ * Void an invoice
5324
+ *
5325
+ * Voids an open or uncollectible invoice at its provider: nothing more can be paid on it. A paid invoice is not voided (`409 invoice_status_conflict`): refund its payment. `409 invoice_permission_required` when the channel may not write invoices.
5326
+ */
5327
+ voidInvoice(input: {
5328
+ path: {
5329
+ invoice_id: string;
5330
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5331
+ signal?: AbortSignal;
5332
+ }): Promise<Reply<200, Invoice>>;
5333
+ /**
5334
+ * Mark an invoice uncollectible
5335
+ *
5336
+ * Marks an open invoice uncollectible at its provider. It stays payable: paid after all (on its page, or by `pay`), it is paid. `409 invoice_permission_required` when the channel may not write invoices.
5337
+ */
5338
+ markInvoiceUncollectible(input: {
5339
+ path: {
5340
+ invoice_id: string;
5341
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5342
+ signal?: AbortSignal;
5343
+ }): Promise<Reply<200, Invoice>>;
5344
+ /**
5345
+ * E-mail an invoice
5346
+ *
5347
+ * Has the provider e-mail an open invoice collected by e-mail (`send_invoice`) to the payer. A card's invoice is not e-mailed (`409 invoice_status_conflict`).
5348
+ */
5349
+ sendInvoice(input: {
5350
+ path: {
5351
+ invoice_id: string;
5352
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5353
+ signal?: AbortSignal;
5354
+ }): Promise<Reply<200, Invoice>>;
4545
5355
  };
4546
5356
  export type Client = ReturnType<typeof client>;