paid-python 1.0.0a0__py3-none-any.whl → 1.0.0a1__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.
- paid/__init__.py +61 -122
- paid/client.py +16 -22
- paid/contacts/client.py +415 -133
- paid/contacts/raw_client.py +1046 -118
- paid/core/client_wrapper.py +8 -10
- paid/customers/__init__.py +0 -3
- paid/customers/client.py +392 -1112
- paid/customers/raw_client.py +656 -1054
- paid/environment.py +1 -1
- paid/errors/bad_request_error.py +2 -2
- paid/errors/forbidden_error.py +2 -2
- paid/errors/internal_server_error.py +2 -2
- paid/errors/not_found_error.py +2 -2
- paid/invoices/client.py +369 -0
- paid/{plans → invoices}/raw_client.py +310 -201
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +279 -471
- paid/orders/raw_client.py +551 -538
- paid/products/__init__.py +0 -3
- paid/products/client.py +129 -265
- paid/products/raw_client.py +563 -233
- paid/signals/client.py +130 -0
- paid/signals/raw_client.py +190 -0
- paid/tracing/autoinstrumentation.py +12 -6
- paid/tracing/context_manager.py +2 -6
- paid/tracing/distributed_tracing.py +3 -3
- paid/tracing/signal.py +3 -3
- paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
- paid/types/__init__.py +58 -110
- paid/types/attribution.py +8 -0
- paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
- paid/types/contact.py +12 -20
- paid/types/{address.py → contact_billing_address.py} +6 -7
- paid/types/{traces_response.py → contact_list_response.py} +5 -9
- paid/types/customer.py +15 -22
- paid/types/customer_attribution.py +8 -0
- paid/types/customer_billing_address.py +26 -0
- paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
- paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
- paid/types/customer_creation_state.py +5 -0
- paid/types/customer_list_response.py +22 -0
- paid/types/empty_response.py +17 -0
- paid/types/{error.py → error_response.py} +4 -7
- paid/types/invoice.py +33 -51
- paid/types/invoice_line.py +42 -0
- paid/types/invoice_line_payment_status.py +7 -0
- paid/types/invoice_lines_response.py +22 -0
- paid/types/invoice_list_response.py +22 -0
- paid/types/invoice_payment_status.py +5 -0
- paid/types/invoice_source.py +5 -0
- paid/types/invoice_status.py +3 -1
- paid/types/invoice_tax_status.py +7 -0
- paid/types/order.py +30 -29
- paid/types/order_creation_state.py +5 -0
- paid/types/order_line.py +6 -24
- paid/types/order_lines_response.py +22 -0
- paid/types/order_list_response.py +22 -0
- paid/types/pagination.py +24 -0
- paid/types/product.py +4 -29
- paid/types/{tier.py → product_by_external_id.py} +5 -4
- paid/types/{cost_amount.py → product_by_id.py} +5 -12
- paid/types/product_list_response.py +22 -0
- paid/types/signal.py +8 -34
- paid/types/{agent_update.py → update_contact_request.py} +10 -9
- paid/types/update_customer_request.py +38 -0
- paid/types/{product_update.py → update_product_request.py} +2 -12
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/METADATA +22 -8
- paid_python-1.0.0a1.dist-info/RECORD +110 -0
- paid/agents/client.py +0 -880
- paid/agents/raw_client.py +0 -785
- paid/customers/types/__init__.py +0 -8
- paid/customers/types/customers_check_entitlement_request_view.py +0 -5
- paid/customers/types/customers_check_entitlement_response.py +0 -22
- paid/orders/lines/client.py +0 -144
- paid/orders/lines/raw_client.py +0 -129
- paid/plans/__init__.py +0 -4
- paid/plans/client.py +0 -403
- paid/products/types/__init__.py +0 -7
- paid/products/types/product_create_type.py +0 -5
- paid/traces/__init__.py +0 -4
- paid/traces/client.py +0 -218
- paid/traces/raw_client.py +0 -226
- paid/types/agent.py +0 -31
- paid/types/agent_price_point.py +0 -27
- paid/types/agent_price_point_tiers.py +0 -23
- paid/types/api_error.py +0 -29
- paid/types/billing_frequency.py +0 -5
- paid/types/cancel_renewal_response.py +0 -49
- paid/types/charge_type.py +0 -5
- paid/types/contact_create_for_customer.py +0 -37
- paid/types/cost_trace.py +0 -55
- paid/types/cost_traces_response.py +0 -26
- paid/types/creation_source.py +0 -5
- paid/types/creation_state.py +0 -5
- paid/types/customer_update.py +0 -40
- paid/types/entitlement_usage.py +0 -48
- paid/types/order_line_attribute.py +0 -27
- paid/types/order_line_attribute_create_one.py +0 -5
- paid/types/order_line_attribute_pricing.py +0 -33
- paid/types/order_line_create.py +0 -72
- paid/types/pagination_meta.py +0 -84
- paid/types/payment_method.py +0 -58
- paid/types/payment_method_card.py +0 -49
- paid/types/payment_method_type.py +0 -5
- paid/types/payment_method_us_bank_account.py +0 -36
- paid/types/payment_method_us_bank_account_account_type.py +0 -5
- paid/types/plan.py +0 -81
- paid/types/plan_group.py +0 -60
- paid/types/plan_plan_products_item.py +0 -41
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
- paid/types/plan_with_features.py +0 -69
- paid/types/plan_with_features_features_item.py +0 -34
- paid/types/price_point.py +0 -25
- paid/types/pricing.py +0 -31
- paid/types/pricing_model_type.py +0 -7
- paid/types/product_type.py +0 -5
- paid/types/product_update_type.py +0 -5
- paid/types/proration_attribute_update.py +0 -44
- paid/types/proration_detail.py +0 -49
- paid/types/proration_upgrade_response.py +0 -73
- paid/types/salutation.py +0 -5
- paid/types/signal_v_2.py +0 -56
- paid/types/tax_exempt_status.py +0 -5
- paid/types/trace.py +0 -69
- paid/types/usage_pagination_meta.py +0 -43
- paid/types/usage_summaries_response.py +0 -26
- paid/types/usage_summary.py +0 -121
- paid/usage/__init__.py +0 -7
- paid/usage/client.py +0 -321
- paid/usage/raw_client.py +0 -387
- paid/usage/types/__init__.py +0 -7
- paid/usage/types/usage_check_usage_response.py +0 -53
- paid_python-1.0.0a0.dist-info/RECORD +0 -152
- /paid/{agents → invoices}/__init__.py +0 -0
- /paid/{orders/lines → signals}/__init__.py +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/LICENSE +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/WHEEL +0 -0
paid/orders/client.py
CHANGED
|
@@ -5,13 +5,11 @@ import typing
|
|
|
5
5
|
|
|
6
6
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
7
|
from ..core.request_options import RequestOptions
|
|
8
|
-
from ..types.
|
|
9
|
-
from ..types.invoice import Invoice
|
|
8
|
+
from ..types.empty_response import EmptyResponse
|
|
10
9
|
from ..types.order import Order
|
|
11
|
-
from ..types.
|
|
12
|
-
from ..types.
|
|
13
|
-
from ..types.
|
|
14
|
-
from .lines.client import AsyncLinesClient, LinesClient
|
|
10
|
+
from ..types.order_creation_state import OrderCreationState
|
|
11
|
+
from ..types.order_lines_response import OrderLinesResponse
|
|
12
|
+
from ..types.order_list_response import OrderListResponse
|
|
15
13
|
from .raw_client import AsyncRawOrdersClient, RawOrdersClient
|
|
16
14
|
|
|
17
15
|
# this is used as the default value for optional parameters
|
|
@@ -21,7 +19,6 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
21
19
|
class OrdersClient:
|
|
22
20
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
23
21
|
self._raw_client = RawOrdersClient(client_wrapper=client_wrapper)
|
|
24
|
-
self.lines = LinesClient(client_wrapper=client_wrapper)
|
|
25
22
|
|
|
26
23
|
@property
|
|
27
24
|
def with_raw_response(self) -> RawOrdersClient:
|
|
@@ -34,17 +31,29 @@ class OrdersClient:
|
|
|
34
31
|
"""
|
|
35
32
|
return self._raw_client
|
|
36
33
|
|
|
37
|
-
def
|
|
34
|
+
def list_orders(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
limit: typing.Optional[int] = None,
|
|
38
|
+
offset: typing.Optional[int] = None,
|
|
39
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
40
|
+
) -> OrderListResponse:
|
|
38
41
|
"""
|
|
42
|
+
Get a list of orders for the organization
|
|
43
|
+
|
|
39
44
|
Parameters
|
|
40
45
|
----------
|
|
46
|
+
limit : typing.Optional[int]
|
|
47
|
+
|
|
48
|
+
offset : typing.Optional[int]
|
|
49
|
+
|
|
41
50
|
request_options : typing.Optional[RequestOptions]
|
|
42
51
|
Request-specific configuration.
|
|
43
52
|
|
|
44
53
|
Returns
|
|
45
54
|
-------
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
OrderListResponse
|
|
56
|
+
200
|
|
48
57
|
|
|
49
58
|
Examples
|
|
50
59
|
--------
|
|
@@ -53,49 +62,56 @@ class OrdersClient:
|
|
|
53
62
|
client = Paid(
|
|
54
63
|
token="YOUR_TOKEN",
|
|
55
64
|
)
|
|
56
|
-
client.orders.
|
|
65
|
+
client.orders.list_orders()
|
|
57
66
|
"""
|
|
58
|
-
_response = self._raw_client.
|
|
67
|
+
_response = self._raw_client.list_orders(limit=limit, offset=offset, request_options=request_options)
|
|
59
68
|
return _response.data
|
|
60
69
|
|
|
61
|
-
def
|
|
70
|
+
def create_a_new_order(
|
|
62
71
|
self,
|
|
63
72
|
*,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
customer_id: str,
|
|
74
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
75
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
76
|
+
name: typing.Optional[str] = OMIT,
|
|
77
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
78
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
79
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
80
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
81
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
82
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
83
|
+
external_id: typing.Optional[str] = OMIT,
|
|
84
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
74
85
|
request_options: typing.Optional[RequestOptions] = None,
|
|
75
86
|
) -> Order:
|
|
76
87
|
"""
|
|
88
|
+
Creates a new order for the organization
|
|
89
|
+
|
|
77
90
|
Parameters
|
|
78
91
|
----------
|
|
79
|
-
|
|
92
|
+
customer_id : str
|
|
80
93
|
|
|
81
|
-
|
|
94
|
+
billing_customer_id : typing.Optional[str]
|
|
82
95
|
|
|
83
|
-
|
|
96
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
84
97
|
|
|
85
|
-
|
|
98
|
+
name : typing.Optional[str]
|
|
86
99
|
|
|
87
|
-
|
|
100
|
+
start_date : typing.Optional[dt.datetime]
|
|
88
101
|
|
|
89
|
-
|
|
102
|
+
end_date : typing.Optional[dt.datetime]
|
|
90
103
|
|
|
91
|
-
|
|
104
|
+
subscription_terms : typing.Optional[int]
|
|
92
105
|
|
|
93
|
-
|
|
106
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
94
107
|
|
|
95
|
-
|
|
96
|
-
Optional plan ID to associate with this order
|
|
108
|
+
billing_anchor : typing.Optional[float]
|
|
97
109
|
|
|
98
|
-
|
|
110
|
+
payment_terms : typing.Optional[str]
|
|
111
|
+
|
|
112
|
+
external_id : typing.Optional[str]
|
|
113
|
+
|
|
114
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
99
115
|
|
|
100
116
|
request_options : typing.Optional[RequestOptions]
|
|
101
117
|
Request-specific configuration.
|
|
@@ -103,7 +119,7 @@ class OrdersClient:
|
|
|
103
119
|
Returns
|
|
104
120
|
-------
|
|
105
121
|
Order
|
|
106
|
-
|
|
122
|
+
201
|
|
107
123
|
|
|
108
124
|
Examples
|
|
109
125
|
--------
|
|
@@ -112,35 +128,34 @@ class OrdersClient:
|
|
|
112
128
|
client = Paid(
|
|
113
129
|
token="YOUR_TOKEN",
|
|
114
130
|
)
|
|
115
|
-
client.orders.
|
|
116
|
-
|
|
117
|
-
name="Acme Order",
|
|
118
|
-
description="Acme Order is an order for Acme, Inc.",
|
|
119
|
-
start_date="2025-01-01",
|
|
120
|
-
end_date="2026-01-01",
|
|
121
|
-
currency="USD",
|
|
131
|
+
client.orders.create_a_new_order(
|
|
132
|
+
customer_id="customerId",
|
|
122
133
|
)
|
|
123
134
|
"""
|
|
124
|
-
_response = self._raw_client.
|
|
135
|
+
_response = self._raw_client.create_a_new_order(
|
|
136
|
+
customer_id=customer_id,
|
|
137
|
+
billing_customer_id=billing_customer_id,
|
|
138
|
+
billing_contact_ids=billing_contact_ids,
|
|
125
139
|
name=name,
|
|
126
140
|
start_date=start_date,
|
|
127
|
-
currency=currency,
|
|
128
|
-
customer_id=customer_id,
|
|
129
|
-
customer_external_id=customer_external_id,
|
|
130
|
-
billing_contact_id=billing_contact_id,
|
|
131
|
-
description=description,
|
|
132
141
|
end_date=end_date,
|
|
133
|
-
|
|
134
|
-
|
|
142
|
+
subscription_terms=subscription_terms,
|
|
143
|
+
creation_state=creation_state,
|
|
144
|
+
billing_anchor=billing_anchor,
|
|
145
|
+
payment_terms=payment_terms,
|
|
146
|
+
external_id=external_id,
|
|
147
|
+
metadata=metadata,
|
|
135
148
|
request_options=request_options,
|
|
136
149
|
)
|
|
137
150
|
return _response.data
|
|
138
151
|
|
|
139
|
-
def
|
|
152
|
+
def get_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Order:
|
|
140
153
|
"""
|
|
154
|
+
Get an order by its ID
|
|
155
|
+
|
|
141
156
|
Parameters
|
|
142
157
|
----------
|
|
143
|
-
|
|
158
|
+
id : str
|
|
144
159
|
|
|
145
160
|
request_options : typing.Optional[RequestOptions]
|
|
146
161
|
Request-specific configuration.
|
|
@@ -148,7 +163,7 @@ class OrdersClient:
|
|
|
148
163
|
Returns
|
|
149
164
|
-------
|
|
150
165
|
Order
|
|
151
|
-
|
|
166
|
+
200
|
|
152
167
|
|
|
153
168
|
Examples
|
|
154
169
|
--------
|
|
@@ -157,89 +172,58 @@ class OrdersClient:
|
|
|
157
172
|
client = Paid(
|
|
158
173
|
token="YOUR_TOKEN",
|
|
159
174
|
)
|
|
160
|
-
client.orders.
|
|
161
|
-
|
|
175
|
+
client.orders.get_order(
|
|
176
|
+
id="id",
|
|
162
177
|
)
|
|
163
178
|
"""
|
|
164
|
-
_response = self._raw_client.
|
|
179
|
+
_response = self._raw_client.get_order(id, request_options=request_options)
|
|
165
180
|
return _response.data
|
|
166
181
|
|
|
167
|
-
def
|
|
182
|
+
def update_order(
|
|
183
|
+
self,
|
|
184
|
+
id: str,
|
|
185
|
+
*,
|
|
186
|
+
name: typing.Optional[str] = OMIT,
|
|
187
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
188
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
189
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
190
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
191
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
192
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
193
|
+
external_id: typing.Optional[str] = OMIT,
|
|
194
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
195
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
196
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
197
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
198
|
+
) -> Order:
|
|
168
199
|
"""
|
|
200
|
+
Update an order by its ID
|
|
201
|
+
|
|
169
202
|
Parameters
|
|
170
203
|
----------
|
|
171
|
-
|
|
204
|
+
id : str
|
|
172
205
|
|
|
173
|
-
|
|
174
|
-
Request-specific configuration.
|
|
206
|
+
name : typing.Optional[str]
|
|
175
207
|
|
|
176
|
-
|
|
177
|
-
-------
|
|
178
|
-
None
|
|
208
|
+
start_date : typing.Optional[dt.datetime]
|
|
179
209
|
|
|
180
|
-
|
|
181
|
-
--------
|
|
182
|
-
from paid import Paid
|
|
210
|
+
end_date : typing.Optional[dt.datetime]
|
|
183
211
|
|
|
184
|
-
|
|
185
|
-
token="YOUR_TOKEN",
|
|
186
|
-
)
|
|
187
|
-
client.orders.delete(
|
|
188
|
-
order_id="orderId",
|
|
189
|
-
)
|
|
190
|
-
"""
|
|
191
|
-
_response = self._raw_client.delete(order_id, request_options=request_options)
|
|
192
|
-
return _response.data
|
|
212
|
+
subscription_terms : typing.Optional[int]
|
|
193
213
|
|
|
194
|
-
|
|
195
|
-
"""
|
|
196
|
-
Parameters
|
|
197
|
-
----------
|
|
198
|
-
order_id : str
|
|
214
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
199
215
|
|
|
200
|
-
|
|
201
|
-
Request-specific configuration.
|
|
216
|
+
billing_anchor : typing.Optional[float]
|
|
202
217
|
|
|
203
|
-
|
|
204
|
-
-------
|
|
205
|
-
Order
|
|
206
|
-
Success response
|
|
218
|
+
payment_terms : typing.Optional[str]
|
|
207
219
|
|
|
208
|
-
|
|
209
|
-
--------
|
|
210
|
-
from paid import Paid
|
|
220
|
+
external_id : typing.Optional[str]
|
|
211
221
|
|
|
212
|
-
|
|
213
|
-
token="YOUR_TOKEN",
|
|
214
|
-
)
|
|
215
|
-
client.orders.activate(
|
|
216
|
-
order_id="orderId",
|
|
217
|
-
)
|
|
218
|
-
"""
|
|
219
|
-
_response = self._raw_client.activate(order_id, request_options=request_options)
|
|
220
|
-
return _response.data
|
|
222
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
221
223
|
|
|
222
|
-
|
|
223
|
-
self,
|
|
224
|
-
order_id: str,
|
|
225
|
-
*,
|
|
226
|
-
confirmation_token: str,
|
|
227
|
-
return_url: str,
|
|
228
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
229
|
-
) -> Order:
|
|
230
|
-
"""
|
|
231
|
-
Activates the order and processes the initial payment using the provided Stripe confirmation token.
|
|
224
|
+
billing_customer_id : typing.Optional[str]
|
|
232
225
|
|
|
233
|
-
|
|
234
|
-
----------
|
|
235
|
-
order_id : str
|
|
236
|
-
The order ID (can be internal ID or display ID)
|
|
237
|
-
|
|
238
|
-
confirmation_token : str
|
|
239
|
-
Stripe confirmation token for the payment method
|
|
240
|
-
|
|
241
|
-
return_url : str
|
|
242
|
-
URL to redirect to after payment processing
|
|
226
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
243
227
|
|
|
244
228
|
request_options : typing.Optional[RequestOptions]
|
|
245
229
|
Request-specific configuration.
|
|
@@ -247,7 +231,7 @@ class OrdersClient:
|
|
|
247
231
|
Returns
|
|
248
232
|
-------
|
|
249
233
|
Order
|
|
250
|
-
|
|
234
|
+
200
|
|
251
235
|
|
|
252
236
|
Examples
|
|
253
237
|
--------
|
|
@@ -256,154 +240,83 @@ class OrdersClient:
|
|
|
256
240
|
client = Paid(
|
|
257
241
|
token="YOUR_TOKEN",
|
|
258
242
|
)
|
|
259
|
-
client.orders.
|
|
260
|
-
|
|
261
|
-
confirmation_token="ctoken_1234567890",
|
|
262
|
-
return_url="https://example.com/payment-complete",
|
|
243
|
+
client.orders.update_order(
|
|
244
|
+
id="id",
|
|
263
245
|
)
|
|
264
246
|
"""
|
|
265
|
-
_response = self._raw_client.
|
|
266
|
-
|
|
247
|
+
_response = self._raw_client.update_order(
|
|
248
|
+
id,
|
|
249
|
+
name=name,
|
|
250
|
+
start_date=start_date,
|
|
251
|
+
end_date=end_date,
|
|
252
|
+
subscription_terms=subscription_terms,
|
|
253
|
+
creation_state=creation_state,
|
|
254
|
+
billing_anchor=billing_anchor,
|
|
255
|
+
payment_terms=payment_terms,
|
|
256
|
+
external_id=external_id,
|
|
257
|
+
metadata=metadata,
|
|
258
|
+
billing_customer_id=billing_customer_id,
|
|
259
|
+
billing_contact_ids=billing_contact_ids,
|
|
260
|
+
request_options=request_options,
|
|
267
261
|
)
|
|
268
262
|
return _response.data
|
|
269
263
|
|
|
270
|
-
def
|
|
271
|
-
self,
|
|
272
|
-
order_id: str,
|
|
273
|
-
*,
|
|
274
|
-
order_version: int,
|
|
275
|
-
cancel_from_date: dt.datetime,
|
|
276
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
277
|
-
) -> CancelRenewalResponse:
|
|
264
|
+
def delete_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> EmptyResponse:
|
|
278
265
|
"""
|
|
279
|
-
|
|
266
|
+
Delete an order by its ID
|
|
280
267
|
|
|
281
268
|
Parameters
|
|
282
269
|
----------
|
|
283
|
-
|
|
284
|
-
The order ID (can be internal ID or display ID)
|
|
285
|
-
|
|
286
|
-
order_version : int
|
|
287
|
-
The current version of the order (for optimistic locking)
|
|
288
|
-
|
|
289
|
-
cancel_from_date : dt.datetime
|
|
290
|
-
The date from which the renewal should be cancelled (ISO 8601 format)
|
|
270
|
+
id : str
|
|
291
271
|
|
|
292
272
|
request_options : typing.Optional[RequestOptions]
|
|
293
273
|
Request-specific configuration.
|
|
294
274
|
|
|
295
275
|
Returns
|
|
296
276
|
-------
|
|
297
|
-
|
|
298
|
-
|
|
277
|
+
EmptyResponse
|
|
278
|
+
200
|
|
299
279
|
|
|
300
280
|
Examples
|
|
301
281
|
--------
|
|
302
|
-
import datetime
|
|
303
|
-
|
|
304
282
|
from paid import Paid
|
|
305
283
|
|
|
306
284
|
client = Paid(
|
|
307
285
|
token="YOUR_TOKEN",
|
|
308
286
|
)
|
|
309
|
-
client.orders.
|
|
310
|
-
|
|
311
|
-
order_version=1,
|
|
312
|
-
cancel_from_date=datetime.datetime.fromisoformat(
|
|
313
|
-
"2025-12-31 00:00:00+00:00",
|
|
314
|
-
),
|
|
287
|
+
client.orders.delete_order(
|
|
288
|
+
id="id",
|
|
315
289
|
)
|
|
316
290
|
"""
|
|
317
|
-
_response = self._raw_client.
|
|
318
|
-
order_id, order_version=order_version, cancel_from_date=cancel_from_date, request_options=request_options
|
|
319
|
-
)
|
|
291
|
+
_response = self._raw_client.delete_order(id, request_options=request_options)
|
|
320
292
|
return _response.data
|
|
321
293
|
|
|
322
|
-
def
|
|
294
|
+
def get_order_lines(
|
|
323
295
|
self,
|
|
324
|
-
|
|
296
|
+
id: str,
|
|
325
297
|
*,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
updated_order_line_attributes: typing.Sequence[ProrationAttributeUpdate],
|
|
298
|
+
limit: typing.Optional[int] = None,
|
|
299
|
+
offset: typing.Optional[int] = None,
|
|
329
300
|
request_options: typing.Optional[RequestOptions] = None,
|
|
330
|
-
) ->
|
|
301
|
+
) -> OrderLinesResponse:
|
|
331
302
|
"""
|
|
332
|
-
|
|
303
|
+
Get the order lines for an order by its ID
|
|
333
304
|
|
|
334
305
|
Parameters
|
|
335
306
|
----------
|
|
336
|
-
|
|
337
|
-
The order ID (can be internal ID or display ID)
|
|
307
|
+
id : str
|
|
338
308
|
|
|
339
|
-
|
|
340
|
-
The current version of the order (for optimistic locking)
|
|
309
|
+
limit : typing.Optional[int]
|
|
341
310
|
|
|
342
|
-
|
|
343
|
-
The date when the plan change should take effect (ISO 8601 format)
|
|
344
|
-
|
|
345
|
-
updated_order_line_attributes : typing.Sequence[ProrationAttributeUpdate]
|
|
346
|
-
The list of order line attributes to update
|
|
311
|
+
offset : typing.Optional[int]
|
|
347
312
|
|
|
348
313
|
request_options : typing.Optional[RequestOptions]
|
|
349
314
|
Request-specific configuration.
|
|
350
315
|
|
|
351
316
|
Returns
|
|
352
317
|
-------
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
Examples
|
|
357
|
-
--------
|
|
358
|
-
import datetime
|
|
359
|
-
|
|
360
|
-
from paid import Paid, ProrationAttributeUpdate
|
|
361
|
-
|
|
362
|
-
client = Paid(
|
|
363
|
-
token="YOUR_TOKEN",
|
|
364
|
-
)
|
|
365
|
-
client.orders.schedule_plan_change(
|
|
366
|
-
order_id="orderId",
|
|
367
|
-
order_version=1,
|
|
368
|
-
effective_date=datetime.datetime.fromisoformat(
|
|
369
|
-
"2025-02-01 00:00:00+00:00",
|
|
370
|
-
),
|
|
371
|
-
updated_order_line_attributes=[
|
|
372
|
-
ProrationAttributeUpdate(
|
|
373
|
-
order_line_attribute_id="a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
|
374
|
-
new_pricing={"unitPrice": 200, "currency": "USD"},
|
|
375
|
-
new_quantity=10.0,
|
|
376
|
-
)
|
|
377
|
-
],
|
|
378
|
-
)
|
|
379
|
-
"""
|
|
380
|
-
_response = self._raw_client.schedule_plan_change(
|
|
381
|
-
order_id,
|
|
382
|
-
order_version=order_version,
|
|
383
|
-
effective_date=effective_date,
|
|
384
|
-
updated_order_line_attributes=updated_order_line_attributes,
|
|
385
|
-
request_options=request_options,
|
|
386
|
-
)
|
|
387
|
-
return _response.data
|
|
388
|
-
|
|
389
|
-
def get_invoices(
|
|
390
|
-
self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
391
|
-
) -> typing.List[Invoice]:
|
|
392
|
-
"""
|
|
393
|
-
Retrieves all invoices associated with a specific order.
|
|
394
|
-
|
|
395
|
-
Parameters
|
|
396
|
-
----------
|
|
397
|
-
order_id : str
|
|
398
|
-
The order ID (can be internal ID or display ID)
|
|
399
|
-
|
|
400
|
-
request_options : typing.Optional[RequestOptions]
|
|
401
|
-
Request-specific configuration.
|
|
402
|
-
|
|
403
|
-
Returns
|
|
404
|
-
-------
|
|
405
|
-
typing.List[Invoice]
|
|
406
|
-
Success response
|
|
318
|
+
OrderLinesResponse
|
|
319
|
+
200
|
|
407
320
|
|
|
408
321
|
Examples
|
|
409
322
|
--------
|
|
@@ -412,18 +325,17 @@ class OrdersClient:
|
|
|
412
325
|
client = Paid(
|
|
413
326
|
token="YOUR_TOKEN",
|
|
414
327
|
)
|
|
415
|
-
client.orders.
|
|
416
|
-
|
|
328
|
+
client.orders.get_order_lines(
|
|
329
|
+
id="id",
|
|
417
330
|
)
|
|
418
331
|
"""
|
|
419
|
-
_response = self._raw_client.
|
|
332
|
+
_response = self._raw_client.get_order_lines(id, limit=limit, offset=offset, request_options=request_options)
|
|
420
333
|
return _response.data
|
|
421
334
|
|
|
422
335
|
|
|
423
336
|
class AsyncOrdersClient:
|
|
424
337
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
425
338
|
self._raw_client = AsyncRawOrdersClient(client_wrapper=client_wrapper)
|
|
426
|
-
self.lines = AsyncLinesClient(client_wrapper=client_wrapper)
|
|
427
339
|
|
|
428
340
|
@property
|
|
429
341
|
def with_raw_response(self) -> AsyncRawOrdersClient:
|
|
@@ -436,17 +348,29 @@ class AsyncOrdersClient:
|
|
|
436
348
|
"""
|
|
437
349
|
return self._raw_client
|
|
438
350
|
|
|
439
|
-
async def
|
|
351
|
+
async def list_orders(
|
|
352
|
+
self,
|
|
353
|
+
*,
|
|
354
|
+
limit: typing.Optional[int] = None,
|
|
355
|
+
offset: typing.Optional[int] = None,
|
|
356
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
357
|
+
) -> OrderListResponse:
|
|
440
358
|
"""
|
|
359
|
+
Get a list of orders for the organization
|
|
360
|
+
|
|
441
361
|
Parameters
|
|
442
362
|
----------
|
|
363
|
+
limit : typing.Optional[int]
|
|
364
|
+
|
|
365
|
+
offset : typing.Optional[int]
|
|
366
|
+
|
|
443
367
|
request_options : typing.Optional[RequestOptions]
|
|
444
368
|
Request-specific configuration.
|
|
445
369
|
|
|
446
370
|
Returns
|
|
447
371
|
-------
|
|
448
|
-
|
|
449
|
-
|
|
372
|
+
OrderListResponse
|
|
373
|
+
200
|
|
450
374
|
|
|
451
375
|
Examples
|
|
452
376
|
--------
|
|
@@ -460,52 +384,59 @@ class AsyncOrdersClient:
|
|
|
460
384
|
|
|
461
385
|
|
|
462
386
|
async def main() -> None:
|
|
463
|
-
await client.orders.
|
|
387
|
+
await client.orders.list_orders()
|
|
464
388
|
|
|
465
389
|
|
|
466
390
|
asyncio.run(main())
|
|
467
391
|
"""
|
|
468
|
-
_response = await self._raw_client.
|
|
392
|
+
_response = await self._raw_client.list_orders(limit=limit, offset=offset, request_options=request_options)
|
|
469
393
|
return _response.data
|
|
470
394
|
|
|
471
|
-
async def
|
|
395
|
+
async def create_a_new_order(
|
|
472
396
|
self,
|
|
473
397
|
*,
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
398
|
+
customer_id: str,
|
|
399
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
400
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
401
|
+
name: typing.Optional[str] = OMIT,
|
|
402
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
403
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
404
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
405
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
406
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
407
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
408
|
+
external_id: typing.Optional[str] = OMIT,
|
|
409
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
484
410
|
request_options: typing.Optional[RequestOptions] = None,
|
|
485
411
|
) -> Order:
|
|
486
412
|
"""
|
|
413
|
+
Creates a new order for the organization
|
|
414
|
+
|
|
487
415
|
Parameters
|
|
488
416
|
----------
|
|
489
|
-
|
|
417
|
+
customer_id : str
|
|
418
|
+
|
|
419
|
+
billing_customer_id : typing.Optional[str]
|
|
490
420
|
|
|
491
|
-
|
|
421
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
492
422
|
|
|
493
|
-
|
|
423
|
+
name : typing.Optional[str]
|
|
494
424
|
|
|
495
|
-
|
|
425
|
+
start_date : typing.Optional[dt.datetime]
|
|
496
426
|
|
|
497
|
-
|
|
427
|
+
end_date : typing.Optional[dt.datetime]
|
|
498
428
|
|
|
499
|
-
|
|
429
|
+
subscription_terms : typing.Optional[int]
|
|
500
430
|
|
|
501
|
-
|
|
431
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
502
432
|
|
|
503
|
-
|
|
433
|
+
billing_anchor : typing.Optional[float]
|
|
504
434
|
|
|
505
|
-
|
|
506
|
-
Optional plan ID to associate with this order
|
|
435
|
+
payment_terms : typing.Optional[str]
|
|
507
436
|
|
|
508
|
-
|
|
437
|
+
external_id : typing.Optional[str]
|
|
438
|
+
|
|
439
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
509
440
|
|
|
510
441
|
request_options : typing.Optional[RequestOptions]
|
|
511
442
|
Request-specific configuration.
|
|
@@ -513,7 +444,7 @@ class AsyncOrdersClient:
|
|
|
513
444
|
Returns
|
|
514
445
|
-------
|
|
515
446
|
Order
|
|
516
|
-
|
|
447
|
+
201
|
|
517
448
|
|
|
518
449
|
Examples
|
|
519
450
|
--------
|
|
@@ -527,38 +458,37 @@ class AsyncOrdersClient:
|
|
|
527
458
|
|
|
528
459
|
|
|
529
460
|
async def main() -> None:
|
|
530
|
-
await client.orders.
|
|
531
|
-
|
|
532
|
-
name="Acme Order",
|
|
533
|
-
description="Acme Order is an order for Acme, Inc.",
|
|
534
|
-
start_date="2025-01-01",
|
|
535
|
-
end_date="2026-01-01",
|
|
536
|
-
currency="USD",
|
|
461
|
+
await client.orders.create_a_new_order(
|
|
462
|
+
customer_id="customerId",
|
|
537
463
|
)
|
|
538
464
|
|
|
539
465
|
|
|
540
466
|
asyncio.run(main())
|
|
541
467
|
"""
|
|
542
|
-
_response = await self._raw_client.
|
|
468
|
+
_response = await self._raw_client.create_a_new_order(
|
|
469
|
+
customer_id=customer_id,
|
|
470
|
+
billing_customer_id=billing_customer_id,
|
|
471
|
+
billing_contact_ids=billing_contact_ids,
|
|
543
472
|
name=name,
|
|
544
473
|
start_date=start_date,
|
|
545
|
-
currency=currency,
|
|
546
|
-
customer_id=customer_id,
|
|
547
|
-
customer_external_id=customer_external_id,
|
|
548
|
-
billing_contact_id=billing_contact_id,
|
|
549
|
-
description=description,
|
|
550
474
|
end_date=end_date,
|
|
551
|
-
|
|
552
|
-
|
|
475
|
+
subscription_terms=subscription_terms,
|
|
476
|
+
creation_state=creation_state,
|
|
477
|
+
billing_anchor=billing_anchor,
|
|
478
|
+
payment_terms=payment_terms,
|
|
479
|
+
external_id=external_id,
|
|
480
|
+
metadata=metadata,
|
|
553
481
|
request_options=request_options,
|
|
554
482
|
)
|
|
555
483
|
return _response.data
|
|
556
484
|
|
|
557
|
-
async def
|
|
485
|
+
async def get_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Order:
|
|
558
486
|
"""
|
|
487
|
+
Get an order by its ID
|
|
488
|
+
|
|
559
489
|
Parameters
|
|
560
490
|
----------
|
|
561
|
-
|
|
491
|
+
id : str
|
|
562
492
|
|
|
563
493
|
request_options : typing.Optional[RequestOptions]
|
|
564
494
|
Request-specific configuration.
|
|
@@ -566,7 +496,7 @@ class AsyncOrdersClient:
|
|
|
566
496
|
Returns
|
|
567
497
|
-------
|
|
568
498
|
Order
|
|
569
|
-
|
|
499
|
+
200
|
|
570
500
|
|
|
571
501
|
Examples
|
|
572
502
|
--------
|
|
@@ -580,108 +510,61 @@ class AsyncOrdersClient:
|
|
|
580
510
|
|
|
581
511
|
|
|
582
512
|
async def main() -> None:
|
|
583
|
-
await client.orders.
|
|
584
|
-
|
|
513
|
+
await client.orders.get_order(
|
|
514
|
+
id="id",
|
|
585
515
|
)
|
|
586
516
|
|
|
587
517
|
|
|
588
518
|
asyncio.run(main())
|
|
589
519
|
"""
|
|
590
|
-
_response = await self._raw_client.
|
|
520
|
+
_response = await self._raw_client.get_order(id, request_options=request_options)
|
|
591
521
|
return _response.data
|
|
592
522
|
|
|
593
|
-
async def
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
from paid import AsyncPaid
|
|
611
|
-
|
|
612
|
-
client = AsyncPaid(
|
|
613
|
-
token="YOUR_TOKEN",
|
|
614
|
-
)
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
async def main() -> None:
|
|
618
|
-
await client.orders.delete(
|
|
619
|
-
order_id="orderId",
|
|
620
|
-
)
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
asyncio.run(main())
|
|
523
|
+
async def update_order(
|
|
524
|
+
self,
|
|
525
|
+
id: str,
|
|
526
|
+
*,
|
|
527
|
+
name: typing.Optional[str] = OMIT,
|
|
528
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
529
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
530
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
531
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
532
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
533
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
534
|
+
external_id: typing.Optional[str] = OMIT,
|
|
535
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
536
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
537
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
538
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
539
|
+
) -> Order:
|
|
624
540
|
"""
|
|
625
|
-
|
|
626
|
-
return _response.data
|
|
541
|
+
Update an order by its ID
|
|
627
542
|
|
|
628
|
-
async def activate(self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Order:
|
|
629
|
-
"""
|
|
630
543
|
Parameters
|
|
631
544
|
----------
|
|
632
|
-
|
|
545
|
+
id : str
|
|
633
546
|
|
|
634
|
-
|
|
635
|
-
Request-specific configuration.
|
|
547
|
+
name : typing.Optional[str]
|
|
636
548
|
|
|
637
|
-
|
|
638
|
-
-------
|
|
639
|
-
Order
|
|
640
|
-
Success response
|
|
549
|
+
start_date : typing.Optional[dt.datetime]
|
|
641
550
|
|
|
642
|
-
|
|
643
|
-
--------
|
|
644
|
-
import asyncio
|
|
645
|
-
|
|
646
|
-
from paid import AsyncPaid
|
|
647
|
-
|
|
648
|
-
client = AsyncPaid(
|
|
649
|
-
token="YOUR_TOKEN",
|
|
650
|
-
)
|
|
551
|
+
end_date : typing.Optional[dt.datetime]
|
|
651
552
|
|
|
553
|
+
subscription_terms : typing.Optional[int]
|
|
652
554
|
|
|
653
|
-
|
|
654
|
-
await client.orders.activate(
|
|
655
|
-
order_id="orderId",
|
|
656
|
-
)
|
|
555
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
657
556
|
|
|
557
|
+
billing_anchor : typing.Optional[float]
|
|
658
558
|
|
|
659
|
-
|
|
660
|
-
"""
|
|
661
|
-
_response = await self._raw_client.activate(order_id, request_options=request_options)
|
|
662
|
-
return _response.data
|
|
559
|
+
payment_terms : typing.Optional[str]
|
|
663
560
|
|
|
664
|
-
|
|
665
|
-
self,
|
|
666
|
-
order_id: str,
|
|
667
|
-
*,
|
|
668
|
-
confirmation_token: str,
|
|
669
|
-
return_url: str,
|
|
670
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
671
|
-
) -> Order:
|
|
672
|
-
"""
|
|
673
|
-
Activates the order and processes the initial payment using the provided Stripe confirmation token.
|
|
561
|
+
external_id : typing.Optional[str]
|
|
674
562
|
|
|
675
|
-
|
|
676
|
-
----------
|
|
677
|
-
order_id : str
|
|
678
|
-
The order ID (can be internal ID or display ID)
|
|
563
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
679
564
|
|
|
680
|
-
|
|
681
|
-
Stripe confirmation token for the payment method
|
|
565
|
+
billing_customer_id : typing.Optional[str]
|
|
682
566
|
|
|
683
|
-
|
|
684
|
-
URL to redirect to after payment processing
|
|
567
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
685
568
|
|
|
686
569
|
request_options : typing.Optional[RequestOptions]
|
|
687
570
|
Request-specific configuration.
|
|
@@ -689,7 +572,7 @@ class AsyncOrdersClient:
|
|
|
689
572
|
Returns
|
|
690
573
|
-------
|
|
691
574
|
Order
|
|
692
|
-
|
|
575
|
+
200
|
|
693
576
|
|
|
694
577
|
Examples
|
|
695
578
|
--------
|
|
@@ -703,54 +586,49 @@ class AsyncOrdersClient:
|
|
|
703
586
|
|
|
704
587
|
|
|
705
588
|
async def main() -> None:
|
|
706
|
-
await client.orders.
|
|
707
|
-
|
|
708
|
-
confirmation_token="ctoken_1234567890",
|
|
709
|
-
return_url="https://example.com/payment-complete",
|
|
589
|
+
await client.orders.update_order(
|
|
590
|
+
id="id",
|
|
710
591
|
)
|
|
711
592
|
|
|
712
593
|
|
|
713
594
|
asyncio.run(main())
|
|
714
595
|
"""
|
|
715
|
-
_response = await self._raw_client.
|
|
716
|
-
|
|
596
|
+
_response = await self._raw_client.update_order(
|
|
597
|
+
id,
|
|
598
|
+
name=name,
|
|
599
|
+
start_date=start_date,
|
|
600
|
+
end_date=end_date,
|
|
601
|
+
subscription_terms=subscription_terms,
|
|
602
|
+
creation_state=creation_state,
|
|
603
|
+
billing_anchor=billing_anchor,
|
|
604
|
+
payment_terms=payment_terms,
|
|
605
|
+
external_id=external_id,
|
|
606
|
+
metadata=metadata,
|
|
607
|
+
billing_customer_id=billing_customer_id,
|
|
608
|
+
billing_contact_ids=billing_contact_ids,
|
|
609
|
+
request_options=request_options,
|
|
717
610
|
)
|
|
718
611
|
return _response.data
|
|
719
612
|
|
|
720
|
-
async def
|
|
721
|
-
self,
|
|
722
|
-
order_id: str,
|
|
723
|
-
*,
|
|
724
|
-
order_version: int,
|
|
725
|
-
cancel_from_date: dt.datetime,
|
|
726
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
727
|
-
) -> CancelRenewalResponse:
|
|
613
|
+
async def delete_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> EmptyResponse:
|
|
728
614
|
"""
|
|
729
|
-
|
|
615
|
+
Delete an order by its ID
|
|
730
616
|
|
|
731
617
|
Parameters
|
|
732
618
|
----------
|
|
733
|
-
|
|
734
|
-
The order ID (can be internal ID or display ID)
|
|
735
|
-
|
|
736
|
-
order_version : int
|
|
737
|
-
The current version of the order (for optimistic locking)
|
|
738
|
-
|
|
739
|
-
cancel_from_date : dt.datetime
|
|
740
|
-
The date from which the renewal should be cancelled (ISO 8601 format)
|
|
619
|
+
id : str
|
|
741
620
|
|
|
742
621
|
request_options : typing.Optional[RequestOptions]
|
|
743
622
|
Request-specific configuration.
|
|
744
623
|
|
|
745
624
|
Returns
|
|
746
625
|
-------
|
|
747
|
-
|
|
748
|
-
|
|
626
|
+
EmptyResponse
|
|
627
|
+
200
|
|
749
628
|
|
|
750
629
|
Examples
|
|
751
630
|
--------
|
|
752
631
|
import asyncio
|
|
753
|
-
import datetime
|
|
754
632
|
|
|
755
633
|
from paid import AsyncPaid
|
|
756
634
|
|
|
@@ -760,114 +638,42 @@ class AsyncOrdersClient:
|
|
|
760
638
|
|
|
761
639
|
|
|
762
640
|
async def main() -> None:
|
|
763
|
-
await client.orders.
|
|
764
|
-
|
|
765
|
-
order_version=1,
|
|
766
|
-
cancel_from_date=datetime.datetime.fromisoformat(
|
|
767
|
-
"2025-12-31 00:00:00+00:00",
|
|
768
|
-
),
|
|
641
|
+
await client.orders.delete_order(
|
|
642
|
+
id="id",
|
|
769
643
|
)
|
|
770
644
|
|
|
771
645
|
|
|
772
646
|
asyncio.run(main())
|
|
773
647
|
"""
|
|
774
|
-
_response = await self._raw_client.
|
|
775
|
-
order_id, order_version=order_version, cancel_from_date=cancel_from_date, request_options=request_options
|
|
776
|
-
)
|
|
648
|
+
_response = await self._raw_client.delete_order(id, request_options=request_options)
|
|
777
649
|
return _response.data
|
|
778
650
|
|
|
779
|
-
async def
|
|
651
|
+
async def get_order_lines(
|
|
780
652
|
self,
|
|
781
|
-
|
|
653
|
+
id: str,
|
|
782
654
|
*,
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
updated_order_line_attributes: typing.Sequence[ProrationAttributeUpdate],
|
|
655
|
+
limit: typing.Optional[int] = None,
|
|
656
|
+
offset: typing.Optional[int] = None,
|
|
786
657
|
request_options: typing.Optional[RequestOptions] = None,
|
|
787
|
-
) ->
|
|
658
|
+
) -> OrderLinesResponse:
|
|
788
659
|
"""
|
|
789
|
-
|
|
660
|
+
Get the order lines for an order by its ID
|
|
790
661
|
|
|
791
662
|
Parameters
|
|
792
663
|
----------
|
|
793
|
-
|
|
794
|
-
The order ID (can be internal ID or display ID)
|
|
795
|
-
|
|
796
|
-
order_version : int
|
|
797
|
-
The current version of the order (for optimistic locking)
|
|
664
|
+
id : str
|
|
798
665
|
|
|
799
|
-
|
|
800
|
-
The date when the plan change should take effect (ISO 8601 format)
|
|
666
|
+
limit : typing.Optional[int]
|
|
801
667
|
|
|
802
|
-
|
|
803
|
-
The list of order line attributes to update
|
|
668
|
+
offset : typing.Optional[int]
|
|
804
669
|
|
|
805
670
|
request_options : typing.Optional[RequestOptions]
|
|
806
671
|
Request-specific configuration.
|
|
807
672
|
|
|
808
673
|
Returns
|
|
809
674
|
-------
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
Examples
|
|
814
|
-
--------
|
|
815
|
-
import asyncio
|
|
816
|
-
import datetime
|
|
817
|
-
|
|
818
|
-
from paid import AsyncPaid, ProrationAttributeUpdate
|
|
819
|
-
|
|
820
|
-
client = AsyncPaid(
|
|
821
|
-
token="YOUR_TOKEN",
|
|
822
|
-
)
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
async def main() -> None:
|
|
826
|
-
await client.orders.schedule_plan_change(
|
|
827
|
-
order_id="orderId",
|
|
828
|
-
order_version=1,
|
|
829
|
-
effective_date=datetime.datetime.fromisoformat(
|
|
830
|
-
"2025-02-01 00:00:00+00:00",
|
|
831
|
-
),
|
|
832
|
-
updated_order_line_attributes=[
|
|
833
|
-
ProrationAttributeUpdate(
|
|
834
|
-
order_line_attribute_id="a1b2c3d4-5678-90ab-cdef-1234567890ab",
|
|
835
|
-
new_pricing={"unitPrice": 200, "currency": "USD"},
|
|
836
|
-
new_quantity=10.0,
|
|
837
|
-
)
|
|
838
|
-
],
|
|
839
|
-
)
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
asyncio.run(main())
|
|
843
|
-
"""
|
|
844
|
-
_response = await self._raw_client.schedule_plan_change(
|
|
845
|
-
order_id,
|
|
846
|
-
order_version=order_version,
|
|
847
|
-
effective_date=effective_date,
|
|
848
|
-
updated_order_line_attributes=updated_order_line_attributes,
|
|
849
|
-
request_options=request_options,
|
|
850
|
-
)
|
|
851
|
-
return _response.data
|
|
852
|
-
|
|
853
|
-
async def get_invoices(
|
|
854
|
-
self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
855
|
-
) -> typing.List[Invoice]:
|
|
856
|
-
"""
|
|
857
|
-
Retrieves all invoices associated with a specific order.
|
|
858
|
-
|
|
859
|
-
Parameters
|
|
860
|
-
----------
|
|
861
|
-
order_id : str
|
|
862
|
-
The order ID (can be internal ID or display ID)
|
|
863
|
-
|
|
864
|
-
request_options : typing.Optional[RequestOptions]
|
|
865
|
-
Request-specific configuration.
|
|
866
|
-
|
|
867
|
-
Returns
|
|
868
|
-
-------
|
|
869
|
-
typing.List[Invoice]
|
|
870
|
-
Success response
|
|
675
|
+
OrderLinesResponse
|
|
676
|
+
200
|
|
871
677
|
|
|
872
678
|
Examples
|
|
873
679
|
--------
|
|
@@ -881,12 +687,14 @@ class AsyncOrdersClient:
|
|
|
881
687
|
|
|
882
688
|
|
|
883
689
|
async def main() -> None:
|
|
884
|
-
await client.orders.
|
|
885
|
-
|
|
690
|
+
await client.orders.get_order_lines(
|
|
691
|
+
id="id",
|
|
886
692
|
)
|
|
887
693
|
|
|
888
694
|
|
|
889
695
|
asyncio.run(main())
|
|
890
696
|
"""
|
|
891
|
-
_response = await self._raw_client.
|
|
697
|
+
_response = await self._raw_client.get_order_lines(
|
|
698
|
+
id, limit=limit, offset=offset, request_options=request_options
|
|
699
|
+
)
|
|
892
700
|
return _response.data
|