checkout-intents 0.5.0__py3-none-any.whl → 0.7.0__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.
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "checkout_intents"
4
- __version__ = "0.5.0" # x-release-please-version
4
+ __version__ = "0.7.0" # x-release-please-version
@@ -12,6 +12,7 @@ from ..types import (
12
12
  checkout_intent_list_params,
13
13
  checkout_intent_create_params,
14
14
  checkout_intent_confirm_params,
15
+ checkout_intent_purchase_params,
15
16
  checkout_intent_add_payment_params,
16
17
  )
17
18
  from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
@@ -287,6 +288,60 @@ class CheckoutIntentsResource(SyncAPIResource):
287
288
  ),
288
289
  )
289
290
 
291
+ def purchase(
292
+ self,
293
+ *,
294
+ buyer: BuyerParam,
295
+ product_url: str,
296
+ quantity: float,
297
+ promo_codes: SequenceNotStr[str] | Omit = omit,
298
+ variant_selections: Iterable[VariantSelectionParam] | Omit = omit,
299
+ payment_method: PaymentMethodParam,
300
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
301
+ # The extra values given here take precedence over values defined on the client or passed to this method.
302
+ extra_headers: Headers | None = None,
303
+ extra_query: Query | None = None,
304
+ extra_body: Body | None = None,
305
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
306
+ ) -> CheckoutIntent:
307
+ """
308
+ Create a checkout intent and immediately trigger the purchase workflow.
309
+
310
+ This is a "fire-and-forget" endpoint that combines create + confirm in one step.
311
+ The workflow handles offer retrieval, payment authorization, and order placement
312
+ asynchronously. Poll the GET endpoint to check status.
313
+
314
+ Args:
315
+ extra_headers: Send extra headers
316
+
317
+ extra_query: Add additional query parameters to the request
318
+
319
+ extra_body: Add additional JSON properties to the request
320
+
321
+ timeout: Override the client-level default timeout for this request, in seconds
322
+ """
323
+ return cast(
324
+ CheckoutIntent,
325
+ self._post(
326
+ f"/api/v1/checkout-intents/purchase",
327
+ body=maybe_transform(
328
+ {
329
+ "buyer": buyer,
330
+ "payment_method": payment_method,
331
+ "product_url": product_url,
332
+ "quantity": quantity,
333
+ "promo_codes": promo_codes,
334
+ "variant_selections": variant_selections,
335
+ },
336
+ checkout_intent_purchase_params.CheckoutIntentPurchaseParams
337
+ ),
338
+ options=make_request_options(
339
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
340
+ ),
341
+ cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
342
+ ),
343
+ )
344
+
290
345
  def _poll_until(
291
346
  self,
292
347
  id: str,
@@ -890,6 +945,60 @@ class AsyncCheckoutIntentsResource(AsyncAPIResource):
890
945
  ),
891
946
  )
892
947
 
948
+ async def purchase(
949
+ self,
950
+ *,
951
+ buyer: BuyerParam,
952
+ product_url: str,
953
+ quantity: float,
954
+ promo_codes: SequenceNotStr[str] | Omit = omit,
955
+ variant_selections: Iterable[VariantSelectionParam] | Omit = omit,
956
+ payment_method: PaymentMethodParam,
957
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
958
+ # The extra values given here take precedence over values defined on the client or passed to this method.
959
+ extra_headers: Headers | None = None,
960
+ extra_query: Query | None = None,
961
+ extra_body: Body | None = None,
962
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
963
+ ) -> CheckoutIntent:
964
+ """
965
+ Create a checkout intent and immediately trigger the purchase workflow.
966
+
967
+ This is a "fire-and-forget" endpoint that combines create + confirm in one step.
968
+ The workflow handles offer retrieval, payment authorization, and order placement
969
+ asynchronously. Poll the GET endpoint to check status.
970
+
971
+ Args:
972
+ extra_headers: Send extra headers
973
+
974
+ extra_query: Add additional query parameters to the request
975
+
976
+ extra_body: Add additional JSON properties to the request
977
+
978
+ timeout: Override the client-level default timeout for this request, in seconds
979
+ """
980
+ return cast(
981
+ CheckoutIntent,
982
+ await self._post(
983
+ f"/api/v1/checkout-intents/purchase",
984
+ body=await async_maybe_transform(
985
+ {
986
+ "buyer": buyer,
987
+ "payment_method": payment_method,
988
+ "product_url": product_url,
989
+ "quantity": quantity,
990
+ "promo_codes": promo_codes,
991
+ "variant_selections": variant_selections,
992
+ },
993
+ checkout_intent_purchase_params.CheckoutIntentPurchaseParams
994
+ ),
995
+ options=make_request_options(
996
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
997
+ ),
998
+ cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
999
+ ),
1000
+ )
1001
+
893
1002
  async def _poll_until(
894
1003
  self,
895
1004
  id: str,
@@ -1250,6 +1359,7 @@ class AsyncCheckoutIntentsResource(AsyncAPIResource):
1250
1359
  )
