checkout-intents 0.4.0__py3-none-any.whl → 0.6.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.4.0" # x-release-please-version
4
+ __version__ = "0.6.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,58 @@ 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
+ variant_selections: Iterable[VariantSelectionParam] | Omit = omit,
298
+ payment_method: PaymentMethodParam,
299
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
300
+ # The extra values given here take precedence over values defined on the client or passed to this method.
301
+ extra_headers: Headers | None = None,
302
+ extra_query: Query | None = None,
303
+ extra_body: Body | None = None,
304
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
305
+ ) -> CheckoutIntent:
306
+ """
307
+ Create a checkout intent and immediately trigger the purchase workflow.
308
+
309
+ This is a "fire-and-forget" endpoint that combines create + confirm in one step.
310
+ The workflow handles offer retrieval, payment authorization, and order placement
311
+ asynchronously. Poll the GET endpoint to check status.
312
+
313
+ Args:
314
+ extra_headers: Send extra headers
315
+
316
+ extra_query: Add additional query parameters to the request
317
+
318
+ extra_body: Add additional JSON properties to the request
319
+
320
+ timeout: Override the client-level default timeout for this request, in seconds
321
+ """
322
+ return cast(
323
+ CheckoutIntent,
324
+ self._post(
325
+ f"/api/v1/checkout-intents/purchase",
326
+ body=maybe_transform(
327
+ {
328
+ "buyer": buyer,
329
+ "payment_method": payment_method,
330
+ "product_url": product_url,
331
+ "quantity": quantity,
332
+ "variant_selections": variant_selections,
333
+ },
334
+ checkout_intent_purchase_params.CheckoutIntentPurchaseParams
335
+ ),
336
+ options=make_request_options(
337
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
338
+ ),
339
+ cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
340
+ ),
341
+ )
342
+
290
343
  def _poll_until(
291
344
  self,
292
345
  id: str,
@@ -890,6 +943,58 @@ class AsyncCheckoutIntentsResource(AsyncAPIResource):
890
943
  ),
891
944
  )
892
945
 
946
+ async def purchase(
947
+ self,
948
+ *,
949
+ buyer: BuyerParam,
950
+ product_url: str,
951
+ quantity: float,
952
+ variant_selections: Iterable[VariantSelectionParam] | Omit = omit,
953
+ payment_method: PaymentMethodParam,
954
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
955
+ # The extra values given here take precedence over values defined on the client or passed to this method.
956
+ extra_headers: Headers | None = None,
957
+ extra_query: Query | None = None,
958
+ extra_body: Body | None = None,
959
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
960
+ ) -> CheckoutIntent:
961
+ """
962
+ Create a checkout intent and immediately trigger the purchase workflow.
963
+
964
+ This is a "fire-and-forget" endpoint that combines create + confirm in one step.
965
+ The workflow handles offer retrieval, payment authorization, and order placement
966
+ asynchronously. Poll the GET endpoint to check status.
967
+
968
+ Args:
969
+ extra_headers: Send extra headers
970
+
971
+ extra_query: Add additional query parameters to the request
972
+
973
+ extra_body: Add additional JSON properties to the request
974
+
975
+ timeout: Override the client-level default timeout for this request, in seconds
976
+ """
977
+ return cast(
978
+ CheckoutIntent,
979
+ await self._post(
980
+ f"/api/v1/checkout-intents/purchase",
981
+ body=await async_maybe_transform(
982
+ {
983
+ "buyer": buyer,
984
+ "payment_method": payment_method,
985
+ "product_url": product_url,
986
+ "quantity": quantity,
987
+ "variant_selections": variant_selections,
988
+ },
989
+ checkout_intent_purchase_params.CheckoutIntentPurchaseParams
990
+ ),
991
+ options=make_request_options(
992
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
993
+ ),
994
+ cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
995
+ ),
996
+ )
997
+
893
998
  async def _poll_until(
894
999
  self,
895
1000
  id: str,
@@ -1250,6 +1355,7 @@ class AsyncCheckoutIntentsResource(AsyncAPIResource):
1250
1355
  )
1251
1356
 
1252
1357
 
1358
+
1253
1359
  class CheckoutIntentsResourceWithRawResponse:
1254
1360
  def __init__(self, checkout_intents: CheckoutIntentsResource) -> None:
1255
1361
  self._checkout_intents = checkout_intents
@@ -1269,6 +1375,9 @@ class CheckoutIntentsResourceWithRawResponse:
1269
1375
  self.confirm = to_raw_response_wrapper(
1270
1376
  checkout_intents.confirm,
1271
1377
  )
1378
+ self.purchase = to_raw_response_wrapper(
1379
+ checkout_intents.purchase,
1380
+ )
1272
1381
  self.poll_until_completed = to_raw_response_wrapper(
1273
1382
  checkout_intents.poll_until_completed,
1274
1383
  )
@@ -1283,6 +1392,7 @@ class CheckoutIntentsResourceWithRawResponse:
1283
1392
  )
1284
1393
 
1285
1394
 
1395
+
1286
1396
  class AsyncCheckoutIntentsResourceWithRawResponse:
1287
1397
  def __init__(self, checkout_intents: AsyncCheckoutIntentsResource) -> None:
1288
1398
  self._checkout_intents = checkout_intents
