paid-python 1.0.0a0__py3-none-any.whl → 1.0.0a2__py3-none-any.whl

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 (137) hide show
  1. paid/__init__.py +61 -122
  2. paid/client.py +16 -22
  3. paid/contacts/client.py +417 -133
  4. paid/contacts/raw_client.py +1048 -118
  5. paid/core/client_wrapper.py +8 -10
  6. paid/customers/__init__.py +0 -3
  7. paid/customers/client.py +394 -1112
  8. paid/customers/raw_client.py +656 -1054
  9. paid/environment.py +1 -1
  10. paid/errors/bad_request_error.py +2 -2
  11. paid/errors/forbidden_error.py +2 -2
  12. paid/errors/internal_server_error.py +2 -2
  13. paid/errors/not_found_error.py +2 -2
  14. paid/invoices/client.py +369 -0
  15. paid/{plans → invoices}/raw_client.py +312 -201
  16. paid/orders/__init__.py +0 -3
  17. paid/orders/client.py +281 -471
  18. paid/orders/raw_client.py +552 -537
  19. paid/products/__init__.py +0 -3
  20. paid/products/client.py +129 -265
  21. paid/products/raw_client.py +565 -233
  22. paid/signals/client.py +130 -0
  23. paid/signals/raw_client.py +190 -0
  24. paid/tracing/autoinstrumentation.py +12 -6
  25. paid/tracing/context_manager.py +2 -6
  26. paid/tracing/distributed_tracing.py +3 -3
  27. paid/tracing/signal.py +3 -3
  28. paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
  29. paid/types/__init__.py +58 -110
  30. paid/types/attribution.py +8 -0
  31. paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
  32. paid/types/contact.py +12 -20
  33. paid/types/{address.py → contact_billing_address.py} +6 -7
  34. paid/types/{traces_response.py → contact_list_response.py} +5 -9
  35. paid/types/customer.py +15 -22
  36. paid/types/customer_attribution.py +8 -0
  37. paid/types/customer_billing_address.py +26 -0
  38. paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
  39. paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
  40. paid/types/customer_creation_state.py +5 -0
  41. paid/types/customer_list_response.py +22 -0
  42. paid/types/empty_response.py +17 -0
  43. paid/types/{error.py → error_response.py} +4 -7
  44. paid/types/invoice.py +33 -51
  45. paid/types/invoice_line.py +42 -0
  46. paid/types/invoice_line_payment_status.py +7 -0
  47. paid/types/invoice_lines_response.py +22 -0
  48. paid/types/invoice_list_response.py +22 -0
  49. paid/types/invoice_payment_status.py +5 -0
  50. paid/types/invoice_source.py +5 -0
  51. paid/types/invoice_status.py +3 -1
  52. paid/types/invoice_tax_status.py +7 -0
  53. paid/types/order.py +30 -29
  54. paid/types/order_creation_state.py +5 -0
  55. paid/types/order_line.py +6 -24
  56. paid/types/order_lines_response.py +22 -0
  57. paid/types/order_list_response.py +22 -0
  58. paid/types/pagination.py +24 -0
  59. paid/types/product.py +4 -29
  60. paid/types/{tier.py → product_by_external_id.py} +5 -4
  61. paid/types/{cost_amount.py → product_by_id.py} +5 -12
  62. paid/types/product_list_response.py +22 -0
  63. paid/types/signal.py +8 -34
  64. paid/types/{agent_update.py → update_contact_request.py} +10 -9
  65. paid/types/update_customer_request.py +38 -0
  66. paid/types/{product_update.py → update_product_request.py} +2 -12
  67. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/METADATA +23 -8
  68. paid_python-1.0.0a2.dist-info/RECORD +110 -0
  69. paid/agents/client.py +0 -880
  70. paid/agents/raw_client.py +0 -785
  71. paid/customers/types/__init__.py +0 -8
  72. paid/customers/types/customers_check_entitlement_request_view.py +0 -5
  73. paid/customers/types/customers_check_entitlement_response.py +0 -22
  74. paid/orders/lines/client.py +0 -144
  75. paid/orders/lines/raw_client.py +0 -129
  76. paid/plans/__init__.py +0 -4
  77. paid/plans/client.py +0 -403
  78. paid/products/types/__init__.py +0 -7
  79. paid/products/types/product_create_type.py +0 -5
  80. paid/traces/__init__.py +0 -4
  81. paid/traces/client.py +0 -218
  82. paid/traces/raw_client.py +0 -226
  83. paid/types/agent.py +0 -31
  84. paid/types/agent_price_point.py +0 -27
  85. paid/types/agent_price_point_tiers.py +0 -23
  86. paid/types/api_error.py +0 -29
  87. paid/types/billing_frequency.py +0 -5
  88. paid/types/cancel_renewal_response.py +0 -49
  89. paid/types/charge_type.py +0 -5
  90. paid/types/contact_create_for_customer.py +0 -37
  91. paid/types/cost_trace.py +0 -55
  92. paid/types/cost_traces_response.py +0 -26
  93. paid/types/creation_source.py +0 -5
  94. paid/types/creation_state.py +0 -5
  95. paid/types/customer_update.py +0 -40
  96. paid/types/entitlement_usage.py +0 -48
  97. paid/types/order_line_attribute.py +0 -27
  98. paid/types/order_line_attribute_create_one.py +0 -5
  99. paid/types/order_line_attribute_pricing.py +0 -33
  100. paid/types/order_line_create.py +0 -72
  101. paid/types/pagination_meta.py +0 -84
  102. paid/types/payment_method.py +0 -58
  103. paid/types/payment_method_card.py +0 -49
  104. paid/types/payment_method_type.py +0 -5
  105. paid/types/payment_method_us_bank_account.py +0 -36
  106. paid/types/payment_method_us_bank_account_account_type.py +0 -5
  107. paid/types/plan.py +0 -81
  108. paid/types/plan_group.py +0 -60
  109. paid/types/plan_plan_products_item.py +0 -41
  110. paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
  111. paid/types/plan_with_features.py +0 -69
  112. paid/types/plan_with_features_features_item.py +0 -34
  113. paid/types/price_point.py +0 -25
  114. paid/types/pricing.py +0 -31
  115. paid/types/pricing_model_type.py +0 -7
  116. paid/types/product_type.py +0 -5
  117. paid/types/product_update_type.py +0 -5
  118. paid/types/proration_attribute_update.py +0 -44
  119. paid/types/proration_detail.py +0 -49
  120. paid/types/proration_upgrade_response.py +0 -73
  121. paid/types/salutation.py +0 -5
  122. paid/types/signal_v_2.py +0 -56
  123. paid/types/tax_exempt_status.py +0 -5
  124. paid/types/trace.py +0 -69
  125. paid/types/usage_pagination_meta.py +0 -43
  126. paid/types/usage_summaries_response.py +0 -26
  127. paid/types/usage_summary.py +0 -121
  128. paid/usage/__init__.py +0 -7
  129. paid/usage/client.py +0 -321
  130. paid/usage/raw_client.py +0 -387
  131. paid/usage/types/__init__.py +0 -7
  132. paid/usage/types/usage_check_usage_response.py +0 -53
  133. paid_python-1.0.0a0.dist-info/RECORD +0 -152
  134. /paid/{agents → invoices}/__init__.py +0 -0
  135. /paid/{orders/lines → signals}/__init__.py +0 -0
  136. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/LICENSE +0 -0
  137. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/WHEEL +0 -0
paid/customers/client.py CHANGED
@@ -5,18 +5,12 @@ import typing
5
5
 
6
6
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
7
  from ..core.request_options import RequestOptions
8
- from ..types.address import Address
9
- from ..types.contact_create_for_customer import ContactCreateForCustomer
10
- from ..types.cost_traces_response import CostTracesResponse
11
- from ..types.creation_source import CreationSource
12
8
  from ..types.customer import Customer
13
- from ..types.entitlement_usage import EntitlementUsage
14
- from ..types.payment_method import PaymentMethod
15
- from ..types.tax_exempt_status import TaxExemptStatus
16
- from ..types.usage_summaries_response import UsageSummariesResponse
9
+ from ..types.customer_billing_address import CustomerBillingAddress
10
+ from ..types.customer_creation_state import CustomerCreationState
11
+ from ..types.customer_list_response import CustomerListResponse
12
+ from ..types.empty_response import EmptyResponse
17
13
  from .raw_client import AsyncRawCustomersClient, RawCustomersClient
18
- from .types.customers_check_entitlement_request_view import CustomersCheckEntitlementRequestView
19
- from .types.customers_check_entitlement_response import CustomersCheckEntitlementResponse
20
14
 
