palbase 0.78.0 → 0.79.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 (61) 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/{QL2UAO36.js → 6ATOAAF5.js} +1 -1
  9. package/dist/chunks/{JSRN4NOZ.js → 6OSSTYNI.js} +2 -2
  10. package/dist/chunks/{NG4OMSEK.js → 7S3FQENY.js} +2 -2
  11. package/dist/chunks/{MFWAOKLM.js → 7Y5BCID4.js} +2 -2
  12. package/dist/chunks/{SHYJVOD2.js → H54MZKCJ.js} +1 -1
  13. package/dist/chunks/{HHKRAOVG.js → H6J3ET7R.js} +1 -1
  14. package/dist/chunks/{3X3ZT72M.js → IXCF3WHZ.js} +2 -2
  15. package/dist/chunks/JU5VP7GA.js +13 -0
  16. package/dist/chunks/{5OBOVEK6.js → KXKIZ3ZM.js} +2 -2
  17. package/dist/chunks/{MA74JJUB.js → KZ2PTXAO.js} +2 -2
  18. package/dist/chunks/L3CVM7BS.js +2 -0
  19. package/dist/chunks/{EFELMJMQ.js → M5R7OBNV.js} +2 -2
  20. package/dist/chunks/{NQUAVRMC.js → M64773TP.js} +2 -2
  21. package/dist/chunks/{XVJ3CMFN.js → MLCAO5BP.js} +2 -2
  22. package/dist/chunks/{YQQKZUVS.js → NFCM74MS.js} +2 -2
  23. package/dist/chunks/{S7C7NHZI.js → OYYGUGM3.js} +2 -2
  24. package/dist/chunks/{VP3HFVV4.js → PPZGWRCM.js} +1 -1
  25. package/dist/chunks/{AKJC5WTU.js → Q5J5SAQN.js} +1 -1
  26. package/dist/chunks/{HVRVTNMI.js → R3HD47TY.js} +1 -1
  27. package/dist/chunks/{AMKY4SZU.js → RH33COMI.js} +2 -2
  28. package/dist/chunks/{B64J3E3T.js → V3FMVRBO.js} +2 -2
  29. package/dist/chunks/{5H3UYFOC.js → XKVQ4IQL.js} +2 -2
  30. package/dist/chunks/{QOETZ4FB.js → Y4V3NO2R.js} +1 -1
  31. package/dist/chunks/{FOZVJW7G.js → Z3MUYA3L.js} +2 -2
  32. package/dist/chunks/{Q3GH7I66.js → ZWTD6MI2.js} +2 -2
  33. package/dist/cli.js +6 -3
  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/backend/src/gateways.d.ts +2 -1
  52. package/types/cloud/src/generated/project.d.ts +2 -2
  53. package/types/internal/src/chat.d.ts +17 -0
  54. package/types/internal/src/modules/ai.d.ts +53 -8
  55. package/types/internal/src/modules/commerce.d.ts +38 -12
  56. package/types/internal/src/modules/events.d.ts +2 -2
  57. package/types/internal/src/modules/iap.d.ts +112 -101
  58. package/types/internal/src/modules/payments.d.ts +1225 -73
  59. package/types/web/src/chat.d.ts +4 -2
  60. package/dist/chunks/3I5XH3A3.js +0 -13
  61. package/dist/chunks/RP2TPMXT.js +0 -2
@@ -11,6 +11,14 @@ export type AddMethodRequest = {
11
11
  * Optional channel override.
12
12
  */
13
13
  channel?: string;
14
+ /**
15
+ * Ask the billing address on the page and keep it in the customer's profile.
16
+ */
17
+ collect_billing_address?: boolean;
18
+ /**
19
+ * Make the card the customer's default on its channel once it is saved. The first card saved is the default whatever is asked.
20
+ */
21
+ make_default?: boolean;
14
22
  /**
15
23
  * Phone number for Masterpass card lookup.
16
24
  */
@@ -130,6 +138,7 @@ export type AttemptView = {
130
138
  * Whether the attempt failure is retryable.
131
139
  */
132
140
  retryable: boolean;
141
+ returned?: ReturnedCharge;
133
142
  /**
134
143
  * Attempt settlement timestamp.
135
144
  */
@@ -261,9 +270,13 @@ export type Buyer = {
261
270
  */
262
271
  surname?: string;
263
272
  /**
264
- * National identity or tax ID number.
273
+ * National identity or tax number.
265
274
  */
266
275
  tax_id?: string;
276
+ /**
277
+ * The kind of tax number `tax_id` is, as Stripe names them (`eu_vat`, `tr_tin`, `us_ein`…). With it the number is kept on the provider's customer and printed on its invoices; without it the number stays in the profile.
278
+ */
279
+ tax_id_type?: string;
267
280
  };
268
281
  /**
269
282
  * Cancel an unsettled PaymentIntent and release any split wallet hold.
@@ -299,6 +312,10 @@ export type CancelSubscriptionResponse = {
299
312
  * Updated subscription status.
300
313
  */
301
314
  status: string;
315
+ /**
316
+ * Present and true when the payment provider the channel's keys reach does not know the subscription (the channel was connected to another account, or moved from test to live): the subscription was ended here, and nothing was changed at the provider. End it there if it still renews in the other account.
317
+ */
318
+ provider_unknown?: boolean;
302
319
  };
303
320
  /**
304
321
  * Feature matrix supported by a connected payment channel.
@@ -329,7 +346,7 @@ export type Capabilities = {
329
346
  */
330
347
  masterpass: boolean;
331
348
  /**
332
- * Whether tokenized card storage is supported.
349
+ * Whether the channel's provider keeps cards for the project. False on iyzico: its payment page saves a card to the buyer's own iyzico wallet and hands the merchant no card token.
333
350
  */
334
351
  saved_cards: boolean;
335
352
  /**
@@ -340,6 +357,18 @@ export type Capabilities = {
340
357
  * Whether 3D Secure authentication is supported.
341
358
  */
342
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;
343
372
  };