@@ -1302,6 +1412,9 @@ class AsyncCheckoutIntentsResourceWithRawResponse:
1302
1412
  self.confirm = async_to_raw_response_wrapper(
1303
1413
  checkout_intents.confirm,
1304
1414
  )
1415
+ self.purchase = async_to_raw_response_wrapper(
1416
+ checkout_intents.purchase,
1417
+ )
1305
1418
  self.poll_until_completed = async_to_raw_response_wrapper(
1306
1419
  checkout_intents.poll_until_completed,
1307
1420
  )
@@ -1316,6 +1429,7 @@ class AsyncCheckoutIntentsResourceWithRawResponse:
1316
1429
  )
1317
1430
 
1318
1431
 
1432
+
1319
1433
  class CheckoutIntentsResourceWithStreamingResponse:
1320
1434
  def __init__(self, checkout_intents: CheckoutIntentsResource) -> None:
1321
1435
  self._checkout_intents = checkout_intents
@@ -1335,6 +1449,9 @@ class CheckoutIntentsResourceWithStreamingResponse:
1335
1449
  self.confirm = to_streamed_response_wrapper(
1336
1450
  checkout_intents.confirm,
1337
1451
  )
1452
+ self.purchase = to_streamed_response_wrapper(
1453
+ checkout_intents.purchase,
1454
+ )
1338
1455
  self.poll_until_completed = to_streamed_response_wrapper(
1339
1456
  checkout_intents.poll_until_completed,
1340
1457
  )
@@ -1349,6 +1466,7 @@ class CheckoutIntentsResourceWithStreamingResponse:
1349
1466
  )
1350
1467
 
1351
1468
 
1469
+
1352
1470
  class AsyncCheckoutIntentsResourceWithStreamingResponse:
1353
1471
  def __init__(self, checkout_intents: AsyncCheckoutIntentsResource) -> None:
1354
1472
  self._checkout_intents = checkout_intents
@@ -1368,6 +1486,9 @@ class AsyncCheckoutIntentsResourceWithStreamingResponse:
1368
1486
  self.confirm = async_to_streamed_response_wrapper(
1369
1487
  checkout_intents.confirm,
1370
1488
  )
1489
+ self.purchase = async_to_streamed_response_wrapper(
1490
+ checkout_intents.purchase,
1491
+ )
1371
1492
  self.poll_until_completed = async_to_streamed_response_wrapper(
1372
1493
  checkout_intents.poll_until_completed,
1373
1494
  )
@@ -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,25 @@
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 .._utils import PropertyInfo
9
+ from .buyer_param import BuyerParam
10
+ from .payment_method_param import PaymentMethodParam
11
+ from .variant_selection_param import VariantSelectionParam
12
+
13
+ __all__ = ["CheckoutIntentPurchaseParams"]
14
+
15
+
16
+ class CheckoutIntentPurchaseParams(TypedDict, total=False):
17
+ buyer: Required[BuyerParam]
18
+
19
+ payment_method: Required[Annotated[PaymentMethodParam, PropertyInfo(alias="paymentMethod")]]
20
+
21
+ product_url: Required[Annotated[str, PropertyInfo(alias="productUrl")]]
22
+
23
+ quantity: Required[float]
24
+
25
+ variant_selections: Annotated[Iterable[VariantSelectionParam], PropertyInfo(alias="variantSelections")]
@@ -42,3 +42,5 @@ class Offer(BaseModel):
42
42
  cost: Cost
43
43
 
44
44
  shipping: Shipping
45
+
46
+ applied_promo_codes: Optional[List[str]] = FieldInfo(alias="appliedPromoCodes", default=None)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: checkout-intents
3
- Version: 0.4.0
3
+ Version: 0.6.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=q5x-gNLeFmdAlSifoTUgwwFsiIX-72k110WhIro20ko,168
14
+ checkout_intents/_version.py,sha256=966amIo052GT-pzkFrAnbNSvKYeP2QLWrFSs8_y1uhQ,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=Rsn0VNlKXziZAdU0BZ_-H8pxh2q4-f_Z24dP_N7wlVk,59540
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=PzDCzbKExNzkYR5eWpTs-p0x9OJPgCroDTgv60XV0Co,848
43
44
  checkout_intents/types/money.py,sha256=-AfFFrfnUy6cAaFykF_gWZQxDGlzA1r_dJzJZRxhUto,328
44
- checkout_intents/types/offer.py,sha256=gtjQtU0w7m3jVwtykNaFxkYD4s_3Z2son1c0I_XRSVg,886
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.4.0.dist-info/METADATA,sha256=mtCjHkGVvNhRvcqnkHFRvUD8NzhW2UaSUXmSDJnPfE8,23781
50
- checkout_intents-0.4.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
51
- checkout_intents-0.4.0.dist-info/licenses/LICENSE,sha256=dRDmL6lFnLaphTaman8kAc21qY1IQ_qsAETk1F-b6jY,1056
52
- checkout_intents-0.4.0.dist-info/RECORD,,
50
+ checkout_intents-0.6.0.dist-info/METADATA,sha256=E8QgfXK6c2_9ZDcPlgqJ7LH5fs-no-JvRgA3QM55atc,23781
51
+ checkout_intents-0.6.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
52
+ checkout_intents-0.6.0.dist-info/licenses/LICENSE,sha256=dRDmL6lFnLaphTaman8kAc21qY1IQ_qsAETk1F-b6jY,1056
53
+ checkout_intents-0.6.0.dist-info/RECORD,,