21
15
  # this is used as the default value for optional parameters
22
16
  OMIT = typing.cast(typing.Any, ...)
@@ -37,717 +31,29 @@ class CustomersClient:
37
31
  """
38
32
  return self._raw_client
39
33
 
40
- def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Customer]:
41
- """
42
- Parameters
43
- ----------
44
- request_options : typing.Optional[RequestOptions]
45
- Request-specific configuration.
46
-
47
- Returns
48
- -------
49
- typing.List[Customer]
50
- Success response
51
-
52
- Examples
53
- --------
54
- from paid import Paid
55
-
56
- client = Paid(
57
- token="YOUR_TOKEN",
58
- )
59
- client.customers.list()
60
- """
61
- _response = self._raw_client.list(request_options=request_options)
62
- return _response.data
63
-
64
- def create(
65
- self,
66
- *,
67
- name: str,
68
- external_id: typing.Optional[str] = OMIT,
69
- phone: typing.Optional[str] = OMIT,
70
- employee_count: typing.Optional[float] = OMIT,
71
- annual_revenue: typing.Optional[float] = OMIT,
72
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
73
- creation_source: typing.Optional[CreationSource] = OMIT,
74
- website: typing.Optional[str] = OMIT,
75
- billing_address: typing.Optional[Address] = OMIT,
76
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
77
- contacts: typing.Optional[typing.Sequence[ContactCreateForCustomer]] = OMIT,
78
- request_options: typing.Optional[RequestOptions] = None,
79
- ) -> Customer:
80
- """
81
- Parameters
82
- ----------
83
- name : str
84
-
85
- external_id : typing.Optional[str]
86
-
87
- phone : typing.Optional[str]
88
-
89
- employee_count : typing.Optional[float]
90
-
91
- annual_revenue : typing.Optional[float]
92
-
93
- tax_exempt_status : typing.Optional[TaxExemptStatus]
94
-
95
- creation_source : typing.Optional[CreationSource]
96
-
97
- website : typing.Optional[str]
98
-
99
- billing_address : typing.Optional[Address]
100
-
101
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
102
- Flexible JSON field for storing custom metadata about the customer
103
-
104
- contacts : typing.Optional[typing.Sequence[ContactCreateForCustomer]]
105
- Array of contacts to create for this customer
106
-
107
- request_options : typing.Optional[RequestOptions]
108
- Request-specific configuration.
109
-
110
- Returns
111
- -------
112
- Customer
113
- Success response - customer already exists with this externalId
114
-
115
- Examples
116
- --------
117
- from paid import ContactCreateForCustomer, Paid
118
-
119
- client = Paid(
120
- token="YOUR_TOKEN",
121
- )
122
- client.customers.create(
123
- name="Acme, Inc.",
124
- external_id="acme-inc",
125
- contacts=[
126
- ContactCreateForCustomer(
127
- salutation="Mr.",
128
- first_name="John",
129
- last_name="Doe",
130
- account_name="Acme, Inc.",
131
- email="john.doe@acme.com",
132
- phone="+1-555-0100",
133
- billing_street="123 Main Street",
134
- billing_city="San Francisco",
135
- billing_state_province="CA",
136
- billing_country="USA",
137
- billing_postal_code="94102",
138
- )
139
- ],
140
- )
141
- """
142
- _response = self._raw_client.create(
143
- name=name,
144
- external_id=external_id,
145
- phone=phone,
146
- employee_count=employee_count,
147
- annual_revenue=annual_revenue,
148
- tax_exempt_status=tax_exempt_status,
149
- creation_source=creation_source,
150
- website=website,
151
- billing_address=billing_address,
152
- metadata=metadata,
153
- contacts=contacts,
154
- request_options=request_options,
155
- )
156
- return _response.data
157
-
158
- def get(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
159
- """
160
- Parameters
161
- ----------
162
- customer_id : str
163
-
164
- request_options : typing.Optional[RequestOptions]
165
- Request-specific configuration.
166
-
167
- Returns
168
- -------
169
- Customer
170
- Success response
171
-
172
- Examples
173
- --------
174
- from paid import Paid
175
-
176
- client = Paid(
177
- token="YOUR_TOKEN",
178
- )
179
- client.customers.get(
180
- customer_id="customerId",
181
- )
182
- """
183
- _response = self._raw_client.get(customer_id, request_options=request_options)
184
- return _response.data
185
-
186
- def update(
187
- self,
188
- customer_id: str,
189
- *,
190
- name: typing.Optional[str] = OMIT,
191
- external_id: typing.Optional[str] = OMIT,
192
- phone: typing.Optional[str] = OMIT,
193
- employee_count: typing.Optional[float] = OMIT,
194
- annual_revenue: typing.Optional[float] = OMIT,
195
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
196
- creation_source: typing.Optional[CreationSource] = OMIT,
197
- website: typing.Optional[str] = OMIT,
198
- billing_address: typing.Optional[Address] = OMIT,
199
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
200
- request_options: typing.Optional[RequestOptions] = None,
201
- ) -> Customer:
202
- """
203
- Parameters
204
- ----------
205
- customer_id : str
206
-
207
- name : typing.Optional[str]
208
-
209
- external_id : typing.Optional[str]
210
-
211
- phone : typing.Optional[str]
212
-
213
- employee_count : typing.Optional[float]
214
-
215
- annual_revenue : typing.Optional[float]
216
-
217
- tax_exempt_status : typing.Optional[TaxExemptStatus]
218
-
219
- creation_source : typing.Optional[CreationSource]
220
-
221
- website : typing.Optional[str]
222
-
223
- billing_address : typing.Optional[Address]
224
-
225
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
226
- Flexible JSON field for storing custom metadata about the customer
227
-
228
- request_options : typing.Optional[RequestOptions]
229
- Request-specific configuration.
230
-
231
- Returns
232
- -------
233
- Customer
234
- Customer updated successfully
235
-
236
- Examples
237
- --------
238
- from paid import Paid
239
-
240
- client = Paid(
241
- token="YOUR_TOKEN",
242
- )
243
- client.customers.update(
244
- customer_id="customerId",
245
- name="Acme, Inc. (Updated)",
246
- phone="123-456-7890",
247
- employee_count=101.0,
248
- annual_revenue=1000001.0,
249
- )
250
- """
251
- _response = self._raw_client.update(
252
- customer_id,
253
- name=name,
254
- external_id=external_id,
255
- phone=phone,
256
- employee_count=employee_count,
257
- annual_revenue=annual_revenue,
258
- tax_exempt_status=tax_exempt_status,
259
- creation_source=creation_source,
260
- website=website,
261
- billing_address=billing_address,
262
- metadata=metadata,
263
- request_options=request_options,
264
- )
265
- return _response.data
266
-
267
- def delete(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
268
- """
269
- Parameters
270
- ----------
271
- customer_id : str
272
-
273
- request_options : typing.Optional[RequestOptions]
274
- Request-specific configuration.
275
-
276
- Returns
277
- -------
278
- None
279
-
280
- Examples
281
- --------
282
- from paid import Paid
283
-
284
- client = Paid(
285
- token="YOUR_TOKEN",
286
- )
287
- client.customers.delete(
288
- customer_id="customerId",
289
- )
290
- """
291
- _response = self._raw_client.delete(customer_id, request_options=request_options)
292
- return _response.data
293
-
294
- def check_entitlement(
295
- self,
296
- customer_id: str,
297
- *,
298
- event_name: str,
299
- view: typing.Optional[CustomersCheckEntitlementRequestView] = None,
300
- request_options: typing.Optional[RequestOptions] = None,
301
- ) -> CustomersCheckEntitlementResponse:
302
- """
303
- Parameters
304
- ----------
305
- customer_id : str
306
- The customer ID
307
-
308
- event_name : str
309
- The name of the usage event to check entitlement for
310
-
311
- view : typing.Optional[CustomersCheckEntitlementRequestView]
312
- Filter view - 'all' returns all entitlements regardless of status, 'active_only' returns only currently active entitlements with available credits
313
-
314
- request_options : typing.Optional[RequestOptions]
315
- Request-specific configuration.
316
-
317
- Returns
318
- -------
319
- CustomersCheckEntitlementResponse
320
- Success response
321
-
322
- Examples
323
- --------
324
- from paid import Paid
325
-
326
- client = Paid(
327
- token="YOUR_TOKEN",
328
- )
329
- client.customers.check_entitlement(
330
- customer_id="customerId",
331
- event_name="event_name",
332
- view="all",
333
- )
334
- """
335
- _response = self._raw_client.check_entitlement(
336
- customer_id, event_name=event_name, view=view, request_options=request_options
337
- )
338
- return _response.data
339
-
340
- def get_entitlements(
341
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
342
- ) -> typing.List[EntitlementUsage]:
343
- """
344
- Parameters
345
- ----------
346
- customer_id : str
347
- The customer ID
348
-
349
- request_options : typing.Optional[RequestOptions]
350
- Request-specific configuration.
351
-
352
- Returns
353
- -------
354
- typing.List[EntitlementUsage]
355
- Success response
356
-
357
- Examples
358
- --------
359
- from paid import Paid
360
-
361
- client = Paid(
362
- token="YOUR_TOKEN",
363
- )
364
- client.customers.get_entitlements(
365
- customer_id="customerId",
366
- )
367
- """
368
- _response = self._raw_client.get_entitlements(customer_id, request_options=request_options)
369
- return _response.data
370
-
371
- def get_by_external_id(
372
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
373
- ) -> Customer:
374
- """
375
- Parameters
376
- ----------
377
- external_id : str
378
-
379
- request_options : typing.Optional[RequestOptions]
380
- Request-specific configuration.
381
-
382
- Returns
383
- -------
384
- Customer
385
- Success response
386
-
387
- Examples
388
- --------
389
- from paid import Paid
390
-
391
- client = Paid(
392
- token="YOUR_TOKEN",
393
- )
394
- client.customers.get_by_external_id(
395
- external_id="externalId",
396
- )
397
- """
398
- _response = self._raw_client.get_by_external_id(external_id, request_options=request_options)
399
- return _response.data
400
-
401
- def update_by_external_id(
402
- self,
403
- external_id_: str,
404
- *,
405
- name: typing.Optional[str] = OMIT,
406
- external_id: typing.Optional[str] = OMIT,
407
- phone: typing.Optional[str] = OMIT,
408
- employee_count: typing.Optional[float] = OMIT,
409
- annual_revenue: typing.Optional[float] = OMIT,
410
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
411
- creation_source: typing.Optional[CreationSource] = OMIT,
412
- website: typing.Optional[str] = OMIT,
413
- billing_address: typing.Optional[Address] = OMIT,
414
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
415
- request_options: typing.Optional[RequestOptions] = None,
416
- ) -> Customer:
417
- """
418
- Parameters
419
- ----------
420
- external_id_ : str
421
-
422
- name : typing.Optional[str]
423
-
424
- external_id : typing.Optional[str]
425
-
426
- phone : typing.Optional[str]
427
-
428
- employee_count : typing.Optional[float]
429
-
430
- annual_revenue : typing.Optional[float]
431
-
432
- tax_exempt_status : typing.Optional[TaxExemptStatus]
433
-
434
- creation_source : typing.Optional[CreationSource]
435
-
436
- website : typing.Optional[str]
437
-
438
- billing_address : typing.Optional[Address]
439
-
440
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
441
- Flexible JSON field for storing custom metadata about the customer
442
-
443
- request_options : typing.Optional[RequestOptions]
444
- Request-specific configuration.
445
-
446
- Returns
447
- -------
448
- Customer
449
- Success response
450
-
451
- Examples
452
- --------
453
- from paid import Paid
454
-
455
- client = Paid(
456
- token="YOUR_TOKEN",
457
- )
458
- client.customers.update_by_external_id(
459
- external_id_="externalId",
460
- )
461
- """
462
- _response = self._raw_client.update_by_external_id(
463
- external_id_,
464
- name=name,
465
- external_id=external_id,
466
- phone=phone,
467
- employee_count=employee_count,
468
- annual_revenue=annual_revenue,
469
- tax_exempt_status=tax_exempt_status,
470
- creation_source=creation_source,
471
- website=website,
472
- billing_address=billing_address,
473
- metadata=metadata,
474
- request_options=request_options,
475
- )
476
- return _response.data
477
-
478
- def delete_by_external_id(
479
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
480
- ) -> None:
481
- """
482
- Parameters
483
- ----------
484
- external_id : str
485
-
486
- request_options : typing.Optional[RequestOptions]
487
- Request-specific configuration.
488
-
489
- Returns
490
- -------
491
- None
492
-
493
- Examples
494
- --------
495
- from paid import Paid
496
-
497
- client = Paid(
498
- token="YOUR_TOKEN",
499
- )
500
- client.customers.delete_by_external_id(
501
- external_id="externalId",
502
- )
503
- """
504
- _response = self._raw_client.delete_by_external_id(external_id, request_options=request_options)
505
- return _response.data
506
-
507
- def get_costs_by_external_id(
34
+ def list_customers(
508
35
  self,
509
- external_id: str,
510
36
  *,
511
37
  limit: typing.Optional[int] = None,
512
38
  offset: typing.Optional[int] = None,
513
- start_time: typing.Optional[dt.datetime] = None,
514
- end_time: typing.Optional[dt.datetime] = None,
515
39
  request_options: typing.Optional[RequestOptions] = None,
516
- ) -> CostTracesResponse:
517
- """
518
- Parameters
519
- ----------
520
- external_id : str
521
- The external ID of the customer
522
-
523
- limit : typing.Optional[int]
524
- Maximum number of traces to return (1-1000)
525
-
526
- offset : typing.Optional[int]
527
- Number of traces to skip for pagination
528
-
529
- start_time : typing.Optional[dt.datetime]
530
- Filter traces starting from this time (ISO 8601 format)
531
-
532
- end_time : typing.Optional[dt.datetime]
533
- Filter traces up to this time (ISO 8601 format)
534
-
535
- request_options : typing.Optional[RequestOptions]
536
- Request-specific configuration.
537
-
538
- Returns
539
- -------
540
- CostTracesResponse
541
- Success response
542
-
543
- Examples
544
- --------
545
- import datetime
546
-
547
- from paid import Paid
548
-
549
- client = Paid(
550
- token="YOUR_TOKEN",
551
- )
552
- client.customers.get_costs_by_external_id(
553
- external_id="externalId",
554
- limit=1,
555
- offset=1,
556
- start_time=datetime.datetime.fromisoformat(
557
- "2024-01-15 09:30:00+00:00",
558
- ),
559
- end_time=datetime.datetime.fromisoformat(
560
- "2024-01-15 09:30:00+00:00",
561
- ),
562
- )
40
+ ) -> CustomerListResponse:
563
41
  """
564
- _response = self._raw_client.get_costs_by_external_id(
565
- external_id,
566
- limit=limit,
567
- offset=offset,
568
- start_time=start_time,
569
- end_time=end_time,
570
- request_options=request_options,
571
- )
572
- return _response.data
42
+ Get a list of customers for the organization
573
43
 
574
- def get_usage_by_external_id(
575
- self,
576
- external_id: str,
577
- *,
578
- limit: typing.Optional[int] = None,
579
- offset: typing.Optional[int] = None,
580
- start_time: typing.Optional[dt.datetime] = None,
581
- end_time: typing.Optional[dt.datetime] = None,
582
- request_options: typing.Optional[RequestOptions] = None,
583
- ) -> UsageSummariesResponse:
584
- """
585
44
  Parameters