344
373
  /**
345
374
  * Resolved payment capabilities and active wallets for checkout rendering.
@@ -608,13 +637,17 @@ export type ConfirmIntentRequest = {
608
637
  * Saved payment method UUID for one-click payment.
609
638
  */
610
639
  method_id?: string;
640
+ /**
641
+ * Charge the saved card named by `method_id` with its holder away (secret key only; a Stripe channel — `off_session_unsupported` elsewhere). The card is charged with no step of the holder's, whatever the project's 3-D Secure threshold; a bank that asks the holder to authenticate declines the payment (`authentication_required`) instead of leaving it waiting.
642
+ */
643
+ off_session?: boolean;
611
644
  /**
612
645
  * Phone number for Masterpass OTP lookup.
613
646
  */
614
647
  phone?: string;
615
648
  provider_options?: ProviderOptions;
616
649
  /**
617
- * Tokenize and save the card after payment succeeds.
650
+ * Keep the card for the customer once the payment succeeds. The payment's `method_save` says what became of it.
618
651
  */
619
652
  save_method?: boolean;
620
653
  /**
@@ -769,7 +802,7 @@ export type CreateSpendTokenRequest = {
769
802
  */
770
803
  export type CreateSubscriptionRequest = {
771
804
  /**
772
- * 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).
773
806
  */
774
807
  amount: number;
775
808
  /**
@@ -830,6 +863,10 @@ export type CreateSubscriptionRequest = {
830
863
  * Optional trial duration in days.
831
864
  */
832
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;
833
870
  };
834
871
  /**
835
872
  * Grant promotional reward or administrative adjustment to a customer wallet.
@@ -890,6 +927,14 @@ export type DisputeEvent = {
890
927
  * Disputed amount in minor units.
891
928
  */
892
929
  amount: number;
930
+ /**
931
+ * The attempt that took the disputed charge, when it is a returned charge's.
932
+ */
933
+ attempt_id?: string;
934
+ /**
935
+ * The channel the payment was taken through.
936
+ */
937
+ channel_key?: string;
893
938
  /**
894
939
  * ISO 4217 currency code.
895
940
  */