1251
1360
 
1252
1361
 
1362
+
1253
1363
  class CheckoutIntentsResourceWithRawResponse:
1254
1364
  def __init__(self, checkout_intents: CheckoutIntentsResource) -> None:
1255
1365
  self._checkout_intents = checkout_intents
@@ -1269,6 +1379,9 @@ class CheckoutIntentsResourceWithRawResponse:
1269
1379
  self.confirm = to_raw_response_wrapper(
1270
1380
  checkout_intents.confirm,
1271
1381
  )
1382
+ self.purchase = to_raw_response_wrapper(
1383
+ checkout_intents.purchase,
1384
+ )
1272
1385
  self.poll_until_completed = to_raw_response_wrapper(
1273
1386
  checkout_intents.poll_until_completed,
1274
1387
  )
@@ -1283,6 +1396,7 @@ class CheckoutIntentsResourceWithRawResponse:
1283
1396
  )
1284
1397
 
1285
1398
 
1399
+
1286
1400
  class AsyncCheckoutIntentsResourceWithRawResponse:
1287
1401
  def __init__(self, checkout_intents: AsyncCheckoutIntentsResource) -> None:
1288
1402
  self._checkout_intents = checkout_intents
@@ -1302,6 +1416,9 @@ class AsyncCheckoutIntentsResourceWithRawResponse:
1302
1416
  self.confirm = async_to_raw_response_wrapper(
1303
1417
  checkout_intents.confirm,
1304
1418
  )
1419
+ self.purchase = async_to_raw_response_wrapper(
1420
+ checkout_intents.purchase,
1421
+ )
1305
1422
  self.poll_until_completed = async_to_raw_response_wrapper(
1306
1423
  checkout_intents.poll_until_completed,
1307
1424
  )
@@ -1316,6 +1433,7 @@ class AsyncCheckoutIntentsResourceWithRawResponse:
1316
1433
  )
1317
1434
 
1318
1435
 
1436
+
1319
1437
  class CheckoutIntentsResourceWithStreamingResponse:
1320
1438
  def __init__(self, checkout_intents: CheckoutIntentsResource) -> None:
1321
1439
  self._checkout_intents = checkout_intents
@@ -1335,6 +1453,9 @@ class CheckoutIntentsResourceWithStreamingResponse:
1335
1453
  self.confirm = to_streamed_response_wrapper(
1336
1454
  checkout_intents.confirm,
1337
1455
  )
1456
+ self.purchase = to_streamed_response_wrapper(
1457
+ checkout_intents.purchase,
1458
+ )
1338
1459
  self.poll_until_completed = to_streamed_response_wrapper(
1339
1460
  checkout_intents.poll_until_completed,
1340
1461
  )
@@ -1349,6 +1470,7 @@ class CheckoutIntentsResourceWithStreamingResponse:
1349
1470
  )
1350
1471
 
1351
1472
 
1473
+
1352
1474
  class AsyncCheckoutIntentsResourceWithStreamingResponse:
1353
1475
  def __init__(self, checkout_intents: AsyncCheckoutIntentsResource) -> None:
1354
1476
  self._checkout_intents = checkout_intents
@@ -1368,6 +1490,9 @@ class AsyncCheckoutIntentsResourceWithStreamingResponse:
1368
1490
  self.confirm = async_to_streamed_response_wrapper(
1369
1491
  checkout_intents.confirm,
1370
1492
  )