586
45
  ----------
587
- external_id : str
588
- The external ID of the customer
589
-
590
46
  limit : typing.Optional[int]
591
- Maximum number of usage summaries to return (1-1000)
592
47
 
593
48
  offset : typing.Optional[int]
594
- Number of usage summaries to skip for pagination
595
-
596
- start_time : typing.Optional[dt.datetime]
597
- Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
598
-
599
- end_time : typing.Optional[dt.datetime]
600
- Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
601
-
602
- request_options : typing.Optional[RequestOptions]
603
- Request-specific configuration.
604
-
605
- Returns
606
- -------
607
- UsageSummariesResponse
608
- Success response
609
-
610
- Examples
611
- --------
612
- import datetime
613
-
614
- from paid import Paid
615
-
616
- client = Paid(
617
- token="YOUR_TOKEN",
618
- )
619
- client.customers.get_usage_by_external_id(
620
- external_id="externalId",
621
- limit=1,
622
- offset=1,
623
- start_time=datetime.datetime.fromisoformat(
624
- "2024-01-15 09:30:00+00:00",
625
- ),
626
- end_time=datetime.datetime.fromisoformat(
627
- "2024-01-15 09:30:00+00:00",
628
- ),
629
- )
630
- """
631
- _response = self._raw_client.get_usage_by_external_id(
632
- external_id,
633
- limit=limit,
634
- offset=offset,
635
- start_time=start_time,
636
- end_time=end_time,
637
- request_options=request_options,
638
- )
639
- return _response.data
640
-
641
- def list_payment_methods(
642
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
643
- ) -> typing.List[PaymentMethod]:
644
- """
645
- Retrieves all payment methods associated with a customer identified by their external ID.
646
-
647
- Parameters
648
- ----------
649
- external_id : str
650
- The external ID of the customer
651
-
652
- request_options : typing.Optional[RequestOptions]
653
- Request-specific configuration.
654
-
655
- Returns
656
- -------
657
- typing.List[PaymentMethod]
658
- Success response
659
-
660
- Examples
661
- --------
662
- from paid import Paid
663
-
664
- client = Paid(
665
- token="YOUR_TOKEN",
666
- )
667
- client.customers.list_payment_methods(
668
- external_id="externalId",
669
- )
670
- """
671
- _response = self._raw_client.list_payment_methods(external_id, request_options=request_options)
672
- return _response.data
673
-
674
- def create_payment_method(
675
- self,
676
- external_id: str,
677
- *,
678
- confirmation_token: str,
679
- return_url: str,
680
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
681
- request_options: typing.Optional[RequestOptions] = None,
682
- ) -> PaymentMethod:
683
- """
684
- Creates a new payment method for a customer using a Stripe confirmation token.
685
-
686
- Parameters
687
- ----------
688
- external_id : str
689
- The external ID of the customer
690
-
691
- confirmation_token : str
692
- Stripe confirmation token for the payment method
693
-
694
- return_url : str
695
- URL to redirect to after payment method setup
696
-
697
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
698
- Optional metadata to attach to the payment method
699
-
700
- request_options : typing.Optional[RequestOptions]
701
- Request-specific configuration.
702
-
703
- Returns
704
- -------
705
- PaymentMethod
706
- Payment method created successfully
707
-
708
- Examples
709
- --------
710
- from paid import Paid
711
-
712
- client = Paid(
713
- token="YOUR_TOKEN",
714
- )
715
- client.customers.create_payment_method(
716
- external_id="externalId",
717
- confirmation_token="ctoken_1234567890",
718
- return_url="https://example.com/payment-method-added",
719
- metadata={"source": "api"},
720
- )
721
- """
722
- _response = self._raw_client.create_payment_method(
723
- external_id,
724
- confirmation_token=confirmation_token,
725
- return_url=return_url,
726
- metadata=metadata,
727
- request_options=request_options,
728
- )
729
- return _response.data
730
-
731
- def delete_payment_method(
732
- self, external_id: str, payment_method_id: str, *, request_options: typing.Optional[RequestOptions] = None
733
- ) -> None:
734
- """
735
- Deletes a specific payment method from a customer's account.
736
-
737
- Parameters
738
- ----------
739
- external_id : str
740
- The external ID of the customer
741
-
742
- payment_method_id : str
743
- The ID of the payment method to delete
744
49
 