@@ -912,6 +957,18 @@ export type DisputeEvent = {
912
957
  * Disputed PaymentIntent UUID.
913
958
  */
914
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;
964
+ /**
965
+ * Whether the payment's channel takes live payments.
966
+ */
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;
915
972
  /**
916
973
  * Provider name.
917
974
  */
@@ -920,14 +977,42 @@ export type DisputeEvent = {
920
977
  * Provider dispute ID.
921
978
  */
922
979
  provider_dispute_id?: string;
980
+ /**
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).
982
+ */
983
+ provider_payment_id?: string;
984
+ /**
985
+ * What the provider calls the subscription the payment started, when it started one.
986
+ */
987
+ provider_subscription_id?: string;
923
988
  /**
924
989
  * Dispute reason.
925
990
  */
926
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;
927
1000
  /**
928
1001
  * Dispute status.
929
1002
  */
930
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;
931
1016
  };
932
1017
  /**
933
1018
  * Paginated list of disputes.
@@ -1246,7 +1331,7 @@ export type IntentSummary = {
1246
1331
  */
1247
1332
  capture_method: string;
1248
1333
  /**
1249
- * 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.
1250
1335
  */
1251
1336
  captured_amount: number;
1252
1337
  /**
@@ -1282,7 +1367,7 @@ export type IntentSummary = {
1282
1367
  */
1283
1368
  id: string;
1284
1369
  /**
1285
- * Intent kind.
1370
+ * Intent kind (payment, top_up, subscription_initial, iap_web, subscription_charge).
1286
1371
  */
1287
1372
  kind: string;
1288
1373
  /**
@@ -1335,7 +1420,7 @@ export type IntentView = {
1335
1420
  */
1336
1421
  capture_method: string;
1337
1422
  /**
1338
- * 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.
1339
1424
  */
1340
1425
  captured_amount: number;
1341
1426
  /**
@@ -1379,7 +1464,7 @@ export type IntentView = {
1379
1464
  */
1380
1465
  id: string;
1381
1466
  /**
1382
- * 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.
1383
1468
  */
1384
1469
  kind: string;
1385
1470
  /**
@@ -1388,6 +1473,10 @@ export type IntentView = {
1388
1473
  metadata?: {
1389
1474
  [key: string]: unknown;
1390
1475
  };
1476
+ /**
1477
+ * What became of a confirm's `save_method`: `requested` until the payment is paid; then `saved` once the card is one of the customer's, or `not_saved` when none came of the payment. `unsupported` where the channel's provider keeps no card for the project (the payment goes on without).
1478
+ */
1479
+ method_save?: "requested" | "saved" | "not_saved" | "unsupported";
1391
1480
  next_action?: NextAction;
1392
1481
  /**
1393
1482
  * Resolved provider name (stripe, iyzico, wallet).
@@ -1642,17 +1731,37 @@ export type PaymentLifecycleEvent = {
1642
1731
  */
1643
1732
  attempt_id?: string;
1644
1733
  /**
1645
- * Captured amount in minor units.
1734
+ * For a payment that started a subscription: true when it will not renew.
1735
+ */
1736
+ cancel_at_period_end?: boolean;
1737
+ /**
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.
1646
1739
  */
1647
1740
  captured_amount?: number;
1648
1741
  /**
1649
1742
  * Channel key.
1650
1743
  */
1651
1744
  channel_key?: string;
1745
+ /**
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.
1747
+ */
1748
+ charged_amount?: number;
1652
1749
  /**
1653
1750
  * ISO 4217 currency code.
1654
1751
  */
1655
1752
  currency?: string;
1753
+ /**
1754
+ * For a payment that started a subscription: when the period it paid for ends.
1755
+ */
1756
+ current_period_end?: string | null;
1757
+ /**
1758
+ * For a payment that started a subscription: when the period it paid for began.
1759
+ */
1760
+ current_period_start?: string | null;
1761
+ /**
1762
+ * The email the buyer gave at checkout, when the provider tells it.
1763
+ */
1764
+ customer_email?: string;
1656
1765
  /**
1657
1766
  * Customer UID.
1658
1767
  */
@@ -1703,10 +1812,26 @@ export type PaymentLifecycleEvent = {
1703
1812
  * Merchant reference.
1704
1813
  */
1705
1814
  reference?: string;
1815
+ /**
1816
+ * For a payment that started a subscription: how the subscription stands (trialing, active).
1817
+ */
1818
+ subscription_status?: string;
1706
1819
  /**
1707
1820
  * Tax amount in minor units.
1708
1821
  */
1709
1822
  tax_amount?: number;
1823
+ /**
1824
+ * For a payment that started a subscription: when its free trial ends.
1825
+ */
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;
1710
1835
  };
1711
1836
  /**
1712
1837
  * List of payment splits.
@@ -1868,10 +1993,22 @@ export type RefundListResponse = {
1868
1993
  * Emitted when a refund completes (original payment method or instant wallet credit).
1869
1994
  */
1870
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;
1871
2000
  /**
1872
2001
  * Refund amount in minor units.
1873
2002
  */
1874
2003
  amount: number;
2004
+ /**
2005
+ * What went back to the card, in minor units.
2006
+ */
2007
+ card_amount?: number;
2008
+ /**
2009
+ * The channel the payment was taken through.
2010
+ */
2011
+ channel_key?: string;
1875
2012
  /**
1876
2013
  * ISO 4217 currency code.
1877
2014
  */
@@ -1894,18 +2031,50 @@ export type RefundSucceededEvent = {
1894
2031
  * PaymentIntent UUID.
1895
2032
  */
1896
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;
2038
+ /**
2039
+ * Whether the payment's channel takes live payments.
2040
+ */
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;
2046
+ /**
2047
+ * Provider name.
2048
+ */
2049
+ provider?: string;
1897
2050
  /**
1898
2051
  * Provider operation executed.
1899
2052
  */
1900
2053
  provider_op?: string;
2054
+ /**
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).
2056
+ */
2057
+ provider_payment_id?: string;
1901
2058
  /**
1902
2059
  * Provider refund ID.
1903
2060
  */
1904
2061
  provider_refund_id?: string;
2062
+ /**
2063
+ * What the provider calls the subscription the payment started, when it started one.
2064
+ */
2065
+ provider_subscription_id?: string;
1905
2066
  /**
1906
2067
  * Refund UUID.
1907
2068
  */
1908
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;
2074
+ /**
2075
+ * What went back to the wallet, in minor units.
2076
+ */
2077
+ wallet_amount?: number;
1909
2078
  /**
1910
2079
  * Wallet key when refunded to wallet.
1911
2080
  */
@@ -1914,6 +2083,14 @@ export type RefundSucceededEvent = {
1914
2083
  * Ledger transaction UUID when refunded to wallet.
1915
2084
  */
1916
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;
1917
2094
  };
1918
2095
  /**
1919
2096
  * Refund record.
@@ -2001,7 +2178,7 @@ export type RoutingRule = {
2001
2178
  */
2002
2179
  id?: string;
2003
2180
  /**
2004
- * 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.
2005
2182
  */
2006
2183
  payment_kind?: string | null;
2007
2184
  /**
@@ -2063,10 +2240,18 @@ export type SavedMethodView = {
2063
2240
  * Expiration year.
2064
2241
  */
2065
2242
  exp_year?: number | null;
2243
+ /**
2244
+ * The provider's mark of the card number: two saved methods of one card carry the same. Empty where the provider gives none.
2245
+ */
2246
+ fingerprint?: string;
2066
2247
  /**
2067
2248
  * Saved payment method UUID.
2068
2249
  */
2069
2250
  id: string;
2251
+ /**
2252
+ * Whether this is the customer's default card on its channel.
2253
+ */
2254
+ is_default: boolean;
2070
2255
  /**
2071
2256
  * Method kind (card).
2072
2257
  */
@@ -2156,7 +2341,7 @@ export type Settings = {
2156
2341
  */
2157
2342
  allow_marketplace_fiat_wallet?: boolean;
2158
2343
  /**
2159
- * Cancel active subscriptions when an auth user is deleted.
2344
+ * What becomes, at the providers, of what could still take a deleted auth user's money. On (the default): their subscriptions stop renewing at their providers (at the period's end) and their saved cards are taken off the providers' vaults. Off: both stay at the provider. Either way the profile written on the provider's customer record (name, email, address, tax number) is taken off it; the record itself stays. A provider that cannot be reached holds the user's erasure here until it can be. One that refuses the channel's keys, or a channel that cannot be asked at all, is passed over: the user is erased here all the same, and their subscription and cards stay at that provider — the project's to end there. Subscriptions the IAP module sells on the web are among them: they stop with the rest whatever IAP's own `cancel_on_delete` says.
2160
2345
  */
2161
2346
  cancel_on_delete: boolean;
2162
2347
  /**
@@ -2438,6 +2623,10 @@ export type StripeOptions = {
2438
2623
  * Use Stripe Managed Payments where available.
2439
2624
  */
2440
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";
2441
2630
  /**
2442
2631
  * Optional Stripe tax code.
2443
2632
  */
@@ -2570,43 +2759,116 @@ export type SubmitOTPRequest = {
2570
2759
  save_method?: boolean;
2571
2760
  };
2572
2761
  /**
2573
- * Emitted when a recurring subscription changes state or is canceled.
2762
+ * A recurring subscription as its row holds it once something of it changed: its start, a renewal's payment, a failed charge, its renewal turned off, its end. Told the same whoever changed it — the project's server, support, or the customer in the provider's portal.
2574
2763
  */
2575
2764
  export type SubscriptionEvent = {
2576
2765
  /**
2577
- * True when scheduled to cancel at period end.
2766
+ * What a period costs, in minor units: `unit_amount` by `quantity`.
2767
+ */
2768
+ amount?: number;
2769
+ /**
2770
+ * A failed charge's amount, in minor units (change payment_failed).
2771
+ */
2772
+ amount_due?: number;
2773
+ /**
2774
+ * Set to platform_mit_marketplace for a subscription Palbase charges itself.
2775
+ */
2776
+ billing_mode?: string;
2777
+ /**
2778
+ * True when it will not renew: it ends with the period it is in.
2578
2779
  */
2579
2780
  cancel_at_period_end?: boolean;
2580
2781
  /**
2581
- * Period end timestamp.
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).
2783
+ */
2784
+ change?: "started" | "renewed" | "payment_failed" | "charged" | "canceled" | "updated";
2785
+ /**
2786
+ * The channel it is billed through.
2787
+ */
2788
+ channel_key?: string;
2789
+ /**
2790
+ * ISO 4217 currency code.
2791
+ */
2792
+ currency?: string;
2793
+ /**
2794
+ * When the period it is in ends.
2582
2795
  */
2583
2796
  current_period_end?: string | null;
2584
2797
  /**
2585
- * Customer UID.
2798
+ * When the period it is in began.
2799
+ */
2800
+ current_period_start?: string | null;
2801
+ /**
2802
+ * The customer it is of. Empty for one that is nobody's here: bought through In-App Purchases' web checkout by a buyer with no account, or kept for In-App Purchases after its customer was erased.
2586
2803
  */
2587
2804
  customer_id?: string;
2588
2805
  /**
2589
- * Optional IAP metadata.
2806
+ * When it ended. Set on every event of a subscription that has ended (status canceled or expired): it gives nothing more, whatever period it had paid for. Absent while it is only set not to renew.
2807
+ */
2808
+ ended_at?: string | null;
2809
+ /**
2810
+ * Set when it is a catalog plan bought through In-App Purchases' web checkout: the catalog's product_key and plan_key, and the session_id its checkout was answered.
2590
2811
  */
2591
2812
  iap_context?: {
2592
2813
  [key: string]: unknown;
2593
2814
  };
2815
+ /**
2816
+ * Billing interval: day, week, month or year.
2817
+ */
2818
+ interval?: string;
2819
+ /**
2820
+ * Intervals per period.
2821
+ */
2822
+ interval_count?: number;
2823
+ /**
2824
+ * The provider's invoice of a renewal or a failed charge.
2825
+ */
2826
+ invoice_id?: string;
2827
+ /**
2828
+ * Whether its channel takes live payments.
2829
+ */
2830
+ livemode?: boolean;
2594
2831
  /**
2595
2832
  * Provider name.
2596
2833
  */
2597
2834
  provider?: string;
2598
2835
  /**
2599
- * Provider subscription ID.
2836
+ * What the provider calls the subscription.
2600
2837
  */
2601
2838
  provider_sub_id?: string;
2602
2839
  /**
2603
- * Subscription status.
2840
+ * Subscription status (pending, trialing, active, past_due, paused, canceled, expired).
2604
2841
  */
2605
2842
  status: string;
2606
2843
  /**
2607
2844
  * Subscription UUID.
2608
2845
  */
2609
2846
  subscription_id: string;
2847
+ transaction?: SubscriptionRenewalPayment;
2848
+ /**
2849
+ * When its free trial ends.
2850
+ */
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;
2610
2872
  };
2611
2873
  /**
2612
2874
  * Paginated list of subscriptions.
@@ -2626,7 +2888,7 @@ export type SubscriptionListResponse = {
2626
2888
  */
2627
2889
  export type SubscriptionSummary = {
2628
2890
  /**
2629
- * Recurring amount in minor units.
2891
+ * What a period costs, in minor units: `unit_amount` by `quantity`.
2630
2892
  */
2631
2893
  amount: number;
2632
2894
  /**
@@ -2654,9 +2916,13 @@ export type SubscriptionSummary = {
2654
2916
  */
2655
2917
  current_period_start?: string | null;
2656
2918
  /**
2657
- * Customer UID.
2919
+ * The customer it is of; empty for one that is nobody's here (bought by a buyer with no account, or kept after its customer was erased).
2658
2920
  */
2659
2921
  customer_id: string;
2922
+ /**
2923
+ * When it ended, once it has: it gives nothing more, whatever period it had paid for. Absent while it is only set not to renew.
2924
+ */
2925
+ ended_at?: string | null;
2660
2926
  /**
2661
2927
  * Subscription UUID.
2662
2928
  */
@@ -2684,20 +2950,52 @@ export type SubscriptionSummary = {
2684
2950
  */
2685
2951
  provider_sub_id?: string;
2686
2952
  /**
2687
- * Subscription status.
2953
+ * Subscription status (pending, trialing, active, past_due, paused, canceled, expired).
2688
2954
  */
2689
2955
  status: string;
2690
2956
  /**
2691
2957
  * Trial end timestamp.
2692
2958
  */
2693
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;
2694
2992
  };
2695
2993
  /**
2696
2994
  * Recurring subscription representation.
2697
2995
  */
2698
2996
  export type SubscriptionView = {
2699
2997
  /**
2700
- * Recurring amount in minor units.
2998
+ * What a period costs, in minor units: `unit_amount` by `quantity`.
2701
2999
  */
2702
3000
  amount: number;
2703
3001
  /**
@@ -2725,9 +3023,13 @@ export type SubscriptionView = {
2725
3023
  */
2726
3024
  current_period_start?: string | null;
2727
3025
  /**
2728
- * Customer UID.
3026
+ * The customer it is of; empty for one that is nobody's here (bought by a buyer with no account, or kept after its customer was erased).
2729
3027
  */
2730
3028
  customer_id: string;
3029
+ /**
3030
+ * When it ended, once it has: it gives nothing more, whatever period it had paid for. Absent while it is only set not to renew.
3031
+ */
3032
+ ended_at?: string | null;
2731
3033
  /**
2732
3034
  * Subscription UUID.
2733
3035
  */
@@ -2756,13 +3058,33 @@ export type SubscriptionView = {
2756
3058
  */
2757
3059
  provider_sub_id?: string;
2758
3060
  /**
2759
- * Subscription status (pending, trialing, active, past_due, canceled, expired).
3061
+ * Subscription status (pending, trialing, active, past_due, paused, canceled, expired).
2760
3062
  */
2761
3063
  status: string;
2762
3064
  /**
2763
3065
  * Trial end timestamp.
2764
3066
  */
2765
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;
2766
3088
  };
2767
3089
  /**
2768
3090
  * Initiate a real-money wallet top-up.
@@ -3255,80 +3577,722 @@ export type PendingRefundSettled = {
3255
3577
  */
3256
3578
  made?: boolean;
3257
3579
  };
3258
- /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
3259
- export interface Events {
3580
+ /**
3581
+ * Open the provider's page that saves a card for a payer.
3582
+ */
3583
+ export type AddCustomerMethodRequest = {
3260
3584
  /**
3261
- * payments.dispute.closed: a provider dispute closed (won or lost); wallet chargeback debits or reversals are applied.
3585
+ * Allowed cancel URL (default: return_url).
3262
3586
  */
3263
- "payments.dispute.closed": DisputeEvent;
3587
+ cancel_url?: string;
3264
3588
  /**
3265
- * payments.dispute.opened: a provider chargeback/dispute was opened against a payment.
3589
+ * Optional channel override.
3266
3590
  */
3267
- "payments.dispute.opened": DisputeEvent;
3591
+ channel?: string;
3268
3592
  /**
3269
- * payments.payment.canceled: a PaymentIntent was canceled and any split wallet hold released.
3593
+ * Ask the billing address on the page and keep it in the payer's profile.
3270
3594
  */
3271
- "payments.payment.canceled": PaymentLifecycleEvent;
3595
+ collect_billing_address?: boolean;
3272
3596
  /**
3273
- * payments.payment.failed: a payment attempt failed with a canonical decline code.
3597
+ * Make the card the payer's default on its channel once it is saved. The first card saved is the default whatever is asked.
3274
3598
  */
3275
- "payments.payment.failed": PaymentLifecycleEvent;
3599
+ make_default?: boolean;
3276
3600
  /**
3277
- * payments.payment.requires_capture: a manual-capture PaymentIntent was authorized and awaits capture or cancel.
3601
+ * Allowed return URL the page sends the cardholder back to.
3278
3602
  */
3279
- "payments.payment.requires_capture": PaymentLifecycleEvent;
3603
+ return_url: string;
3604
+ };
3605
+ /**
3606
+ * A customer's record at a provider that could not be deleted there.
3607
+ */
3608
+ export type ProviderRecordKept = {
3280
3609
  /**
3281
- * payments.payment.succeeded: a PaymentIntent was verified and settled (card, wallet, or split).
3610
+ * The channel whose provider keeps the record.
3282
3611
  */
3283
- "payments.payment.succeeded": PaymentLifecycleEvent;
3612
+ channel_key: string;
3284
3613
  /**
3285
- * payments.refund.succeeded: a refund settled to the original card or instantly to the customer's wallet.
3614
+ * Why it was kept: `channel_keys_refused` (the provider refuses the channel's keys), `channel_keys_unreadable`, `provider_record_not_found` (the account the channel's keys reach has no such record: they are another account's now), or `provider_refused`.
3286
3615
  */
3287
- "payments.refund.succeeded": RefundSucceededEvent;
3616
+ reason: string;
3617
+ };
3618
+ /**
3619
+ * A payer forgotten, and what of it a provider still keeps.
3620
+ */
3621
+ export type DeleteCustomerResponse = {
3288
3622
  /**
3289
- * payments.split.approved: a marketplace payment split was approved or transferred to the seller.
3623
+ * Always true.
3290
3624
  */
3291
- "payments.split.approved": SplitLifecycleEvent;
3625
+ deleted: boolean;
3292
3626
  /**
3293
- * payments.split.refunded: a marketplace payment split was partially or fully refunded with seller clawback.
3627
+ * The payer's id.
3294
3628
  */
3295
- "payments.split.refunded": SplitLifecycleEvent;
3629
+ id: string;
3296
3630
  /**
3297
- * payments.sub_merchant.updated: a marketplace sub-merchant was onboarded, synced, or updated by provider webhook.
3631
+ * The payer's records at providers that could not be asked to delete them; empty when every one was deleted.
3298
3632
  */
3299
- "payments.sub_merchant.updated": SubMerchantUpdatedEvent;
3633
+ provider_records_kept: ProviderRecordKept[];
3634
+ };
3635
+ /**
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.
3637
+ */
3638
+ export type SubscriptionRenewalPayment = {
3300
3639
  /**
3301
- * payments.subscription.canceled: a recurring subscription was canceled (immediately or at period end).
3640
+ * What was paid, in minor units.
3302
3641
  */
3303
- "payments.subscription.canceled": SubscriptionEvent;
3642
+ amount_paid: number;
3304
3643
  /**
3305
- * payments.subscription.changed: a recurring subscription started, renewed, entered past_due, or changed status.
3644
+ * ISO 4217 currency code.
3306
3645
  */
3307
- "payments.subscription.changed": SubscriptionEvent;
3646
+ currency?: string;
3308
3647
  /**
3309
- * payments.wallet.balance_changed: a customer's closed-loop wallet balance changed; Realtime delivers this on payments:<ref>:<uid>.
3648
+ * The provider's invoice.
3310
3649
  */
3311
- "payments.wallet.balance_changed": WalletBalanceEvent;
3650
+ id: string;
3312
3651
  /**
3313
- * payments.wallet.hold_changed: a two-phase wallet hold was created, committed, released, or expired.
3652
+ * When the period it pays for ends.
3314
3653
  */
3315
- "payments.wallet.hold_changed": WalletHoldEvent;
3654
+ period_end?: string | null;
3316
3655
  /**
3317
- * payments.wallet.vested: a pending cashback or referral wallet lot vested into spendable balance.
3656
+ * When the period it pays for began.
3318
3657
  */
3319
- "payments.wallet.vested": WalletVestedEvent;
3320
- }
3321
- /** Palbase Payments */
3322
- export declare function client(t: Transport): {
3658
+ period_start?: string | null;
3323
3659
  /**
3324
- * Get wallet cash-flow summary
3325
- *
3326
- * Aggregates closed-loop wallet inflows, outflows, refunds, chargebacks, and net customer liability grouped by currency.
3660
+ * The tax in what was paid, in minor units.
3327
3661
  */
3328
- auditCashFlow(input?: {
3329
- query?: {
3330
- from?: string; /** Exclusive RFC 3339 end timestamp. */
3331
- to?: string;
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;
4193
+ };
4194
+ /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
4195
+ export interface Events {
4196
+ /**
4197
+ * payments.dispute.closed: a provider dispute closed (won or lost); wallet chargeback debits or reversals are applied.
4198
+ */
4199
+ "payments.dispute.closed": DisputeEvent;
4200
+ /**
4201
+ * payments.dispute.opened: a provider chargeback/dispute was opened against a payment.
4202
+ */
4203
+ "payments.dispute.opened": DisputeEvent;
4204
+ /**
4205
+ * payments.payment.canceled: a PaymentIntent was canceled and any split wallet hold released.
4206
+ */
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;
4212
+ /**
4213
+ * payments.payment.failed: a payment attempt failed with a canonical decline code.
4214
+ */
4215
+ "payments.payment.failed": PaymentLifecycleEvent;
4216
+ /**
4217
+ * payments.payment.requires_capture: a manual-capture PaymentIntent was authorized and awaits capture or cancel.
4218
+ */
4219
+ "payments.payment.requires_capture": PaymentLifecycleEvent;
4220
+ /**
4221
+ * payments.payment.succeeded: a PaymentIntent was verified and settled (card, wallet, or split).
4222
+ */
4223
+ "payments.payment.succeeded": PaymentLifecycleEvent;
4224
+ /**
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).
4226
+ */
4227
+ "payments.refund.succeeded": RefundSucceededEvent;
4228
+ /**
4229
+ * payments.split.approved: a marketplace payment split was approved or transferred to the seller.
4230
+ */
4231
+ "payments.split.approved": SplitLifecycleEvent;
4232
+ /**
4233
+ * payments.split.refunded: a marketplace payment split was partially or fully refunded with seller clawback.
4234
+ */
4235
+ "payments.split.refunded": SplitLifecycleEvent;
4236
+ /**
4237
+ * payments.sub_merchant.updated: a marketplace sub-merchant was onboarded, synced, or updated by provider webhook.
4238
+ */
4239
+ "payments.sub_merchant.updated": SubMerchantUpdatedEvent;
4240
+ /**
4241
+ * payments.subscription.canceled: a recurring subscription's renewal was turned off (it keeps the period paid for: `cancel_at_period_end`), or it ended (`status` canceled, `ended_at`) — by the project's server, by support, or by the customer in the provider's portal.
4242
+ */
4243
+ "payments.subscription.canceled": SubscriptionEvent;
4244
+ /**
4245
+ * payments.subscription.changed: a recurring subscription started, renewed, was not charged, or moved on (its period, its status) — `change` says which; whoever caused it, the project's server or the provider. Two things at once are two events.
4246
+ */
4247
+ "payments.subscription.changed": SubscriptionEvent;
4248
+ /**
4249
+ * payments.wallet.balance_changed: a customer's closed-loop wallet balance changed; Realtime delivers this on payments:<ref>:<uid>.
4250
+ */
4251
+ "payments.wallet.balance_changed": WalletBalanceEvent;
4252
+ /**
4253
+ * payments.wallet.hold_changed: a two-phase wallet hold was created, committed, released, or expired.
4254
+ */
4255
+ "payments.wallet.hold_changed": WalletHoldEvent;
4256
+ /**
4257
+ * payments.wallet.vested: a pending cashback or referral wallet lot vested into spendable balance.
4258
+ */
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;
4284
+ }
4285
+ /** Palbase Payments */
4286
+ export declare function client(t: Transport): {
4287
+ /**
4288
+ * Get wallet cash-flow summary
4289
+ *
4290
+ * Aggregates closed-loop wallet inflows, outflows, refunds, chargebacks, and net customer liability grouped by currency.
4291
+ */
4292
+ auditCashFlow(input?: {
4293
+ query?: {
4294
+ from?: string; /** Exclusive RFC 3339 end timestamp. */
4295
+ to?: string;
3332
4296
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3333
4297
  signal?: AbortSignal;
3334
4298
  }): Promise<Reply<200, CashFlowResponse>>;
@@ -3578,7 +4542,7 @@ export declare function client(t: Transport): {
3578
4542
  /**
3579
4543
  * Cancel payment intent
3580
4544
  *
3581
- * Cancels an unsettled PaymentIntent, voids any provider authorization, and releases any split wallet hold.
4545
+ * Cancels an unsettled PaymentIntent, voids any provider authorization, and releases any split wallet hold. What is still open of the payment at its provider — a hosted page its buyer could pay on, a card's charge whose outcome is not known — is closed there before the payment is told canceled (Stripe). An attempt found paid is the payment: it is settled paid and the answer is `409 intent_already_succeeded`. `409 payment_busy` while a confirmation of the payment is being made; `503` when the provider cannot say how an open attempt stands — the payment is not told canceled while money may be taken on it, and asking again is safe. A channel whose keys the provider refuses, or that cannot be asked at all, withdraws nothing: the payment is canceled all the same. After a `503`, what the cancellation had begun to close is closed within minutes and the payment is told failed (`payments.payment.failed`) — payable again — unless the cancellation is asked again. `409 payment_busy` and `409 payment_in_progress` are not kept against an `Idempotency-Key`: asked again under the same key, the cancellation is made.
3582
4546
  */
3583
4547
  cancelIntent(input: {
3584
4548
  path: {
@@ -3623,7 +4587,7 @@ export declare function client(t: Transport): {
3623
4587
  /**
3624
4588
  * Confirm payment intent
3625
4589
  *
3626
- * Creates a new PaymentAttempt for the PaymentIntent (saved card, Masterpass OTP, Stripe Elements, or hosted/embedded 3DS form) and returns the canonical NextAction.
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.
3627
4591
  */
3628
4592
  confirmIntent(input: {
3629
4593
  path: {
@@ -3650,7 +4614,7 @@ export declare function client(t: Transport): {
3650
4614
  /**
3651
4615
  * List saved payment methods
3652
4616
  *
3653
- * Lists the signed-in customer's active tokenized payment methods across Stripe, iyzico, and Masterpass.
4617
+ * Lists the signed-in customer's active saved payment methods: each channel's default first, then the newest. Once a billing portal session was opened for the customer, the list follows what the provider has, as ListCustomerMethods does.
3654
4618
  */
3655
4619
  listMyMethods(input?: {
3656
4620
  signal?: AbortSignal;
@@ -3658,7 +4622,7 @@ export declare function client(t: Transport): {
3658
4622
  /**
3659
4623
  * Add saved payment method
3660
4624
  *
3661
- * Initiates a PCI-safe card tokenization flow (SetupIntent, iyzico card save, or Masterpass OTP link) and returns a NextAction.
4625
+ * Opens a PCI-safe card-saving flow (the provider's own page, or a Masterpass OTP link) and returns a NextAction. A channel whose provider keeps no card for the project (iyzico) answers `setup_only_unsupported`. `409 provider_customer_gone` when the customer's record was deleted on the provider's own pages: it is let go of here, and calling again makes a new one.
3662
4626
  */
3663
4627
  addMyMethod(input?: {
3664
4628
  body?: AddMethodRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
@@ -3667,7 +4631,7 @@ export declare function client(t: Transport): {
3667
4631
  /**
3668
4632
  * Delete saved payment method
3669
4633
  *
3670
- * Detaches the saved payment method from the provider vault and marks it revoked.
4634
+ * Takes the saved payment method off the provider's vault and marks it revoked. When it was the default, the oldest card left on its channel becomes the default. `503 provider_unavailable` when the provider cannot be reached to remove it: the method is kept, and asking again is safe.
3671
4635
  */
3672
4636
  deleteMyMethod(input: {
3673
4637
  path: {
@@ -3678,7 +4642,7 @@ export declare function client(t: Transport): {
3678
4642
  /**
3679
4643
  * Create billing portal session
3680
4644
  *
3681
- * Opens a provider-hosted self-service billing portal session for the signed-in customer.
4645
+ * Opens a provider-hosted self-service billing portal session for the signed-in customer. `409 provider_customer_gone` when the customer's record was deleted on the provider's own pages.
3682
4646
  */
3683
4647
  createMyPortal(input: {
3684
4648
  body: PortalRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
@@ -3695,7 +4659,7 @@ export declare function client(t: Transport): {
3695
4659
  /**
3696
4660
  * Update customer billing profile
3697
4661
  *
3698
- * Saves the signed-in customer's billing/shipping profile sealed with the project's data key.
4662
+ * Saves the signed-in customer's billing/shipping profile sealed with the project's data key, and hands it to a provider that keeps a customer record of its own, as UpdateCustomer does.
3699
4663
  */
3700
4664
  updateMyProfile(input: {
3701
4665
  body: Buyer; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
@@ -4047,6 +5011,18 @@ export declare function client(t: Transport): {
4047
5011
  body: ExtendSubscriptionRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4048
5012
  signal?: AbortSignal;
4049
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>>;
4050
5026
  /**
4051
5027
  * List wallet definitions
4052
5028
  *
@@ -4200,5 +5176,181 @@ export declare function client(t: Transport): {
4200
5176
  stripeConnectWebhook(input?: {
4201
5177
  signal?: AbortSignal;
4202
5178
  }): Promise<Reply<200, undefined>>;
5179
+ /**
5180
+ * Get a payer's billing profile
5181
+ *
5182
+ * Reads the profile of a payer: a signed-in customer, or a company or team the project's server names. 404 `customer_not_found` when nothing is kept under that id.
5183
+ */
5184
+ getCustomer(input: {
5185
+ path: {
5186
+ customer_id: string;
5187
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5188
+ signal?: AbortSignal;
5189
+ }): Promise<Reply<200, Buyer>>;
5190
+ /**
5191
+ * Update a payer's billing profile
5192
+ *
5193
+ * Keeps a payer's billing profile whole, as given (the payer is made if it is not there). A provider that keeps a customer record of its own (Stripe) is handed the name, email, phone, billing address and — when `tax_id_type` names its kind — the tax number, which its invoices then carry. A tax number or an address the provider refuses is answered `tax_id_invalid` or `billing_address_invalid`, and the profile is not kept. A payer no provider has a record of yet is asked of none: its profile is handed over when its record is first made, and what the provider refuses then is told by the call that makes it (AddCustomerMethod). A provider that cannot be reached fails the change with `503 provider_unavailable`; a record that is gone at its provider, or a channel whose keys its provider refuses, does not: the profile is kept here.
5194
+ */
5195
+ updateCustomer(input: {
5196
+ path: {
5197
+ customer_id: string;
5198
+ };
5199
+ body: Buyer; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5200
+ signal?: AbortSignal;
5201
+ }): Promise<Reply<200, Buyer>>;
5202
+ /**
5203
+ * Delete a payer
5204
+ *
5205
+ * Forgets a payer. Its customer record at each provider is deleted first (its cards go with it) — every channel whose keys are still kept is asked, in use or not — then its profile, cards and references here. A provider that cannot be reached fails the deletion with `503 provider_unavailable`: the deletion is not finished and nothing is deleted here; retrying is safe. A provider that refuses the channel's keys, or whose account does not have the record (the channel's keys are another account's now), cannot be asked: its record stays there, the payer is forgotten here all the same, and the answer names the record (`provider_records_kept`). What the payer paid stays in the books: its payments no longer name it, and the entries of the append-only wallet ledger keep the id they were written under — name payers by an id of your own, not by a name or an email. Refused with `customer_has_subscriptions` while a subscription of its is not ended, and `customer_has_wallet_balance` while a wallet of its holds, reserves or owes money.
5206
+ */
5207
+ deleteCustomer(input: {
5208
+ path: {
5209
+ customer_id: string;
5210
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5211
+ signal?: AbortSignal;
5212
+ }): Promise<Reply<200, DeleteCustomerResponse>>;
5213
+ /**
5214
+ * List a payer's saved payment methods
5215
+ *
5216
+ * Lists a payer's active saved cards: each channel's default first, then the newest. Once a billing portal session was opened for the payer, the list follows what the provider has — a card removed on the provider's page is listed no more, one added there is — read from the provider on each listing for a day after. The provider is waited for a few seconds at most: slower, the list is answered as it is kept. A payer whose record was deleted on the provider's pages has no card there: the record is let go of here, and its cards are listed no more.
5217
+ */
5218
+ listCustomerMethods(input: {
5219
+ path: {
5220
+ customer_id: string;
5221
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5222
+ signal?: AbortSignal;
5223
+ }): Promise<Reply<200, SavedMethodListResponse>>;
5224
+ /**
5225
+ * Add a saved payment method for a payer
5226
+ *
5227
+ * Opens the provider's own page that saves a card for the payer, nothing charged, and returns it as a NextAction to send whoever holds the card to. The card is listed once the provider tells it saved. A channel whose provider keeps no card for the project (iyzico) answers `setup_only_unsupported` before the provider is asked anything. When this call makes the payer's record at the provider and the provider refuses a part of the payer's profile, it answers `tax_id_invalid` or `billing_address_invalid` and opens no page: write the profile again, then call again. Opened by an environment's token, the page saves a card no later than the token ends. An email or phone the provider finds malformed is left off the record and told the same way (`invalid_request`). A profile the provider refuses for another reason of its own is told the same way, on every call, until the profile is written again as the provider takes it; the payer's payments go on meanwhile. `409 provider_customer_gone` when the payer's record was deleted on the provider's own pages: it is let go of here, and calling again makes a new one. `503 provider_unavailable` when the provider could not be asked to write the payer's profile on a record it just made: the record is kept, and calling again writes it.
5228
+ */
5229
+ addCustomerMethod(input: {
5230
+ path: {
5231
+ customer_id: string;
5232
+ };
5233
+ body: AddCustomerMethodRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5234
+ signal?: AbortSignal;
5235
+ }): Promise<Reply<201, NextActionResponse>>;
5236
+ /**
5237
+ * Delete a payer's saved payment method
5238
+ *
5239
+ * Takes the card off the provider's vault and marks it revoked. When it was the default, the oldest card left on its channel becomes the default. `503 provider_unavailable` when the provider cannot be reached to remove it: the card is kept, and asking again is safe.
5240
+ */
5241
+ deleteCustomerMethod(input: {
5242
+ path: {
5243
+ customer_id: string; /** Saved payment method UUID. */
5244
+ method_id: string;
5245
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5246
+ signal?: AbortSignal;
5247
+ }): Promise<Reply<204, undefined>>;
5248
+ /**
5249
+ * Make a payer's saved payment method the default
5250
+ *
5251
+ * Makes the card the payer's default on its channel, and returns the payer's cards.
5252
+ */
5253
+ setCustomerDefaultMethod(input: {
5254
+ path: {
5255
+ customer_id: string; /** Saved payment method UUID. */
5256
+ method_id: string;
5257
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5258
+ signal?: AbortSignal;
5259
+ }): Promise<Reply<200, SavedMethodListResponse>>;
5260
+ /**
5261
+ * Create a payer's billing portal session
5262
+ *
5263
+ * Opens a provider-hosted self-service billing portal session for the payer: whoever holds its link manages the payer's cards and subscriptions at the provider. The cards the payer changes there are followed (ListCustomerMethods); the default card stays the one chosen here. Closed to an environment's token. `409 provider_customer_gone` when the payer's record was deleted on the provider's own pages: it is let go of here, and a card page or payment makes a new one.
5264
+ */
5265
+ createCustomerPortal(input: {
5266
+ path: {
5267
+ customer_id: string;
5268
+ };
5269
+ body: PortalRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
5270
+ signal?: AbortSignal;
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>>;
4203
5355
  };
4204
5356
  export type Client = ReturnType<typeof client>;