1493
+ self.purchase = async_to_streamed_response_wrapper(
1494
+ checkout_intents.purchase,
1495
+ )
1371
1496
  self.poll_until_completed = async_to_streamed_response_wrapper(
1372
1497
  checkout_intents.poll_until_completed,
1373
1498
  )
@@ -16,4 +16,5 @@ from .variant_selection_param import VariantSelectionParam as VariantSelectionPa
16
16
  from .checkout_intent_list_params import CheckoutIntentListParams as CheckoutIntentListParams
17
17
  from .checkout_intent_create_params import CheckoutIntentCreateParams as CheckoutIntentCreateParams
18
18
  from .checkout_intent_confirm_params import CheckoutIntentConfirmParams as CheckoutIntentConfirmParams
19
+ from .checkout_intent_purchase_params import CheckoutIntentPurchaseParams as CheckoutIntentPurchaseParams
19
20
  from .checkout_intent_add_payment_params import CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams
@@ -0,0 +1,28 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Iterable
6
+ from typing_extensions import Required, Annotated, TypedDict
7
+
8
+ from .._types import SequenceNotStr
9
+ from .._utils import PropertyInfo
10
+ from .buyer_param import BuyerParam
11
+ from .payment_method_param import PaymentMethodParam
12
+ from .variant_selection_param import VariantSelectionParam
13
+
14
+ __all__ = ["CheckoutIntentPurchaseParams"]
15
+
16
+
17
+ class CheckoutIntentPurchaseParams(TypedDict, total=False):
18
+ buyer: Required[BuyerParam]
19
+
20
+ payment_method: Required[Annotated[PaymentMethodParam, PropertyInfo(alias="paymentMethod")]]
21
+
22
+ product_url: Required[Annotated[str, PropertyInfo(alias="productUrl")]]
23
+
24
+ quantity: Required[float]
25
+
26
+ promo_codes: Annotated[SequenceNotStr[str], PropertyInfo(alias="promoCodes")]
27
+
28
+ variant_selections: Annotated[Iterable[VariantSelectionParam], PropertyInfo(alias="variantSelections")]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: checkout-intents
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Summary: The official Python library for the Checkout Intents API
5
5
  Project-URL: Homepage, https://github.com/rye-com/checkout-intents-python
6
6
  Project-URL: Repository, https://github.com/rye-com/checkout-intents-python
@@ -11,7 +11,7 @@ checkout_intents/_resource.py,sha256=X-eWffEBAgzTZvakLqNUjwgidMKfBFRmCeeOiuko4lg
11
11
  checkout_intents/_response.py,sha256=sLqxWBxzmVqPsdr2x5z6d87h8jb1U-Huvh2YFg-U6nE,28876
12
12
  checkout_intents/_streaming.py,sha256=y8SjBVAw2SDdVczQsP1T3dufnx4040C5fQqz-jGSvmg,10257
13
13
  checkout_intents/_types.py,sha256=PTRxqWPBW57h6JvfwcVuR42gIMpY4nwSZbqAtv85Ado,7305
14
- checkout_intents/_version.py,sha256=lNq9CWqtbgWtcVLskIHcQVeSNUi9VHJGSc1lGlfA1rc,168
14
+ checkout_intents/_version.py,sha256=5VUKZFNomyYEg-QEVbUYW_VqH4_Uo6ZBsPyAuMjG_4c,168
15
15
  checkout_intents/pagination.py,sha256=VMe3ftq-qqAku2ERRTOz7iZOoMQ_KKp2HIUl_I8oAXE,2908
16
16
  checkout_intents/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  checkout_intents/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
@@ -29,8 +29,8 @@ checkout_intents/_utils/_utils.py,sha256=g9ftElB09kVT6EVfCIlD_nUfANhDX5_vZO61FDW
29
29
  checkout_intents/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
30
30
  checkout_intents/resources/__init__.py,sha256=sHRW0nwo1GnFBFPoTNohkEbvOk7au-R3MdfVn_yb8Ds,1120
31
31
  checkout_intents/resources/brands.py,sha256=jJ5Jn2GG3MPkdKSg6_OG89dSQTaSGM9e7lBtovn-ABE,6389