745
50
  request_options : typing.Optional[RequestOptions]
746
51
  Request-specific configuration.
747
52
 
748
53
  Returns
749
54
  -------
750
- None
55
+ CustomerListResponse
56
+ 200
751
57
 
752
58
  Examples
753
59
  --------
@@ -756,106 +62,50 @@ class CustomersClient:
756
62
  client = Paid(
757
63
  token="YOUR_TOKEN",
758
64
  )
759
- client.customers.delete_payment_method(
760
- external_id="externalId",
761
- payment_method_id="paymentMethodId",
762
- )
763
- """
764
- _response = self._raw_client.delete_payment_method(
765
- external_id, payment_method_id, request_options=request_options
766
- )
767
- return _response.data
768
-
769
-
770
- class AsyncCustomersClient:
771
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
772
- self._raw_client = AsyncRawCustomersClient(client_wrapper=client_wrapper)
773
-
774
- @property
775
- def with_raw_response(self) -> AsyncRawCustomersClient:
776
- """
777
- Retrieves a raw implementation of this client that returns raw responses.
778
-
779
- Returns
780
- -------
781
- AsyncRawCustomersClient
782
- """
783
- return self._raw_client
784
-
785
- async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Customer]:
786
- """
787
- Parameters
788
- ----------
789
- request_options : typing.Optional[RequestOptions]
790
- Request-specific configuration.
791
-
792
- Returns
793
- -------
794
- typing.List[Customer]
795
- Success response
796
-
797
- Examples
798
- --------
799
- import asyncio
800
-
801
- from paid import AsyncPaid
802
-
803
- client = AsyncPaid(
804
- token="YOUR_TOKEN",
805
- )
806
-
807
-
808
- async def main() -> None:
809
- await client.customers.list()
810
-
811
-
812
- asyncio.run(main())
65
+ client.customers.list_customers()
813
66
  """
814
- _response = await self._raw_client.list(request_options=request_options)
67
+ _response = self._raw_client.list_customers(limit=limit, offset=offset, request_options=request_options)
815
68
  return _response.data
816
69
 
817
- async def create(
70
+ def create_customer(
818
71
  self,
819
72
  *,
820
73
  name: str,
821
- external_id: typing.Optional[str] = OMIT,
74
+ legal_name: typing.Optional[str] = OMIT,
75
+ email: typing.Optional[str] = OMIT,
822
76
  phone: typing.Optional[str] = OMIT,
823
- employee_count: typing.Optional[float] = OMIT,
824
- annual_revenue: typing.Optional[float] = OMIT,
825
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
826
- creation_source: typing.Optional[CreationSource] = OMIT,
827
77
  website: typing.Optional[str] = OMIT,
828
- billing_address: typing.Optional[Address] = OMIT,
78
+ external_id: typing.Optional[str] = OMIT,
79
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
80
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
81
+ vat_number: typing.Optional[str] = OMIT,
829
82
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
830
- contacts: typing.Optional[typing.Sequence[ContactCreateForCustomer]] = OMIT,
831
83
  request_options: typing.Optional[RequestOptions] = None,
832
84
  ) -> Customer:
833
85
  """
86
+ Creates a new customer for the organization
87
+
834
88
  Parameters
835
89
  ----------
836
90
  name : str
837
91
 
838
- external_id : typing.Optional[str]
92
+ legal_name : typing.Optional[str]
839
93
 
840
- phone : typing.Optional[str]
94
+ email : typing.Optional[str]
841
95
 
842
- employee_count : typing.Optional[float]
96
+ phone : typing.Optional[str]
843
97
 
844
- annual_revenue : typing.Optional[float]
98
+ website : typing.Optional[str]
845
99
 
846
- tax_exempt_status : typing.Optional[TaxExemptStatus]
100
+ external_id : typing.Optional[str]
847
101
 
848
- creation_source : typing.Optional[CreationSource]
102
+ billing_address : typing.Optional[CustomerBillingAddress]
849
103
 
850
- website : typing.Optional[str]
104
+ creation_state : typing.Optional[CustomerCreationState]
851
105
 
852
- billing_address : typing.Optional[Address]
106
+ vat_number : typing.Optional[str]
853
107
 
854
108
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
855
- Flexible JSON field for storing custom metadata about the customer
856
-
857
- contacts : typing.Optional[typing.Sequence[ContactCreateForCustomer]]
858
- Array of contacts to create for this customer
859
109
 
860
110
  request_options : typing.Optional[RequestOptions]
861
111
  Request-specific configuration.
@@ -863,64 +113,41 @@ class AsyncCustomersClient:
863
113
  Returns
864
114
  -------
865
115
  Customer
866
- Success response - customer already exists with this externalId
116
+ 201
867
117
 
868
118
  Examples
869
119
  --------
870
- import asyncio
871
-
872
- from paid import AsyncPaid, ContactCreateForCustomer
120
+ from paid import Paid
873
121
 
