dodopayments 1.49.0__py3-none-any.whl → 1.51.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.
Potentially problematic release.
This version of dodopayments might be problematic. Click here for more details.
- dodopayments/_client.py +15 -11
- dodopayments/_version.py +1 -1
- dodopayments/resources/__init__.py +13 -13
- dodopayments/resources/checkout_sessions.py +272 -0
- dodopayments/resources/subscriptions.py +7 -2
- dodopayments/resources/webhooks/webhooks.py +19 -22
- dodopayments/types/__init__.py +4 -13
- dodopayments/types/checkout_session_create_params.py +174 -0
- dodopayments/types/checkout_session_response.py +13 -0
- dodopayments/types/on_demand_subscription_param.py +44 -0
- dodopayments/types/subscription.py +3 -0
- dodopayments/types/subscription_create_params.py +3 -36
- dodopayments/types/subscription_update_params.py +1 -0
- dodopayments/types/{webhook_list_response.py → webhook_details.py} +2 -2
- {dodopayments-1.49.0.dist-info → dodopayments-1.51.0.dist-info}/METADATA +17 -90
- {dodopayments-1.49.0.dist-info → dodopayments-1.51.0.dist-info}/RECORD +18 -27
- dodopayments/resources/your_webhook_url.py +0 -224
- dodopayments/types/addon_cart_response_item_param.py +0 -13
- dodopayments/types/customer_limited_details_param.py +0 -18
- dodopayments/types/dispute_param.py +0 -45
- dodopayments/types/get_dispute_param.py +0 -52
- dodopayments/types/license_key_param.py +0 -53
- dodopayments/types/payment_param.py +0 -131
- dodopayments/types/refund_param.py +0 -42
- dodopayments/types/subscription_param.py +0 -97
- dodopayments/types/webhook_create_response.py +0 -42
- dodopayments/types/webhook_retrieve_response.py +0 -42
- dodopayments/types/webhook_update_response.py +0 -42
- dodopayments/types/your_webhook_url_create_params.py +0 -66
- {dodopayments-1.49.0.dist-info → dodopayments-1.51.0.dist-info}/WHEEL +0 -0
- {dodopayments-1.49.0.dist-info → dodopayments-1.51.0.dist-info}/licenses/LICENSE +0 -0
dodopayments/types/__init__.py
CHANGED
|
@@ -15,28 +15,23 @@ from .get_dispute import GetDispute as GetDispute
|
|
|
15
15
|
from .license_key import LicenseKey as LicenseKey
|
|
16
16
|
from .price_param import PriceParam as PriceParam
|
|
17
17
|
from .country_code import CountryCode as CountryCode
|
|
18
|
-
from .refund_param import RefundParam as RefundParam
|
|
19
18
|
from .subscription import Subscription as Subscription
|
|
20
19
|
from .tax_category import TaxCategory as TaxCategory
|
|
21
20
|
from .discount_type import DiscountType as DiscountType
|
|
22
|
-
from .dispute_param import DisputeParam as DisputeParam
|
|
23
21
|
from .dispute_stage import DisputeStage as DisputeStage
|
|
24
22
|
from .intent_status import IntentStatus as IntentStatus
|
|
25
|
-
from .payment_param import PaymentParam as PaymentParam
|
|
26
23
|
from .refund_status import RefundStatus as RefundStatus
|
|
27
24
|
from .time_interval import TimeInterval as TimeInterval
|
|
28
25
|
from .addon_response import AddonResponse as AddonResponse
|
|
29
26
|
from .dispute_status import DisputeStatus as DisputeStatus
|
|
30
27
|
from .billing_address import BillingAddress as BillingAddress
|
|
28
|
+
from .webhook_details import WebhookDetails as WebhookDetails
|
|
31
29
|
from .addon_list_params import AddonListParams as AddonListParams
|
|
32
|
-
from .get_dispute_param import GetDisputeParam as GetDisputeParam
|
|
33
|
-
from .license_key_param import LicenseKeyParam as LicenseKeyParam
|
|
34
30
|
from .attach_addon_param import AttachAddonParam as AttachAddonParam
|
|
35
31
|
from .license_key_status import LicenseKeyStatus as LicenseKeyStatus
|
|
36
32
|
from .new_customer_param import NewCustomerParam as NewCustomerParam
|
|
37
33
|
from .payout_list_params import PayoutListParams as PayoutListParams
|
|
38
34
|
from .refund_list_params import RefundListParams as RefundListParams
|
|
39
|
-
from .subscription_param import SubscriptionParam as SubscriptionParam
|
|
40
35
|
from .webhook_event_type import WebhookEventType as WebhookEventType
|
|
41
36
|
from .addon_create_params import AddonCreateParams as AddonCreateParams
|
|
42
37
|
from .addon_update_params import AddonUpdateParams as AddonUpdateParams
|
|
@@ -63,7 +58,6 @@ from .product_create_params import ProductCreateParams as ProductCreateParams
|
|
|
63
58
|
from .product_list_response import ProductListResponse as ProductListResponse
|
|
64
59
|
from .product_update_params import ProductUpdateParams as ProductUpdateParams
|
|
65
60
|
from .webhook_create_params import WebhookCreateParams as WebhookCreateParams
|
|
66
|
-
from .webhook_list_response import WebhookListResponse as WebhookListResponse
|
|
67
61
|
from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams
|
|
68
62
|
from .customer_create_params import CustomerCreateParams as CustomerCreateParams
|
|
69
63
|
from .customer_request_param import CustomerRequestParam as CustomerRequestParam
|
|
@@ -75,15 +69,13 @@ from .license_activate_params import LicenseActivateParams as LicenseActivatePar
|
|
|
75
69
|
from .license_key_list_params import LicenseKeyListParams as LicenseKeyListParams
|
|
76
70
|
from .license_validate_params import LicenseValidateParams as LicenseValidateParams
|
|
77
71
|
from .payment_create_response import PaymentCreateResponse as PaymentCreateResponse
|
|
78
|
-
from .webhook_create_response import WebhookCreateResponse as WebhookCreateResponse
|
|
79
|
-
from .webhook_update_response import WebhookUpdateResponse as WebhookUpdateResponse
|
|
80
72
|
from .addon_cart_response_item import AddonCartResponseItem as AddonCartResponseItem
|
|
81
73
|
from .customer_limited_details import CustomerLimitedDetails as CustomerLimitedDetails
|
|
82
74
|
from .subscription_list_params import SubscriptionListParams as SubscriptionListParams
|
|
75
|
+
from .checkout_session_response import CheckoutSessionResponse as CheckoutSessionResponse
|
|
83
76
|
from .license_deactivate_params import LicenseDeactivateParams as LicenseDeactivateParams
|
|
84
77
|
from .license_key_update_params import LicenseKeyUpdateParams as LicenseKeyUpdateParams
|
|
85
78
|
from .license_validate_response import LicenseValidateResponse as LicenseValidateResponse
|
|
86
|
-
from .webhook_retrieve_response import WebhookRetrieveResponse as WebhookRetrieveResponse
|
|
87
79
|
from .license_key_duration_param import LicenseKeyDurationParam as LicenseKeyDurationParam
|
|
88
80
|
from .one_time_product_cart_item import OneTimeProductCartItem as OneTimeProductCartItem
|
|
89
81
|
from .subscription_charge_params import SubscriptionChargeParams as SubscriptionChargeParams
|
|
@@ -93,13 +85,12 @@ from .subscription_update_params import SubscriptionUpdateParams as Subscription
|
|
|
93
85
|
from .product_update_files_params import ProductUpdateFilesParams as ProductUpdateFilesParams
|
|
94
86
|
from .addon_update_images_response import AddonUpdateImagesResponse as AddonUpdateImagesResponse
|
|
95
87
|
from .brand_update_images_response import BrandUpdateImagesResponse as BrandUpdateImagesResponse
|
|
88
|
+
from .on_demand_subscription_param import OnDemandSubscriptionParam as OnDemandSubscriptionParam
|
|
96
89
|
from .subscription_charge_response import SubscriptionChargeResponse as SubscriptionChargeResponse
|
|
97
90
|
from .subscription_create_response import SubscriptionCreateResponse as SubscriptionCreateResponse
|
|
98
91
|
from .product_update_files_response import ProductUpdateFilesResponse as ProductUpdateFilesResponse
|
|
99
|
-
from .addon_cart_response_item_param import AddonCartResponseItemParam as AddonCartResponseItemParam
|
|
100
92
|
from .attach_existing_customer_param import AttachExistingCustomerParam as AttachExistingCustomerParam
|
|
101
|
-
from .
|
|
102
|
-
from .your_webhook_url_create_params import YourWebhookURLCreateParams as YourWebhookURLCreateParams
|
|
93
|
+
from .checkout_session_create_params import CheckoutSessionCreateParams as CheckoutSessionCreateParams
|
|
103
94
|
from .subscription_change_plan_params import SubscriptionChangePlanParams as SubscriptionChangePlanParams
|
|
104
95
|
from .license_key_instance_list_params import LicenseKeyInstanceListParams as LicenseKeyInstanceListParams
|
|
105
96
|
from .one_time_product_cart_item_param import OneTimeProductCartItemParam as OneTimeProductCartItemParam
|
|
@@ -0,0 +1,174 @@
|
|
|
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 Dict, List, Iterable, Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
from .currency import Currency
|
|
9
|
+
from .country_code import CountryCode
|
|
10
|
+
from .attach_addon_param import AttachAddonParam
|
|
11
|
+
from .payment_method_types import PaymentMethodTypes
|
|
12
|
+
from .customer_request_param import CustomerRequestParam
|
|
13
|
+
from .on_demand_subscription_param import OnDemandSubscriptionParam
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"CheckoutSessionCreateParams",
|
|
17
|
+
"ProductCart",
|
|
18
|
+
"BillingAddress",
|
|
19
|
+
"Customization",
|
|
20
|
+
"FeatureFlags",
|
|
21
|
+
"SubscriptionData",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CheckoutSessionCreateParams(TypedDict, total=False):
|
|
26
|
+
product_cart: Required[Iterable[ProductCart]]
|
|
27
|
+
|
|
28
|
+
allowed_payment_method_types: Optional[List[PaymentMethodTypes]]
|
|
29
|
+
"""
|
|
30
|
+
Customers will never see payment methods that are not in this list. However,
|
|
31
|
+
adding a method here does not guarantee customers will see it. Availability
|
|
32
|
+
still depends on other factors (e.g., customer location, merchant settings).
|
|
33
|
+
|
|
34
|
+
Disclaimar: Always provide 'credit' and 'debit' as a fallback. If all payment
|
|
35
|
+
methods are unavailable, checkout session will fail.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
billing_address: Optional[BillingAddress]
|
|
39
|
+
"""Billing address information for the session"""
|
|
40
|
+
|
|
41
|
+
billing_currency: Optional[Currency]
|
|
42
|
+
"""This field is ingored if adaptive pricing is disabled"""
|
|
43
|
+
|
|
44
|
+
confirm: bool
|
|
45
|
+
"""If confirm is true, all the details will be finalized.
|
|
46
|
+
|
|
47
|
+
If required data is missing, an API error is thrown.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
customer: Optional[CustomerRequestParam]
|
|
51
|
+
"""Customer details for the session"""
|
|
52
|
+
|
|
53
|
+
customization: Customization
|
|
54
|
+
"""Customization for the checkout session page"""
|
|
55
|
+
|
|
56
|
+
discount_code: Optional[str]
|
|
57
|
+
|
|
58
|
+
feature_flags: FeatureFlags
|
|
59
|
+
|
|
60
|
+
metadata: Optional[Dict[str, str]]
|
|
61
|
+
"""Additional metadata associated with the payment.
|
|
62
|
+
|
|
63
|
+
Defaults to empty if not provided.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
return_url: Optional[str]
|
|
67
|
+
"""The url to redirect after payment failure or success."""
|
|
68
|
+
|
|
69
|
+
show_saved_payment_methods: bool
|
|
70
|
+
"""Display saved payment methods of a returning customer False by default"""
|
|
71
|
+
|
|
72
|
+
subscription_data: Optional[SubscriptionData]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class ProductCart(TypedDict, total=False):
|
|
76
|
+
product_id: Required[str]
|
|
77
|
+
"""unique id of the product"""
|
|
78
|
+
|
|
79
|
+
quantity: Required[int]
|
|
80
|
+
|
|
81
|
+
addons: Optional[Iterable[AttachAddonParam]]
|
|
82
|
+
"""only valid if product is a subscription"""
|
|
83
|
+
|
|
84
|
+
amount: Optional[int]
|
|
85
|
+
"""Amount the customer pays if pay_what_you_want is enabled.
|
|
86
|
+
|
|
87
|
+
If disabled then amount will be ignored Represented in the lowest denomination
|
|
88
|
+
of the currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
|
|
89
|
+
Only applicable for one time payments
|
|
90
|
+
|
|
91
|
+
If amount is not set for pay_what_you_want product, customer is allowed to
|
|
92
|
+
select the amount.
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class BillingAddress(TypedDict, total=False):
|
|
97
|
+
country: Required[CountryCode]
|
|
98
|
+
"""Two-letter ISO country code (ISO 3166-1 alpha-2)"""
|
|
99
|
+
|
|
100
|
+
city: Optional[str]
|
|
101
|
+
"""City name"""
|
|
102
|
+
|
|
103
|
+
state: Optional[str]
|
|
104
|
+
"""State or province name"""
|
|
105
|
+
|
|
106
|
+
street: Optional[str]
|
|
107
|
+
"""Street address including house number and unit/apartment if applicable"""
|
|
108
|
+
|
|
109
|
+
zipcode: Optional[str]
|
|
110
|
+
"""Postal code or ZIP code"""
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class Customization(TypedDict, total=False):
|
|
114
|
+
show_on_demand_tag: bool
|
|
115
|
+
"""Show on demand tag
|
|
116
|
+
|
|
117
|
+
Default is true
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
show_order_details: bool
|
|
121
|
+
"""Show order details by default
|
|
122
|
+
|
|
123
|
+
Default is true
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
theme: Literal["dark", "light", "system"]
|
|
127
|
+
"""Theme of the page
|
|
128
|
+
|
|
129
|
+
Default is `System`.
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class FeatureFlags(TypedDict, total=False):
|
|
134
|
+
allow_currency_selection: bool
|
|
135
|
+
"""if customer is allowed to change currency, set it to true
|
|
136
|
+
|
|
137
|
+
Default is true
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
allow_discount_code: bool
|
|
141
|
+
"""If the customer is allowed to apply discount code, set it to true.
|
|
142
|
+
|
|
143
|
+
Default is true
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
allow_phone_number_collection: bool
|
|
147
|
+
"""If phone number is collected from customer, set it to rue
|
|
148
|
+
|
|
149
|
+
Default is true
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
allow_tax_id: bool
|
|
153
|
+
"""If the customer is allowed to add tax id, set it to true
|
|
154
|
+
|
|
155
|
+
Default is true
|
|
156
|
+
"""
|
|
157
|
+
|
|
158
|
+
always_create_new_customer: bool
|
|
159
|
+
"""
|
|
160
|
+
Set to true if a new customer object should be created. By default email is used
|
|
161
|
+
to find an existing customer to attach the session to
|
|
162
|
+
|
|
163
|
+
Default is false
|
|
164
|
+
"""
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class SubscriptionData(TypedDict, total=False):
|
|
168
|
+
on_demand: Optional[OnDemandSubscriptionParam]
|
|
169
|
+
|
|
170
|
+
trial_period_days: Optional[int]
|
|
171
|
+
"""
|
|
172
|
+
Optional trial period in days If specified, this value overrides the trial
|
|
173
|
+
period set in the product's price Must be between 0 and 10000 days
|
|
174
|
+
"""
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .._models import BaseModel
|
|
4
|
+
|
|
5
|
+
__all__ = ["CheckoutSessionResponse"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CheckoutSessionResponse(BaseModel):
|
|
9
|
+
checkout_url: str
|
|
10
|
+
"""Checkout url"""
|
|
11
|
+
|
|
12
|
+
session_id: str
|
|
13
|
+
"""The ID of the created checkout session"""
|
|
@@ -0,0 +1,44 @@
|
|
|
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 Optional
|
|
6
|
+
from typing_extensions import Required, TypedDict
|
|
7
|
+
|
|
8
|
+
from .currency import Currency
|
|
9
|
+
|
|
10
|
+
__all__ = ["OnDemandSubscriptionParam"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class OnDemandSubscriptionParam(TypedDict, total=False):
|
|
14
|
+
mandate_only: Required[bool]
|
|
15
|
+
"""
|
|
16
|
+
If set as True, does not perform any charge and only authorizes payment method
|
|
17
|
+
details for future use.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
adaptive_currency_fees_inclusive: Optional[bool]
|
|
21
|
+
"""
|
|
22
|
+
Whether adaptive currency fees should be included in the product_price (true) or
|
|
23
|
+
added on top (false). This field is ignored if adaptive pricing is not enabled
|
|
24
|
+
for the business.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
product_currency: Optional[Currency]
|
|
28
|
+
"""Optional currency of the product price.
|
|
29
|
+
|
|
30
|
+
If not specified, defaults to the currency of the product.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
product_description: Optional[str]
|
|
34
|
+
"""
|
|
35
|
+
Optional product description override for billing and line items. If not
|
|
36
|
+
specified, the stored description of the product will be used.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
product_price: Optional[int]
|
|
40
|
+
"""
|
|
41
|
+
Product price for the initial charge to customer If not specified the stored
|
|
42
|
+
price of the product will be used Represented in the lowest denomination of the
|
|
43
|
+
currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
|
|
44
|
+
"""
|
|
@@ -10,8 +10,9 @@ from .attach_addon_param import AttachAddonParam
|
|
|
10
10
|
from .payment_method_types import PaymentMethodTypes
|
|
11
11
|
from .billing_address_param import BillingAddressParam
|
|
12
12
|
from .customer_request_param import CustomerRequestParam
|
|
13
|
+
from .on_demand_subscription_param import OnDemandSubscriptionParam
|
|
13
14
|
|
|
14
|
-
__all__ = ["SubscriptionCreateParams"
|
|
15
|
+
__all__ = ["SubscriptionCreateParams"]
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
class SubscriptionCreateParams(TypedDict, total=False):
|
|
@@ -51,7 +52,7 @@ class SubscriptionCreateParams(TypedDict, total=False):
|
|
|
51
52
|
metadata: Dict[str, str]
|
|
52
53
|
"""Additional metadata for the subscription Defaults to empty if not specified"""
|
|
53
54
|
|
|
54
|
-
on_demand: Optional[
|
|
55
|
+
on_demand: Optional[OnDemandSubscriptionParam]
|
|
55
56
|
|
|
56
57
|
payment_link: Optional[bool]
|
|
57
58
|
"""If true, generates a payment link. Defaults to false if not specified."""
|
|
@@ -73,37 +74,3 @@ class SubscriptionCreateParams(TypedDict, total=False):
|
|
|
73
74
|
Optional trial period in days If specified, this value overrides the trial
|
|
74
75
|
period set in the product's price Must be between 0 and 10000 days
|
|
75
76
|
"""
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
class OnDemand(TypedDict, total=False):
|
|
79
|
-
mandate_only: Required[bool]
|
|
80
|
-
"""
|
|
81
|
-
If set as True, does not perform any charge and only authorizes payment method
|
|
82
|
-
details for future use.
|
|
83
|
-
"""
|
|
84
|
-
|
|
85
|
-
adaptive_currency_fees_inclusive: Optional[bool]
|
|
86
|
-
"""
|
|
87
|
-
Whether adaptive currency fees should be included in the product_price (true) or
|
|
88
|
-
added on top (false). This field is ignored if adaptive pricing is not enabled
|
|
89
|
-
for the business.
|
|
90
|
-
"""
|
|
91
|
-
|
|
92
|
-
product_currency: Optional[Currency]
|
|
93
|
-
"""Optional currency of the product price.
|
|
94
|
-
|
|
95
|
-
If not specified, defaults to the currency of the product.
|
|
96
|
-
"""
|
|
97
|
-
|
|
98
|
-
product_description: Optional[str]
|
|
99
|
-
"""
|
|
100
|
-
Optional product description override for billing and line items. If not
|
|
101
|
-
specified, the stored description of the product will be used.
|
|
102
|
-
"""
|
|
103
|
-
|
|
104
|
-
product_price: Optional[int]
|
|
105
|
-
"""
|
|
106
|
-
Product price for the initial charge to customer If not specified the stored
|
|
107
|
-
price of the product will be used Represented in the lowest denomination of the
|
|
108
|
-
currency (e.g., cents for USD). For example, to charge $1.00, pass `100`.
|
|
109
|
-
"""
|
|
@@ -17,6 +17,7 @@ class SubscriptionUpdateParams(TypedDict, total=False):
|
|
|
17
17
|
billing: Optional[BillingAddressParam]
|
|
18
18
|
|
|
19
19
|
cancel_at_next_billing_date: Optional[bool]
|
|
20
|
+
"""When set, the subscription will remain active until the end of billing period"""
|
|
20
21
|
|
|
21
22
|
disable_on_demand: Optional[DisableOnDemand]
|
|
22
23
|
|
|
@@ -4,10 +4,10 @@ from typing import Dict, List, Optional
|
|
|
4
4
|
|
|
5
5
|
from .._models import BaseModel
|
|
6
6
|
|
|
7
|
-
__all__ = ["
|
|
7
|
+
__all__ = ["WebhookDetails"]
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class WebhookDetails(BaseModel):
|
|
11
11
|
id: str
|
|
12
12
|
"""The webhook's ID."""
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dodopayments
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.51.0
|
|
4
4
|
Summary: The official Python library for the Dodo Payments API
|
|
5
5
|
Project-URL: Homepage, https://github.com/dodopayments/dodopayments-python
|
|
6
6
|
Project-URL: Repository, https://github.com/dodopayments/dodopayments-python
|
|
@@ -69,15 +69,7 @@ client = DodoPayments(
|
|
|
69
69
|
environment="test_mode",
|
|
70
70
|
)
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
billing={
|
|
74
|
-
"city": "city",
|
|
75
|
-
"country": "AF",
|
|
76
|
-
"state": "state",
|
|
77
|
-
"street": "street",
|
|
78
|
-
"zipcode": "zipcode",
|
|
79
|
-
},
|
|
80
|
-
customer={"customer_id": "customer_id"},
|
|
72
|
+
checkout_session_response = client.checkout_sessions.create(
|
|
81
73
|
product_cart=[
|
|
82
74
|
{
|
|
83
75
|
"product_id": "product_id",
|
|
@@ -85,7 +77,7 @@ payment = client.payments.create(
|
|
|
85
77
|
}
|
|
86
78
|
],
|
|
87
79
|
)
|
|
88
|
-
print(
|
|
80
|
+
print(checkout_session_response.session_id)
|
|
89
81
|
```
|
|
90
82
|
|
|
91
83
|
While you can provide a `bearer_token` keyword argument,
|
|
@@ -110,15 +102,7 @@ client = AsyncDodoPayments(
|
|
|
110
102
|
|
|
111
103
|
|
|
112
104
|
async def main() -> None:
|
|
113
|
-
|
|
114
|
-
billing={
|
|
115
|
-
"city": "city",
|
|
116
|
-
"country": "AF",
|
|
117
|
-
"state": "state",
|
|
118
|
-
"street": "street",
|
|
119
|
-
"zipcode": "zipcode",
|
|
120
|
-
},
|
|
121
|
-
customer={"customer_id": "customer_id"},
|
|
105
|
+
checkout_session_response = await client.checkout_sessions.create(
|
|
122
106
|
product_cart=[
|
|
123
107
|
{
|
|
124
108
|
"product_id": "product_id",
|
|
@@ -126,7 +110,7 @@ async def main() -> None:
|
|
|
126
110
|
}
|
|
127
111
|
],
|
|
128
112
|
)
|
|
129
|
-
print(
|
|
113
|
+
print(checkout_session_response.session_id)
|
|
130
114
|
|
|
131
115
|
|
|
132
116
|
asyncio.run(main())
|
|
@@ -158,15 +142,7 @@ async def main() -> None:
|
|
|
158
142
|
bearer_token="My Bearer Token",
|
|
159
143
|
http_client=DefaultAioHttpClient(),
|
|
160
144
|
) as client:
|
|
161
|
-
|
|
162
|
-
billing={
|
|
163
|
-
"city": "city",
|
|
164
|
-
"country": "AF",
|
|
165
|
-
"state": "state",
|
|
166
|
-
"street": "street",
|
|
167
|
-
"zipcode": "zipcode",
|
|
168
|
-
},
|
|
169
|
-
customer={"customer_id": "customer_id"},
|
|
145
|
+
checkout_session_response = await client.checkout_sessions.create(
|
|
170
146
|
product_cart=[
|
|
171
147
|
{
|
|
172
148
|
"product_id": "product_id",
|
|
@@ -174,7 +150,7 @@ async def main() -> None:
|
|
|
174
150
|
}
|
|
175
151
|
],
|
|
176
152
|
)
|
|
177
|
-
print(
|
|
153
|
+
print(checkout_session_response.session_id)
|
|
178
154
|
|
|
179
155
|
|
|
180
156
|
asyncio.run(main())
|
|
@@ -259,23 +235,16 @@ from dodopayments import DodoPayments
|
|
|
259
235
|
|
|
260
236
|
client = DodoPayments()
|
|
261
237
|
|
|
262
|
-
|
|
263
|
-
billing={
|
|
264
|
-
"city": "city",
|
|
265
|
-
"country": "AF",
|
|
266
|
-
"state": "state",
|
|
267
|
-
"street": "street",
|
|
268
|
-
"zipcode": "zipcode",
|
|
269
|
-
},
|
|
270
|
-
customer={"customer_id": "customer_id"},
|
|
238
|
+
checkout_session_response = client.checkout_sessions.create(
|
|
271
239
|
product_cart=[
|
|
272
240
|
{
|
|
273
241
|
"product_id": "product_id",
|
|
274
242
|
"quantity": 0,
|
|
275
243
|
}
|
|
276
244
|
],
|
|
245
|
+
billing_address={"country": "AF"},
|
|
277
246
|
)
|
|
278
|
-
print(
|
|
247
|
+
print(checkout_session_response.billing_address)
|
|
279
248
|
```
|
|
280
249
|
|
|
281
250
|
## Handling errors
|
|
@@ -294,15 +263,7 @@ from dodopayments import DodoPayments
|
|
|
294
263
|
client = DodoPayments()
|
|
295
264
|
|
|
296
265
|
try:
|
|
297
|
-
client.
|
|
298
|
-
billing={
|
|
299
|
-
"city": "city",
|
|
300
|
-
"country": "AF",
|
|
301
|
-
"state": "state",
|
|
302
|
-
"street": "street",
|
|
303
|
-
"zipcode": "zipcode",
|
|
304
|
-
},
|
|
305
|
-
customer={"customer_id": "customer_id"},
|
|
266
|
+
client.checkout_sessions.create(
|
|
306
267
|
product_cart=[
|
|
307
268
|
{
|
|
308
269
|
"product_id": "product_id",
|
|
@@ -352,15 +313,7 @@ client = DodoPayments(
|
|
|
352
313
|
)
|
|
353
314
|
|
|
354
315
|
# Or, configure per-request:
|
|
355
|
-
client.with_options(max_retries=5).
|
|
356
|
-
billing={
|
|
357
|
-
"city": "city",
|
|
358
|
-
"country": "AF",
|
|
359
|
-
"state": "state",
|
|
360
|
-
"street": "street",
|
|
361
|
-
"zipcode": "zipcode",
|
|
362
|
-
},
|
|
363
|
-
customer={"customer_id": "customer_id"},
|
|
316
|
+
client.with_options(max_retries=5).checkout_sessions.create(
|
|
364
317
|
product_cart=[
|
|
365
318
|
{
|
|
366
319
|
"product_id": "product_id",
|
|
@@ -390,15 +343,7 @@ client = DodoPayments(
|
|
|
390
343
|
)
|
|
391
344
|
|
|
392
345
|
# Override per-request:
|
|
393
|
-
client.with_options(timeout=5.0).
|
|
394
|
-
billing={
|
|
395
|
-
"city": "city",
|
|
396
|
-
"country": "AF",
|
|
397
|
-
"state": "state",
|
|
398
|
-
"street": "street",
|
|
399
|
-
"zipcode": "zipcode",
|
|
400
|
-
},
|
|
401
|
-
customer={"customer_id": "customer_id"},
|
|
346
|
+
client.with_options(timeout=5.0).checkout_sessions.create(
|
|
402
347
|
product_cart=[
|
|
403
348
|
{
|
|
404
349
|
"product_id": "product_id",
|
|
@@ -446,17 +391,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
|
|
|
446
391
|
from dodopayments import DodoPayments
|
|
447
392
|
|
|
448
393
|
client = DodoPayments()
|
|
449
|
-
response = client.
|
|
450
|
-
billing={
|
|
451
|
-
"city": "city",
|
|
452
|
-
"country": "AF",
|
|
453
|
-
"state": "state",
|
|
454
|
-
"street": "street",
|
|
455
|
-
"zipcode": "zipcode",
|
|
456
|
-
},
|
|
457
|
-
customer={
|
|
458
|
-
"customer_id": "customer_id"
|
|
459
|
-
},
|
|
394
|
+
response = client.checkout_sessions.with_raw_response.create(
|
|
460
395
|
product_cart=[{
|
|
461
396
|
"product_id": "product_id",
|
|
462
397
|
"quantity": 0,
|
|
@@ -464,8 +399,8 @@ response = client.payments.with_raw_response.create(
|
|
|
464
399
|
)
|
|
465
400
|
print(response.headers.get('X-My-Header'))
|
|
466
401
|
|
|
467
|
-
|
|
468
|
-
print(
|
|
402
|
+
checkout_session = response.parse() # get the object that `checkout_sessions.create()` would have returned
|
|
403
|
+
print(checkout_session.session_id)
|
|
469
404
|
```
|
|
470
405
|
|
|
471
406
|
These methods return an [`APIResponse`](https://github.com/dodopayments/dodopayments-python/tree/main/src/dodopayments/_response.py) object.
|
|
@@ -479,15 +414,7 @@ The above interface eagerly reads the full response body when you make the reque
|
|
|
479
414
|
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
|
|
480
415
|
|
|
481
416
|
```python
|
|
482
|
-
with client.
|
|
483
|
-
billing={
|
|
484
|
-
"city": "city",
|
|
485
|
-
"country": "AF",
|
|
486
|
-
"state": "state",
|
|
487
|
-
"street": "street",
|
|
488
|
-
"zipcode": "zipcode",
|
|
489
|
-
},
|
|
490
|
-
customer={"customer_id": "customer_id"},
|
|
417
|
+
with client.checkout_sessions.with_streaming_response.create(
|
|
491
418
|
product_cart=[
|
|
492
419
|
{
|
|
493
420
|
"product_id": "product_id",
|