32
- checkout_intents/resources/checkout_intents.py,sha256=yK_dauwDI6rqHU187FqLQyU9yrdUwJD6Ziubs_keVFU,54591
33
- checkout_intents/types/__init__.py,sha256=bcfwLNTB5CbPquNwxpMRoJkL5LM6HckISeGRPlVX2js,1192
32
+ checkout_intents/resources/checkout_intents.py,sha256=AkV2MsOPINapNgVJQiArVP8qTCAosbB1jlkknCRoIQ0,59756
33
+ checkout_intents/types/__init__.py,sha256=VhZDCRhKlUnKs1h-8UNWj0HUUtJBjHFo16Stxy_kgS4,1298
34
34
  checkout_intents/types/base_checkout_intent.py,sha256=i31jUBw1fFlFQI4pUxLhiHAM82k3dDWiK3puTlKO5VE,728
35
35
  checkout_intents/types/brand_retrieve_response.py,sha256=c8DCAJvHFHcrIOW6onHj5Y51Yba7zyOrRXZuGfqYkBc,561
36
36
  checkout_intents/types/buyer.py,sha256=Ov6mVD-Hjm9A-i9p2dWCXtniLhYpG_6jvy9DReC54YQ,530
@@ -40,13 +40,14 @@ checkout_intents/types/checkout_intent_add_payment_params.py,sha256=s8KKWVM3Xain
40
40
  checkout_intents/types/checkout_intent_confirm_params.py,sha256=v_fcmuH5GoEwUJLbV7N9BDti63dg8z1nmhpcr4-1qcs,473
41
41
  checkout_intents/types/checkout_intent_create_params.py,sha256=DEfM_bAsMijLAtGTZpC0RjnwvJc3rQDd_H9jEgjFc28,812
42
42
  checkout_intents/types/checkout_intent_list_params.py,sha256=zc8_xwBHChOcl7bTMSjU7ZbHKIyQGYeUy5UrxeloJj0,521
43
+ checkout_intents/types/checkout_intent_purchase_params.py,sha256=aQ2mYStqnWiSR7BXKbWZ6dEPXD8fBDwhhBssh-d6ado,967
43
44
  checkout_intents/types/money.py,sha256=-AfFFrfnUy6cAaFykF_gWZQxDGlzA1r_dJzJZRxhUto,328
44
45
  checkout_intents/types/offer.py,sha256=9nGYAlA3tEiRU9lvsktnVl6EWj5dLNr6K9LB8WprckI,985
45
46
  checkout_intents/types/payment_method.py,sha256=-v5-L5RPojm8IDrdAhIMGmhVb89vwqT1jhgb-ZWOG7Q,1069
46
47
  checkout_intents/types/payment_method_param.py,sha256=_yzwZ5nw7bStK4U2-1ybtpjdJz5funCOMN7MALtF0xk,1225
47
48
  checkout_intents/types/variant_selection.py,sha256=y6mlU-qGwDfE77mU-x1GTXkDsmn6vuPpy5lBYXqXCBw,259
48
49
  checkout_intents/types/variant_selection_param.py,sha256=ahwTmDVIUMV8jvpggEo2jDUTIm9xvXbntDxmIZqT2_k,355
49
- checkout_intents-0.5.0.dist-info/METADATA,sha256=evcdBdUrRiPpo0qLCh0fswauwB5RoVssm-LZ3uYG06A,23781
50
- checkout_intents-0.5.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
51
- checkout_intents-0.5.0.dist-info/licenses/LICENSE,sha256=dRDmL6lFnLaphTaman8kAc21qY1IQ_qsAETk1F-b6jY,1056
52
- checkout_intents-0.5.0.dist-info/RECORD,,
50
+ checkout_intents-0.7.0.dist-info/METADATA,sha256=821Ib8V0YkpJFBHUAmb-tZAWV4HIgOEhnuzhAwGo52s,23781
51
+ checkout_intents-0.7.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
52
+ checkout_intents-0.7.0.dist-info/licenses/LICENSE,sha256=dRDmL6lFnLaphTaman8kAc21qY1IQ_qsAETk1F-b6jY,1056
53
+ checkout_intents-0.7.0.dist-info/RECORD,,