874
- client = AsyncPaid(
122
+ client = Paid(
875
123
  token="YOUR_TOKEN",
876
124
  )
877
-
878
-
879
- async def main() -> None:
880
- await client.customers.create(
881
- name="Acme, Inc.",
882
- external_id="acme-inc",
883
- contacts=[
884
- ContactCreateForCustomer(
885
- salutation="Mr.",
886
- first_name="John",
887
- last_name="Doe",
888
- account_name="Acme, Inc.",
889
- email="john.doe@acme.com",
890
- phone="+1-555-0100",
891
- billing_street="123 Main Street",
892
- billing_city="San Francisco",
893
- billing_state_province="CA",
894
- billing_country="USA",
895
- billing_postal_code="94102",
896
- )
897
- ],
898
- )
899
-
900
-
901
- asyncio.run(main())
125
+ client.customers.create_customer(
126
+ name="name",
127
+ )
902
128
  """
903
- _response = await self._raw_client.create(
129
+ _response = self._raw_client.create_customer(
904
130
  name=name,
905
- external_id=external_id,
131
+ legal_name=legal_name,
132
+ email=email,
906
133
  phone=phone,
907
- employee_count=employee_count,
908
- annual_revenue=annual_revenue,
909
- tax_exempt_status=tax_exempt_status,
910
- creation_source=creation_source,
911
134
  website=website,
135
+ external_id=external_id,
912
136
  billing_address=billing_address,
137
+ creation_state=creation_state,
138
+ vat_number=vat_number,
913
139
  metadata=metadata,
914
- contacts=contacts,
915
140
  request_options=request_options,
916
141
  )
917
142
  return _response.data
918
143
 
919
- async def get(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
144
+ def get_customer_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
920
145
  """
146
+ Get a customer by ID
147
+
921
148
  Parameters
922
149
  ----------
923
- customer_id : str
150
+ id : str
924
151
 
925
152
  request_options : typing.Optional[RequestOptions]
926
153
  Request-specific configuration.
@@ -928,71 +155,67 @@ class AsyncCustomersClient:
928
155
  Returns
929
156
  -------
930
157
  Customer
931
- Success response
158
+ 200
932
159
 
933
160
  Examples
934
161
  --------
935
- import asyncio
936
-
937
- from paid import AsyncPaid
938
-
939
- client = AsyncPaid(
940
- token="YOUR_TOKEN",
941
- )
942
-
943
-
944
- async def main() -> None:
945
- await client.customers.get(
946
- customer_id="customerId",
947
- )
948
-
162
+ from paid import Paid
949
163
 
950
- asyncio.run(main())
164
+ client = Paid(
165
+ token="YOUR_TOKEN",
166
+ )
167
+ client.customers.get_customer_by_id(
168
+ id="id",
169
+ )
951
170
  """
952
- _response = await self._raw_client.get(customer_id, request_options=request_options)
171
+ _response = self._raw_client.get_customer_by_id(id, request_options=request_options)
953
172
  return _response.data
954
173
 
955
- async def update(
174
+ def update_customer_by_id(
956
175
  self,
957
- customer_id: str,
176
+ id: str,
958
177
  *,
959
178
  name: typing.Optional[str] = OMIT,
960
- external_id: typing.Optional[str] = OMIT,
179
+ legal_name: typing.Optional[str] = OMIT,
180
+ email: typing.Optional[str] = OMIT,
961
181
  phone: typing.Optional[str] = OMIT,
962
- employee_count: typing.Optional[float] = OMIT,
963
- annual_revenue: typing.Optional[float] = OMIT,
964
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
965
- creation_source: typing.Optional[CreationSource] = OMIT,
966
182
  website: typing.Optional[str] = OMIT,
967
- billing_address: typing.Optional[Address] = OMIT,
183
+ external_id: typing.Optional[str] = OMIT,
184
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
185
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
186
+ churn_date: typing.Optional[dt.datetime] = OMIT,
187
+ vat_number: typing.Optional[str] = OMIT,
968
188
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
969
189
  request_options: typing.Optional[RequestOptions] = None,
970
190
  ) -> Customer:
971
191
  """
192
+ Update a customer by ID
193
+
972
194
  Parameters
973
195
  ----------
974
- customer_id : str
196
+ id : str
975
197
 
976
198
  name : typing.Optional[str]
977
199
 
978
- external_id : typing.Optional[str]
200
+ legal_name : typing.Optional[str]
201
+
202
+ email : typing.Optional[str]
979
203
 
980
204
  phone : typing.Optional[str]
981
205
 
982
- employee_count : typing.Optional[float]
206
+ website : typing.Optional[str]
983
207
 
984
- annual_revenue : typing.Optional[float]
208
+ external_id : typing.Optional[str]
985
209
 
986
- tax_exempt_status : typing.Optional[TaxExemptStatus]
210
+ billing_address : typing.Optional[CustomerBillingAddress]
987
211
 
988
- creation_source : typing.Optional[CreationSource]
212
+ creation_state : typing.Optional[CustomerCreationState]
989
213
 
990
- website : typing.Optional[str]
214
+ churn_date : typing.Optional[dt.datetime]
991
215
 
992
- billing_address : typing.Optional[Address]
216
+ vat_number : typing.Optional[str]
993
217
 
994
218
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
995
- Flexible JSON field for storing custom metadata about the customer
996
219
 
997
220
  request_options : typing.Optional[RequestOptions]
998
221
  Request-specific configuration.
@@ -1000,190 +223,253 @@ class AsyncCustomersClient:
1000
223
  Returns
1001
224
  -------
1002
225
  Customer
1003
- Customer updated successfully
226
+ 200
1004
227
 
1005
228
  Examples
1006
229
  --------
1007
- import asyncio
1008
-
1009
- from paid import AsyncPaid
230
+ from paid import Paid
1010
231
 
1011
- client = AsyncPaid(
232
+ client = Paid(
1012
233
  token="YOUR_TOKEN",
1013
234
  )
1014
-
1015
-
1016
- async def main() -> None:
1017
- await client.customers.update(
1018
- customer_id="customerId",
1019
- name="Acme, Inc. (Updated)",
1020
- phone="123-456-7890",
1021
- employee_count=101.0,
1022
- annual_revenue=1000001.0,
1023
- )
1024
-
1025
-
1026
- asyncio.run(main())
235
+ client.customers.update_customer_by_id(
236
+ id="id",
237
+ )
1027
238
  """
1028
- _response = await self._raw_client.update(
1029
- customer_id,
239
+ _response = self._raw_client.update_customer_by_id(
240
+ id,
1030
241
  name=name,
1031
- external_id=external_id,
242
+ legal_name=legal_name,
243
+ email=email,
1032
244
  phone=phone,
1033
- employee_count=employee_count,
1034
- annual_revenue=annual_revenue,
1035
- tax_exempt_status=tax_exempt_status,
1036
- creation_source=creation_source,
1037
245
  website=website,
246
+ external_id=external_id,
1038
247
  billing_address=billing_address,
248
+ creation_state=creation_state,
249
+ churn_date=churn_date,
250
+ vat_number=vat_number,
1039
251
  metadata=metadata,
1040
252
  request_options=request_options,
1041
253
  )
1042
254
  return _response.data
1043
255
 
1044
- async def delete(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
256
+ def delete_customer_by_id(
257
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
258
+ ) -> EmptyResponse:
1045
259
  """
260
+ Delete a customer by ID
261
+
1046
262
  Parameters
1047
263
  ----------
1048
- customer_id : str
264
+ id : str
1049
265
 
1050
266
  request_options : typing.Optional[RequestOptions]
1051
267
  Request-specific configuration.
1052
268
 
1053
269
  Returns
1054
270
  -------
1055
- None
271
+ EmptyResponse
272
+ 200
1056
273
 
1057
274
  Examples
1058
275
  --------
1059
- import asyncio
1060
-
1061
- from paid import AsyncPaid
276
+ from paid import Paid
1062
277
 
1063
- client = AsyncPaid(
278
+ client = Paid(
1064
279
  token="YOUR_TOKEN",
1065
280
  )
281
+ client.customers.delete_customer_by_id(
282
+ id="id",
283
+ )
284
+ """
285
+ _response = self._raw_client.delete_customer_by_id(id, request_options=request_options)
286
+ return _response.data
1066
287
 
288
+ def get_customer_by_external_id(
289
+ self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
290
+ ) -> Customer:
291
+ """
292
+ Get a customer by external ID
1067
293
 
1068
- async def main() -> None:
1069
- await client.customers.delete(
1070
- customer_id="customerId",
1071
- )
294
+ Parameters
295
+ ----------
296
+ external_id : str
1072
297
 
298
+ request_options : typing.Optional[RequestOptions]
299
+ Request-specific configuration.
1073
300
 
1074
- asyncio.run(main())
301
+ Returns
302
+ -------
303
+ Customer
304
+ 200
305
+
306
+ Examples
307
+ --------
308
+ from paid import Paid
309
+
310
+ client = Paid(
311
+ token="YOUR_TOKEN",
312
+ )
313
+ client.customers.get_customer_by_external_id(
314
+ external_id="externalId",
315
+ )
1075
316
  """
1076
- _response = await self._raw_client.delete(customer_id, request_options=request_options)
317
+ _response = self._raw_client.get_customer_by_external_id(external_id, request_options=request_options)
1077
318
  return _response.data
1078
319
 
1079
- async def check_entitlement(
320
+ def update_customer_by_external_id(
1080
321
  self,
1081
- customer_id: str,
322
+ external_id_: str,
1082
323
  *,
1083
- event_name: str,
1084
- view: typing.Optional[CustomersCheckEntitlementRequestView] = None,
324
+ name: typing.Optional[str] = OMIT,
325
+ legal_name: typing.Optional[str] = OMIT,
326
+ email: typing.Optional[str] = OMIT,
327
+ phone: typing.Optional[str] = OMIT,
328
+ website: typing.Optional[str] = OMIT,
329
+ external_id: typing.Optional[str] = OMIT,
330
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
331
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
332
+ churn_date: typing.Optional[dt.datetime] = OMIT,
333
+ vat_number: typing.Optional[str] = OMIT,
334
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1085
335
  request_options: typing.Optional[RequestOptions] = None,
1086
- ) -> CustomersCheckEntitlementResponse:
336
+ ) -> Customer:
1087
337
  """
338
+ Update a customer by external ID
339
+
1088
340
  Parameters
1089
341
  ----------
1090
- customer_id : str
1091
- The customer ID
342
+ external_id_ : str
343
+
344
+ name : typing.Optional[str]
345
+
346
+ legal_name : typing.Optional[str]
347
+
348
+ email : typing.Optional[str]
349
+
350
+ phone : typing.Optional[str]
351
+
352
+ website : typing.Optional[str]
353
+
354
+ external_id : typing.Optional[str]
1092
355
 
1093
- event_name : str
1094
- The name of the usage event to check entitlement for
356
+ billing_address : typing.Optional[CustomerBillingAddress]
1095
357
 
1096
- view : typing.Optional[CustomersCheckEntitlementRequestView]
1097
- Filter view - 'all' returns all entitlements regardless of status, 'active_only' returns only currently active entitlements with available credits
358
+ creation_state : typing.Optional[CustomerCreationState]
359
+
360
+ churn_date : typing.Optional[dt.datetime]
361
+
362
+ vat_number : typing.Optional[str]
363
+
364
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1098
365
 
1099
366
  request_options : typing.Optional[RequestOptions]
1100
367
  Request-specific configuration.
1101
368
 
1102
369
  Returns
1103
370
  -------
1104
- CustomersCheckEntitlementResponse
1105
- Success response
371
+ Customer
372
+ 200
1106
373
 
1107
374
  Examples
1108
375
  --------
1109
- import asyncio
1110
-
1111
- from paid import AsyncPaid
376
+ from paid import Paid
1112
377
 
1113
- client = AsyncPaid(
378
+ client = Paid(
1114
379
  token="YOUR_TOKEN",
1115
380
  )
1116
-
1117
-
1118
- async def main() -> None:
1119
- await client.customers.check_entitlement(
1120
- customer_id="customerId",
1121
- event_name="event_name",
1122
- view="all",
1123
- )
1124
-
1125
-
1126
- asyncio.run(main())
381
+ client.customers.update_customer_by_external_id(
382
+ external_id_="externalId",
383
+ )
1127
384
  """
1128
- _response = await self._raw_client.check_entitlement(
1129
- customer_id, event_name=event_name, view=view, request_options=request_options
385
+ _response = self._raw_client.update_customer_by_external_id(
386
+ external_id_,
387
+ name=name,
388
+ legal_name=legal_name,
389
+ email=email,
390
+ phone=phone,
391
+ website=website,
392
+ external_id=external_id,
393
+ billing_address=billing_address,
394
+ creation_state=creation_state,
395
+ churn_date=churn_date,
396
+ vat_number=vat_number,
397
+ metadata=metadata,
398
+ request_options=request_options,
1130
399
  )
1131
400
  return _response.data
1132
401
 
1133
- async def get_entitlements(
1134
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
1135
- ) -> typing.List[EntitlementUsage]:
402
+ def delete_customer_by_external_id(
403
+ self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
404
+ ) -> EmptyResponse:
1136
405
  """
406
+ Delete a customer by external ID
407
+
1137
408
  Parameters
1138
409
  ----------
1139
- customer_id : str
1140
- The customer ID
410
+ external_id : str
1141
411
 
1142
412
  request_options : typing.Optional[RequestOptions]
1143
413
  Request-specific configuration.
1144
414
 
1145
415
  Returns
1146
416
  -------
1147
- typing.List[EntitlementUsage]
1148
- Success response
417
+ EmptyResponse
418
+ 200
1149
419
 
1150
420
  Examples
1151
421
  --------
1152
- import asyncio
1153
-
1154
- from paid import AsyncPaid
422
+ from paid import Paid
1155
423
 
1156
- client = AsyncPaid(
424
+ client = Paid(
1157
425
  token="YOUR_TOKEN",
1158
426
  )
427
+ client.customers.delete_customer_by_external_id(
428
+ external_id="externalId",
429
+ )
430
+ """
431
+ _response = self._raw_client.delete_customer_by_external_id(external_id, request_options=request_options)
432
+ return _response.data
1159
433
 
1160
434
 
1161
- async def main() -> None:
1162
- await client.customers.get_entitlements(
1163
- customer_id="customerId",
1164
- )
435
+ class AsyncCustomersClient:
436
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
437
+ self._raw_client = AsyncRawCustomersClient(client_wrapper=client_wrapper)
1165
438
 
439
+ @property
440
+ def with_raw_response(self) -> AsyncRawCustomersClient:
441
+ """
442
+ Retrieves a raw implementation of this client that returns raw responses.
1166
443
 
1167
- asyncio.run(main())
444
+ Returns
445
+ -------
446
+ AsyncRawCustomersClient
1168
447
  """
1169
- _response = await self._raw_client.get_entitlements(customer_id, request_options=request_options)
1170
- return _response.data
448
+ return self._raw_client
1171
449
 
1172
- async def get_by_external_id(
1173
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1174
- ) -> Customer:
450
+ async def list_customers(
451
+ self,
452
+ *,
453
+ limit: typing.Optional[int] = None,
454
+ offset: typing.Optional[int] = None,
455
+ request_options: typing.Optional[RequestOptions] = None,
456
+ ) -> CustomerListResponse:
1175
457
  """
458
+ Get a list of customers for the organization
459
+
1176
460
  Parameters
1177
461
  ----------
1178
- external_id : str
462
+ limit : typing.Optional[int]
463
+
464
+ offset : typing.Optional[int]
1179
465
 
1180
466
  request_options : typing.Optional[RequestOptions]
1181
467
  Request-specific configuration.
1182
468
 
1183
469
  Returns
1184
470
  -------
1185
- Customer
1186
- Success response
471
+ CustomerListResponse
472
+ 200
1187
473
 
1188
474
  Examples
1189
475
  --------
@@ -1197,57 +483,53 @@ class AsyncCustomersClient:
1197
483
 
1198
484
 
1199
485
  async def main() -> None:
1200
- await client.customers.get_by_external_id(
1201
- external_id="externalId",
1202
- )
486
+ await client.customers.list_customers()
1203
487
 
1204
488
 
1205
489
  asyncio.run(main())
1206
490
  """
1207
- _response = await self._raw_client.get_by_external_id(external_id, request_options=request_options)
491
+ _response = await self._raw_client.list_customers(limit=limit, offset=offset, request_options=request_options)
1208
492
  return _response.data
1209
493
 
1210
- async def update_by_external_id(
494
+ async def create_customer(
1211
495
  self,
1212
- external_id_: str,
1213
496
  *,
1214
- name: typing.Optional[str] = OMIT,
1215
- external_id: typing.Optional[str] = OMIT,
497
+ name: str,
498
+ legal_name: typing.Optional[str] = OMIT,
499
+ email: typing.Optional[str] = OMIT,
1216
500
  phone: typing.Optional[str] = OMIT,
1217
- employee_count: typing.Optional[float] = OMIT,
1218
- annual_revenue: typing.Optional[float] = OMIT,
1219
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
1220
- creation_source: typing.Optional[CreationSource] = OMIT,
1221
501
  website: typing.Optional[str] = OMIT,
1222
- billing_address: typing.Optional[Address] = OMIT,
502
+ external_id: typing.Optional[str] = OMIT,
503
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
504
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
505
+ vat_number: typing.Optional[str] = OMIT,
1223
506
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1224
507
  request_options: typing.Optional[RequestOptions] = None,
1225
508
  ) -> Customer:
1226
509
  """
510
+ Creates a new customer for the organization
511
+
1227
512
  Parameters
1228
513
  ----------
1229
- external_id_ : str
514
+ name : str
1230
515
 
1231
- name : typing.Optional[str]
516
+ legal_name : typing.Optional[str]
1232
517
 
1233
- external_id : typing.Optional[str]
518
+ email : typing.Optional[str]
1234
519
 
1235
520
  phone : typing.Optional[str]
1236
521
 
1237
- employee_count : typing.Optional[float]
1238
-
1239
- annual_revenue : typing.Optional[float]
522
+ website : typing.Optional[str]
1240
523
 
1241
- tax_exempt_status : typing.Optional[TaxExemptStatus]
524
+ external_id : typing.Optional[str]
1242
525
 
1243
- creation_source : typing.Optional[CreationSource]
526
+ billing_address : typing.Optional[CustomerBillingAddress]
1244
527
 
1245
- website : typing.Optional[str]
528
+ creation_state : typing.Optional[CustomerCreationState]
1246
529
 
1247
- billing_address : typing.Optional[Address]
530
+ vat_number : typing.Optional[str]
1248
531
 
1249
532
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1250
- Flexible JSON field for storing custom metadata about the customer
1251
533
 
1252
534
  request_options : typing.Optional[RequestOptions]
1253
535
  Request-specific configuration.
@@ -1255,7 +537,7 @@ class AsyncCustomersClient:
1255
537
  Returns
1256
538
  -------
1257
539
  Customer
1258
- Success response
540
+ 201
1259
541
 
1260
542
  Examples
1261
543
  --------
@@ -1269,43 +551,43 @@ class AsyncCustomersClient:
1269
551
 
1270
552
 
1271
553
  async def main() -> None:
1272
- await client.customers.update_by_external_id(
1273
- external_id_="externalId",
554
+ await client.customers.create_customer(
555
+ name="name",
1274
556
  )
1275
557
 
1276
558
 
1277
559
  asyncio.run(main())
1278
560
  """
1279
- _response = await self._raw_client.update_by_external_id(
1280
- external_id_,
561
+ _response = await self._raw_client.create_customer(
1281
562
  name=name,
1282
- external_id=external_id,
563
+ legal_name=legal_name,
564
+ email=email,
1283
565
  phone=phone,
1284
- employee_count=employee_count,
1285
- annual_revenue=annual_revenue,
1286
- tax_exempt_status=tax_exempt_status,
1287
- creation_source=creation_source,
1288
566
  website=website,
567
+ external_id=external_id,
1289
568
  billing_address=billing_address,
569
+ creation_state=creation_state,
570
+ vat_number=vat_number,
1290
571
  metadata=metadata,
1291
572
  request_options=request_options,
1292
573
  )
1293
574
  return _response.data
1294
575
 
1295
- async def delete_by_external_id(
1296
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1297
- ) -> None:
576
+ async def get_customer_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
1298
577
  """
578
+ Get a customer by ID
579
+
1299
580
  Parameters
1300
581
  ----------
1301
- external_id : str
582
+ id : str
1302
583
 
1303
584
  request_options : typing.Optional[RequestOptions]
1304
585
  Request-specific configuration.
1305
586
 
1306
587
  Returns
1307
588
  -------
1308
- None
589
+ Customer
590
+ 200
1309
591
 
1310
592
  Examples
1311
593
  --------
@@ -1319,56 +601,73 @@ class AsyncCustomersClient:
1319
601
 
1320
602
 
1321
603
  async def main() -> None:
1322
- await client.customers.delete_by_external_id(
1323
- external_id="externalId",
604
+ await client.customers.get_customer_by_id(
605
+ id="id",
1324
606
  )
1325
607
 
1326
608
 
1327
609
  asyncio.run(main())
1328
610
  """
1329
- _response = await self._raw_client.delete_by_external_id(external_id, request_options=request_options)
611
+ _response = await self._raw_client.get_customer_by_id(id, request_options=request_options)
1330
612
  return _response.data
1331
613
 
1332
- async def get_costs_by_external_id(
614
+ async def update_customer_by_id(
1333
615
  self,
1334
- external_id: str,
616
+ id: str,
1335
617
  *,
1336
- limit: typing.Optional[int] = None,
1337
- offset: typing.Optional[int] = None,
1338
- start_time: typing.Optional[dt.datetime] = None,
1339
- end_time: typing.Optional[dt.datetime] = None,
618
+ name: typing.Optional[str] = OMIT,
619
+ legal_name: typing.Optional[str] = OMIT,
620
+ email: typing.Optional[str] = OMIT,
621
+ phone: typing.Optional[str] = OMIT,
622
+ website: typing.Optional[str] = OMIT,
623
+ external_id: typing.Optional[str] = OMIT,
624
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
625
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
626
+ churn_date: typing.Optional[dt.datetime] = OMIT,
627
+ vat_number: typing.Optional[str] = OMIT,
628
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1340
629
  request_options: typing.Optional[RequestOptions] = None,
1341
- ) -> CostTracesResponse:
630
+ ) -> Customer:
1342
631
  """
632
+ Update a customer by ID
633
+
1343
634
  Parameters
1344
635
  ----------
1345
- external_id : str
1346
- The external ID of the customer
636
+ id : str
1347
637
 
1348
- limit : typing.Optional[int]
1349
- Maximum number of traces to return (1-1000)
638
+ name : typing.Optional[str]
1350
639
 
1351
- offset : typing.Optional[int]
1352
- Number of traces to skip for pagination
640
+ legal_name : typing.Optional[str]
641
+
642
+ email : typing.Optional[str]
643
+
644
+ phone : typing.Optional[str]
645
+
646
+ website : typing.Optional[str]
1353
647
 
1354
- start_time : typing.Optional[dt.datetime]
1355
- Filter traces starting from this time (ISO 8601 format)
648
+ external_id : typing.Optional[str]
649
+
650
+ billing_address : typing.Optional[CustomerBillingAddress]
651
+
652
+ creation_state : typing.Optional[CustomerCreationState]
653
+
654
+ churn_date : typing.Optional[dt.datetime]
1356
655
 
1357
- end_time : typing.Optional[dt.datetime]
1358
- Filter traces up to this time (ISO 8601 format)
656
+ vat_number : typing.Optional[str]
657
+
658
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1359
659
 
1360
660
  request_options : typing.Optional[RequestOptions]
1361
661
  Request-specific configuration.
1362
662
 
1363
663
  Returns
1364
664
  -------
1365
- CostTracesResponse
1366
- Success response
665
+ Customer
666
+ 200
1367
667
 
1368
668
  Examples
1369
669
  --------
1370
670
  import asyncio
1371
- import datetime
1372
671
 
1373
672
  from paid import AsyncPaid
1374
673
 
@@ -1378,71 +677,51 @@ class AsyncCustomersClient:
1378
677
 
1379
678
 
1380
679
  async def main() -> None:
1381
- await client.customers.get_costs_by_external_id(
1382
- external_id="externalId",
1383
- limit=1,
1384
- offset=1,
1385
- start_time=datetime.datetime.fromisoformat(
1386
- "2024-01-15 09:30:00+00:00",
1387
- ),
1388
- end_time=datetime.datetime.fromisoformat(
1389
- "2024-01-15 09:30:00+00:00",
1390
- ),
680
+ await client.customers.update_customer_by_id(
681
+ id="id",
1391
682
  )
1392
683
 
1393
684
 
1394
685
  asyncio.run(main())
1395
686
  """
1396
- _response = await self._raw_client.get_costs_by_external_id(
1397
- external_id,
1398
- limit=limit,
1399
- offset=offset,
1400
- start_time=start_time,
1401
- end_time=end_time,
687
+ _response = await self._raw_client.update_customer_by_id(
688
+ id,
689
+ name=name,
690
+ legal_name=legal_name,
691
+ email=email,
692
+ phone=phone,
693
+ website=website,
694
+ external_id=external_id,
695
+ billing_address=billing_address,
696
+ creation_state=creation_state,
697
+ churn_date=churn_date,
698
+ vat_number=vat_number,
699
+ metadata=metadata,
1402
700
  request_options=request_options,
1403
701
  )
1404
702
  return _response.data
1405
703
 
1406
- async def get_usage_by_external_id(
1407
- self,
1408
- external_id: str,
1409
- *,
1410
- limit: typing.Optional[int] = None,
1411
- offset: typing.Optional[int] = None,
1412
- start_time: typing.Optional[dt.datetime] = None,
1413
- end_time: typing.Optional[dt.datetime] = None,
1414
- request_options: typing.Optional[RequestOptions] = None,
1415
- ) -> UsageSummariesResponse:
704
+ async def delete_customer_by_id(
705
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
706
+ ) -> EmptyResponse:
1416
707
  """
708
+ Delete a customer by ID
709
+
1417
710
  Parameters
1418
711
  ----------
1419
- external_id : str
1420
- The external ID of the customer
1421
-
1422
- limit : typing.Optional[int]
1423
- Maximum number of usage summaries to return (1-1000)
1424
-
1425
- offset : typing.Optional[int]
1426
- Number of usage summaries to skip for pagination
1427
-
1428
- start_time : typing.Optional[dt.datetime]
1429
- Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
1430
-
1431
- end_time : typing.Optional[dt.datetime]
1432
- Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
712
+ id : str
1433
713
 
1434
714
  request_options : typing.Optional[RequestOptions]
1435
715
  Request-specific configuration.
1436
716
 
1437
717
  Returns
1438
718
  -------
1439
- UsageSummariesResponse
1440
- Success response
719
+ EmptyResponse
720
+ 200
1441
721
 
1442
722
  Examples
1443
723
  --------
1444
724
  import asyncio
1445
- import datetime
1446
725
 
1447
726
  from paid import AsyncPaid
1448
727
 
@@ -1452,49 +731,33 @@ class AsyncCustomersClient:
1452
731
 
1453
732
 
1454
733
  async def main() -> None:
1455
- await client.customers.get_usage_by_external_id(
1456
- external_id="externalId",
1457
- limit=1,
1458
- offset=1,
1459
- start_time=datetime.datetime.fromisoformat(
1460
- "2024-01-15 09:30:00+00:00",
1461
- ),
1462
- end_time=datetime.datetime.fromisoformat(
1463
- "2024-01-15 09:30:00+00:00",
1464
- ),
734
+ await client.customers.delete_customer_by_id(
735
+ id="id",
1465
736
  )
1466
737
 
1467
738
 
1468
739
  asyncio.run(main())
1469
740
  """
1470
- _response = await self._raw_client.get_usage_by_external_id(
1471
- external_id,
1472
- limit=limit,
1473
- offset=offset,
1474
- start_time=start_time,
1475
- end_time=end_time,
1476
- request_options=request_options,
1477
- )
741
+ _response = await self._raw_client.delete_customer_by_id(id, request_options=request_options)
1478
742
  return _response.data
1479
743
 
1480
- async def list_payment_methods(
744
+ async def get_customer_by_external_id(
1481
745
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1482
- ) -> typing.List[PaymentMethod]:
746
+ ) -> Customer:
1483
747
  """
1484
- Retrieves all payment methods associated with a customer identified by their external ID.
748
+ Get a customer by external ID
1485
749
 
1486
750
  Parameters
1487
751
  ----------
1488
752
  external_id : str
1489
- The external ID of the customer
1490
753
 
1491
754
  request_options : typing.Optional[RequestOptions]
1492
755
  Request-specific configuration.
1493
756
 
1494
757
  Returns
1495
758
  -------
1496
- typing.List[PaymentMethod]
1497
- Success response
759
+ Customer
760
+ 200
1498
761
 
1499
762
  Examples
1500
763
  --------
@@ -1508,49 +771,69 @@ class AsyncCustomersClient:
1508
771
 
1509
772
 
1510
773
  async def main() -> None:
1511
- await client.customers.list_payment_methods(
774
+ await client.customers.get_customer_by_external_id(
1512
775
  external_id="externalId",
1513
776
  )
1514
777
 
1515
778
 
1516
779
  asyncio.run(main())
1517
780
  """
1518
- _response = await self._raw_client.list_payment_methods(external_id, request_options=request_options)
781
+ _response = await self._raw_client.get_customer_by_external_id(external_id, request_options=request_options)
1519
782
  return _response.data
1520
783
 
1521
- async def create_payment_method(
784
+ async def update_customer_by_external_id(
1522
785
  self,
1523
- external_id: str,
786
+ external_id_: str,
1524
787
  *,
1525
- confirmation_token: str,
1526
- return_url: str,
788
+ name: typing.Optional[str] = OMIT,
789
+ legal_name: typing.Optional[str] = OMIT,
790
+ email: typing.Optional[str] = OMIT,
791
+ phone: typing.Optional[str] = OMIT,
792
+ website: typing.Optional[str] = OMIT,
793
+ external_id: typing.Optional[str] = OMIT,
794
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
795
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
796
+ churn_date: typing.Optional[dt.datetime] = OMIT,
797
+ vat_number: typing.Optional[str] = OMIT,
1527
798
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1528
799
  request_options: typing.Optional[RequestOptions] = None,
1529
- ) -> PaymentMethod:
800
+ ) -> Customer:
1530
801
  """
1531
- Creates a new payment method for a customer using a Stripe confirmation token.
802
+ Update a customer by external ID
1532
803
 
1533
804
  Parameters
1534
805
  ----------
1535
- external_id : str
1536
- The external ID of the customer
806
+ external_id_ : str
807
+
808
+ name : typing.Optional[str]
809
+
810
+ legal_name : typing.Optional[str]
811
+
812
+ email : typing.Optional[str]
813
+
814
+ phone : typing.Optional[str]
815
+
816
+ website : typing.Optional[str]
1537
817
 
1538
- confirmation_token : str
1539
- Stripe confirmation token for the payment method
818
+ external_id : typing.Optional[str]
819
+
820
+ billing_address : typing.Optional[CustomerBillingAddress]
821
+
822
+ creation_state : typing.Optional[CustomerCreationState]
823
+
824
+ churn_date : typing.Optional[dt.datetime]
1540
825
 
1541
- return_url : str
1542
- URL to redirect to after payment method setup
826
+ vat_number : typing.Optional[str]
1543
827
 
1544
828
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1545
- Optional metadata to attach to the payment method
1546
829
 
1547
830
  request_options : typing.Optional[RequestOptions]
1548
831
  Request-specific configuration.
1549
832
 
1550
833
  Returns
1551
834
  -------
1552
- PaymentMethod
1553
- Payment method created successfully
835
+ Customer
836
+ 200
1554
837
 
1555
838
  Examples
1556
839
  --------
@@ -1564,45 +847,47 @@ class AsyncCustomersClient:
1564
847
 
1565
848
 
1566
849
  async def main() -> None:
1567
- await client.customers.create_payment_method(
1568
- external_id="externalId",
1569
- confirmation_token="ctoken_1234567890",
1570
- return_url="https://example.com/payment-method-added",
1571
- metadata={"source": "api"},
850
+ await client.customers.update_customer_by_external_id(
851
+ external_id_="externalId",
1572
852
  )
1573
853
 
1574
854
 
1575
855
  asyncio.run(main())
1576
856
  """
1577
- _response = await self._raw_client.create_payment_method(
1578
- external_id,
1579
- confirmation_token=confirmation_token,
1580
- return_url=return_url,
857
+ _response = await self._raw_client.update_customer_by_external_id(
858
+ external_id_,
859
+ name=name,
860
+ legal_name=legal_name,
861
+ email=email,
862
+ phone=phone,
863
+ website=website,
864
+ external_id=external_id,
865
+ billing_address=billing_address,
866
+ creation_state=creation_state,
867
+ churn_date=churn_date,
868
+ vat_number=vat_number,
1581
869
  metadata=metadata,
1582
870
  request_options=request_options,
1583
871
  )
1584
872
  return _response.data
1585
873
 
1586
- async def delete_payment_method(
1587
- self, external_id: str, payment_method_id: str, *, request_options: typing.Optional[RequestOptions] = None
1588
- ) -> None:
874
+ async def delete_customer_by_external_id(
875
+ self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
876
+ ) -> EmptyResponse:
1589
877
  """
1590
- Deletes a specific payment method from a customer's account.
878
+ Delete a customer by external ID
1591
879
 
1592
880
  Parameters
1593
881
  ----------
1594
882
  external_id : str
1595
- The external ID of the customer
1596
-
1597
- payment_method_id : str
1598
- The ID of the payment method to delete
1599
883
 
1600
884
  request_options : typing.Optional[RequestOptions]
1601
885
  Request-specific configuration.
1602
886
 
1603
887
  Returns
1604
888
  -------
1605
- None
889
+ EmptyResponse
890
+ 200
1606
891
 
1607
892
  Examples
1608
893
  --------
@@ -1616,15 +901,12 @@ class AsyncCustomersClient:
1616
901
 
1617
902
 
1618
903
  async def main() -> None:
1619
- await client.customers.delete_payment_method(
904
+ await client.customers.delete_customer_by_external_id(
1620
905
  external_id="externalId",
1621
- payment_method_id="paymentMethodId",
1622
906
  )
1623
907
 
1624
908
 
1625
909
  asyncio.run(main())
1626
910
  """
1627
- _response = await self._raw_client.delete_payment_method(
1628
- external_id, payment_method_id, request_options=request_options
1629
- )
911
+ _response = await self._raw_client.delete_customer_by_external_id(external_id, request_options=request_options)
1630
912
  return _response.data