dodopayments 1.51.1__py3-none-any.whl → 1.56.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. dodopayments/__init__.py +5 -1
  2. dodopayments/_base_client.py +12 -12
  3. dodopayments/_client.py +52 -14
  4. dodopayments/_compat.py +48 -48
  5. dodopayments/_exceptions.py +4 -0
  6. dodopayments/_models.py +50 -44
  7. dodopayments/_qs.py +7 -7
  8. dodopayments/_streaming.py +4 -6
  9. dodopayments/_types.py +18 -11
  10. dodopayments/_utils/__init__.py +8 -2
  11. dodopayments/_utils/_compat.py +45 -0
  12. dodopayments/_utils/_datetime_parse.py +136 -0
  13. dodopayments/_utils/_transform.py +13 -3
  14. dodopayments/_utils/_typing.py +1 -1
  15. dodopayments/_utils/_utils.py +5 -6
  16. dodopayments/_version.py +1 -1
  17. dodopayments/resources/__init__.py +28 -0
  18. dodopayments/resources/addons.py +29 -29
  19. dodopayments/resources/brands.py +29 -29
  20. dodopayments/resources/checkout_sessions.py +110 -27
  21. dodopayments/resources/customers/__init__.py +14 -0
  22. dodopayments/resources/customers/customer_portal.py +5 -5
  23. dodopayments/resources/customers/customers.py +53 -21
  24. dodopayments/resources/customers/wallets/__init__.py +33 -0
  25. dodopayments/resources/customers/wallets/ledger_entries.py +318 -0
  26. dodopayments/resources/customers/wallets/wallets.py +191 -0
  27. dodopayments/resources/discounts.py +44 -44
  28. dodopayments/resources/disputes.py +19 -19
  29. dodopayments/resources/invoices/payments.py +83 -3
  30. dodopayments/resources/license_key_instances.py +13 -13
  31. dodopayments/resources/license_keys.py +23 -23
  32. dodopayments/resources/licenses.py +14 -14
  33. dodopayments/resources/meters.py +554 -0
  34. dodopayments/resources/misc.py +3 -3
  35. dodopayments/resources/payments.py +49 -41
  36. dodopayments/resources/payouts.py +26 -7
  37. dodopayments/resources/products/images.py +5 -5
  38. dodopayments/resources/products/products.py +82 -82
  39. dodopayments/resources/refunds.py +39 -30
  40. dodopayments/resources/subscriptions.py +316 -73
  41. dodopayments/resources/usage_events.py +597 -0
  42. dodopayments/resources/webhooks/headers.py +5 -5
  43. dodopayments/resources/webhooks/webhooks.py +119 -44
  44. dodopayments/types/__init__.py +48 -0
  45. dodopayments/types/add_meter_to_price.py +29 -0
  46. dodopayments/types/add_meter_to_price_param.py +30 -0
  47. dodopayments/types/checkout_session_create_params.py +6 -0
  48. dodopayments/types/checkout_session_status.py +35 -0
  49. dodopayments/types/customer_limited_details.py +5 -0
  50. dodopayments/types/customers/__init__.py +2 -0
  51. dodopayments/types/customers/customer_wallet.py +20 -0
  52. dodopayments/types/customers/wallet_list_response.py +15 -0
  53. dodopayments/types/customers/wallets/__init__.py +7 -0
  54. dodopayments/types/customers/wallets/customer_wallet_transaction.py +38 -0
  55. dodopayments/types/customers/wallets/ledger_entry_create_params.py +25 -0
  56. dodopayments/types/customers/wallets/ledger_entry_list_params.py +18 -0
  57. dodopayments/types/discount_create_params.py +3 -2
  58. dodopayments/types/discount_update_params.py +3 -2
  59. dodopayments/types/dispute_accepted_webhook_event.py +29 -0
  60. dodopayments/types/dispute_accepted_webhook_event1.py +29 -0
  61. dodopayments/types/dispute_cancelled_webhook_event.py +29 -0
  62. dodopayments/types/dispute_cancelled_webhook_event1.py +29 -0
  63. dodopayments/types/dispute_challenged_webhook_event.py +29 -0
  64. dodopayments/types/dispute_challenged_webhook_event1.py +29 -0
  65. dodopayments/types/dispute_expired_webhook_event.py +29 -0
  66. dodopayments/types/dispute_expired_webhook_event1.py +29 -0
  67. dodopayments/types/dispute_lost_webhook_event.py +29 -0
  68. dodopayments/types/dispute_lost_webhook_event1.py +29 -0
  69. dodopayments/types/dispute_opened_webhook_event.py +29 -0
  70. dodopayments/types/dispute_opened_webhook_event1.py +29 -0
  71. dodopayments/types/dispute_won_webhook_event.py +29 -0
  72. dodopayments/types/dispute_won_webhook_event1.py +29 -0
  73. dodopayments/types/event.py +26 -0
  74. dodopayments/types/event_input_param.py +38 -0
  75. dodopayments/types/license_activate_response.py +40 -0
  76. dodopayments/types/license_key_created_webhook_event.py +29 -0
  77. dodopayments/types/license_key_created_webhook_event1.py +29 -0
  78. dodopayments/types/meter.py +40 -0
  79. dodopayments/types/meter_aggregation.py +16 -0
  80. dodopayments/types/meter_aggregation_param.py +16 -0
  81. dodopayments/types/meter_create_params.py +31 -0
  82. dodopayments/types/meter_filter.py +131 -0
  83. dodopayments/types/meter_filter_param.py +143 -0
  84. dodopayments/types/meter_list_params.py +18 -0
  85. dodopayments/types/new_customer_param.py +7 -1
  86. dodopayments/types/payment.py +37 -2
  87. dodopayments/types/payment_cancelled_webhook_event.py +29 -0
  88. dodopayments/types/payment_cancelled_webhook_event1.py +29 -0
  89. dodopayments/types/payment_create_params.py +3 -0
  90. dodopayments/types/payment_failed_webhook_event.py +29 -0
  91. dodopayments/types/payment_failed_webhook_event1.py +29 -0
  92. dodopayments/types/payment_method_types.py +1 -0
  93. dodopayments/types/payment_processing_webhook_event.py +29 -0
  94. dodopayments/types/payment_processing_webhook_event1.py +29 -0
  95. dodopayments/types/payment_succeeded_webhook_event.py +29 -0
  96. dodopayments/types/payment_succeeded_webhook_event1.py +29 -0
  97. dodopayments/types/payout_list_params.py +11 -1
  98. dodopayments/types/price.py +52 -5
  99. dodopayments/types/price_param.py +52 -5
  100. dodopayments/types/product_create_params.py +3 -2
  101. dodopayments/types/product_update_params.py +4 -3
  102. dodopayments/types/refund.py +8 -1
  103. dodopayments/types/refund_create_params.py +4 -1
  104. dodopayments/types/refund_failed_webhook_event.py +29 -0
  105. dodopayments/types/refund_failed_webhook_event1.py +29 -0
  106. dodopayments/types/refund_list_response.py +39 -0
  107. dodopayments/types/refund_succeeded_webhook_event.py +29 -0
  108. dodopayments/types/refund_succeeded_webhook_event1.py +29 -0
  109. dodopayments/types/subscription.py +23 -1
  110. dodopayments/types/subscription_active_webhook_event.py +29 -0
  111. dodopayments/types/subscription_active_webhook_event1.py +29 -0
  112. dodopayments/types/subscription_cancelled_webhook_event.py +29 -0
  113. dodopayments/types/subscription_cancelled_webhook_event1.py +29 -0
  114. dodopayments/types/subscription_charge_params.py +12 -1
  115. dodopayments/types/subscription_create_params.py +3 -0
  116. dodopayments/types/subscription_expired_webhook_event.py +29 -0
  117. dodopayments/types/subscription_expired_webhook_event1.py +29 -0
  118. dodopayments/types/subscription_failed_webhook_event.py +29 -0
  119. dodopayments/types/subscription_failed_webhook_event1.py +29 -0
  120. dodopayments/types/subscription_list_response.py +3 -0
  121. dodopayments/types/subscription_on_hold_webhook_event.py +29 -0
  122. dodopayments/types/subscription_on_hold_webhook_event1.py +29 -0
  123. dodopayments/types/subscription_plan_changed_webhook_event.py +29 -0
  124. dodopayments/types/subscription_plan_changed_webhook_event1.py +29 -0
  125. dodopayments/types/subscription_renewed_webhook_event.py +29 -0
  126. dodopayments/types/subscription_renewed_webhook_event1.py +29 -0
  127. dodopayments/types/subscription_retrieve_usage_history_params.py +28 -0
  128. dodopayments/types/subscription_retrieve_usage_history_response.py +46 -0
  129. dodopayments/types/subscription_update_params.py +2 -0
  130. dodopayments/types/unsafe_unwrap_webhook_event.py +52 -0
  131. dodopayments/types/unwrap_webhook_event.py +52 -0
  132. dodopayments/types/usage_event_ingest_params.py +15 -0
  133. dodopayments/types/usage_event_ingest_response.py +9 -0
  134. dodopayments/types/usage_event_list_params.py +42 -0
  135. {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/METADATA +6 -4
  136. dodopayments-1.56.5.dist-info/RECORD +239 -0
  137. dodopayments-1.51.1.dist-info/RECORD +0 -163
  138. {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/WHEEL +0 -0
  139. {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,40 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+
6
+ from .._models import BaseModel
7
+ from .meter_filter import MeterFilter
8
+ from .meter_aggregation import MeterAggregation
9
+
10
+ __all__ = ["Meter"]
11
+
12
+
13
+ class Meter(BaseModel):
14
+ id: str
15
+
16
+ aggregation: MeterAggregation
17
+
18
+ business_id: str
19
+
20
+ created_at: datetime
21
+
22
+ event_name: str
23
+
24
+ measurement_unit: str
25
+
26
+ name: str
27
+
28
+ updated_at: datetime
29
+
30
+ description: Optional[str] = None
31
+
32
+ filter: Optional[MeterFilter] = None
33
+ """
34
+ A filter structure that combines multiple conditions with logical conjunctions
35
+ (AND/OR).
36
+
37
+ Supports up to 3 levels of nesting to create complex filter expressions. Each
38
+ filter has a conjunction (and/or) and clauses that can be either direct
39
+ conditions or nested filters.
40
+ """
@@ -0,0 +1,16 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from typing_extensions import Literal
5
+
6
+ from .._models import BaseModel
7
+
8
+ __all__ = ["MeterAggregation"]
9
+
10
+
11
+ class MeterAggregation(BaseModel):
12
+ type: Literal["count", "sum", "max", "last"]
13
+ """Aggregation type for the meter"""
14
+
15
+ key: Optional[str] = None
16
+ """Required when type is not COUNT"""
@@ -0,0 +1,16 @@
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 Literal, Required, TypedDict
7
+
8
+ __all__ = ["MeterAggregationParam"]
9
+
10
+
11
+ class MeterAggregationParam(TypedDict, total=False):
12
+ type: Required[Literal["count", "sum", "max", "last"]]
13
+ """Aggregation type for the meter"""
14
+
15
+ key: Optional[str]
16
+ """Required when type is not COUNT"""
@@ -0,0 +1,31 @@
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 .meter_filter_param import MeterFilterParam
9
+ from .meter_aggregation_param import MeterAggregationParam
10
+
11
+ __all__ = ["MeterCreateParams"]
12
+
13
+
14
+ class MeterCreateParams(TypedDict, total=False):
15
+ aggregation: Required[MeterAggregationParam]
16
+ """Aggregation configuration for the meter"""
17
+
18
+ event_name: Required[str]
19
+ """Event name to track"""
20
+
21
+ measurement_unit: Required[str]
22
+ """measurement unit"""
23
+
24
+ name: Required[str]
25
+ """Name of the meter"""
26
+
27
+ description: Optional[str]
28
+ """Optional description of the meter"""
29
+
30
+ filter: Optional[MeterFilterParam]
31
+ """Optional filter to apply to the meter"""
@@ -0,0 +1,131 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Union
4
+ from typing_extensions import Literal
5
+
6
+ from .._models import BaseModel
7
+
8
+ __all__ = [
9
+ "MeterFilter",
10
+ "ClausesDirectFilterCondition",
11
+ "ClausesNestedMeterFilter",
12
+ "ClausesNestedMeterFilterClausesLevel1FilterCondition",
13
+ "ClausesNestedMeterFilterClausesLevel1NestedFilter",
14
+ "ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2FilterCondition",
15
+ "ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilter",
16
+ "ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilterClause",
17
+ ]
18
+
19
+
20
+ class ClausesDirectFilterCondition(BaseModel):
21
+ key: str
22
+ """Filter key to apply"""
23
+
24
+ operator: Literal[
25
+ "equals",
26
+ "not_equals",
27
+ "greater_than",
28
+ "greater_than_or_equals",
29
+ "less_than",
30
+ "less_than_or_equals",
31
+ "contains",
32
+ "does_not_contain",
33
+ ]
34
+
35
+ value: Union[str, float, bool]
36
+ """Filter value - can be string, number, or boolean"""
37
+
38
+
39
+ class ClausesNestedMeterFilterClausesLevel1FilterCondition(BaseModel):
40
+ key: str
41
+ """Filter key to apply"""
42
+
43
+ operator: Literal[
44
+ "equals",
45
+ "not_equals",
46
+ "greater_than",
47
+ "greater_than_or_equals",
48
+ "less_than",
49
+ "less_than_or_equals",
50
+ "contains",
51
+ "does_not_contain",
52
+ ]
53
+
54
+ value: Union[str, float, bool]
55
+ """Filter value - can be string, number, or boolean"""
56
+
57
+
58
+ class ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2FilterCondition(BaseModel):
59
+ key: str
60
+ """Filter key to apply"""
61
+
62
+ operator: Literal[
63
+ "equals",
64
+ "not_equals",
65
+ "greater_than",
66
+ "greater_than_or_equals",
67
+ "less_than",
68
+ "less_than_or_equals",
69
+ "contains",
70
+ "does_not_contain",
71
+ ]
72
+
73
+ value: Union[str, float, bool]
74
+ """Filter value - can be string, number, or boolean"""
75
+
76
+
77
+ class ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilterClause(BaseModel):
78
+ key: str
79
+ """Filter key to apply"""
80
+
81
+ operator: Literal[
82
+ "equals",
83
+ "not_equals",
84
+ "greater_than",
85
+ "greater_than_or_equals",
86
+ "less_than",
87
+ "less_than_or_equals",
88
+ "contains",
89
+ "does_not_contain",
90
+ ]
91
+
92
+ value: Union[str, float, bool]
93
+ """Filter value - can be string, number, or boolean"""
94
+
95
+
96
+ class ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilter(BaseModel):
97
+ clauses: List[ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilterClause]
98
+ """Level 3: Filter conditions only (max depth reached)"""
99
+
100
+ conjunction: Literal["and", "or"]
101
+
102
+
103
+ class ClausesNestedMeterFilterClausesLevel1NestedFilter(BaseModel):
104
+ clauses: Union[
105
+ List[ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2FilterCondition],
106
+ List[ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilter],
107
+ ]
108
+ """Level 2: Can be conditions or nested filters (1 more level allowed)"""
109
+
110
+ conjunction: Literal["and", "or"]
111
+
112
+
113
+ class ClausesNestedMeterFilter(BaseModel):
114
+ clauses: Union[
115
+ List[ClausesNestedMeterFilterClausesLevel1FilterCondition],
116
+ List[ClausesNestedMeterFilterClausesLevel1NestedFilter],
117
+ ]
118
+ """Level 1: Can be conditions or nested filters (2 more levels allowed)"""
119
+
120
+ conjunction: Literal["and", "or"]
121
+
122
+
123
+ class MeterFilter(BaseModel):
124
+ clauses: Union[List[ClausesDirectFilterCondition], List[ClausesNestedMeterFilter]]
125
+ """
126
+ Filter clauses - can be direct conditions or nested filters (up to 3 levels
127
+ deep)
128
+ """
129
+
130
+ conjunction: Literal["and", "or"]
131
+ """Logical conjunction to apply between clauses (and/or)"""
@@ -0,0 +1,143 @@
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 Union, Iterable
6
+ from typing_extensions import Literal, Required, TypedDict
7
+
8
+ __all__ = [
9
+ "MeterFilterParam",
10
+ "ClausesDirectFilterCondition",
11
+ "ClausesNestedMeterFilter",
12
+ "ClausesNestedMeterFilterClausesLevel1FilterCondition",
13
+ "ClausesNestedMeterFilterClausesLevel1NestedFilter",
14
+ "ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2FilterCondition",
15
+ "ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilter",
16
+ "ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilterClause",
17
+ ]
18
+
19
+
20
+ class ClausesDirectFilterCondition(TypedDict, total=False):
21
+ key: Required[str]
22
+ """Filter key to apply"""
23
+
24
+ operator: Required[
25
+ Literal[
26
+ "equals",
27
+ "not_equals",
28
+ "greater_than",
29
+ "greater_than_or_equals",
30
+ "less_than",
31
+ "less_than_or_equals",
32
+ "contains",
33
+ "does_not_contain",
34
+ ]
35
+ ]
36
+
37
+ value: Required[Union[str, float, bool]]
38
+ """Filter value - can be string, number, or boolean"""
39
+
40
+
41
+ class ClausesNestedMeterFilterClausesLevel1FilterCondition(TypedDict, total=False):
42
+ key: Required[str]
43
+ """Filter key to apply"""
44
+
45
+ operator: Required[
46
+ Literal[
47
+ "equals",
48
+ "not_equals",
49
+ "greater_than",
50
+ "greater_than_or_equals",
51
+ "less_than",
52
+ "less_than_or_equals",
53
+ "contains",
54
+ "does_not_contain",
55
+ ]
56
+ ]
57
+
58
+ value: Required[Union[str, float, bool]]
59
+ """Filter value - can be string, number, or boolean"""
60
+
61
+
62
+ class ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2FilterCondition(TypedDict, total=False):
63
+ key: Required[str]
64
+ """Filter key to apply"""
65
+
66
+ operator: Required[
67
+ Literal[
68
+ "equals",
69
+ "not_equals",
70
+ "greater_than",
71
+ "greater_than_or_equals",
72
+ "less_than",
73
+ "less_than_or_equals",
74
+ "contains",
75
+ "does_not_contain",
76
+ ]
77
+ ]
78
+
79
+ value: Required[Union[str, float, bool]]
80
+ """Filter value - can be string, number, or boolean"""
81
+
82
+
83
+ class ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilterClause(TypedDict, total=False):
84
+ key: Required[str]
85
+ """Filter key to apply"""
86
+
87
+ operator: Required[
88
+ Literal[
89
+ "equals",
90
+ "not_equals",
91
+ "greater_than",
92
+ "greater_than_or_equals",
93
+ "less_than",
94
+ "less_than_or_equals",
95
+ "contains",
96
+ "does_not_contain",
97
+ ]
98
+ ]
99
+
100
+ value: Required[Union[str, float, bool]]
101
+ """Filter value - can be string, number, or boolean"""
102
+
103
+
104
+ class ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilter(TypedDict, total=False):
105
+ clauses: Required[Iterable[ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilterClause]]
106
+ """Level 3: Filter conditions only (max depth reached)"""
107
+
108
+ conjunction: Required[Literal["and", "or"]]
109
+
110
+
111
+ class ClausesNestedMeterFilterClausesLevel1NestedFilter(TypedDict, total=False):
112
+ clauses: Required[
113
+ Union[
114
+ Iterable[ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2FilterCondition],
115
+ Iterable[ClausesNestedMeterFilterClausesLevel1NestedFilterClausesLevel2NestedFilter],
116
+ ]
117
+ ]
118
+ """Level 2: Can be conditions or nested filters (1 more level allowed)"""
119
+
120
+ conjunction: Required[Literal["and", "or"]]
121
+
122
+
123
+ class ClausesNestedMeterFilter(TypedDict, total=False):
124
+ clauses: Required[
125
+ Union[
126
+ Iterable[ClausesNestedMeterFilterClausesLevel1FilterCondition],
127
+ Iterable[ClausesNestedMeterFilterClausesLevel1NestedFilter],
128
+ ]
129
+ ]
130
+ """Level 1: Can be conditions or nested filters (2 more levels allowed)"""
131
+
132
+ conjunction: Required[Literal["and", "or"]]
133
+
134
+
135
+ class MeterFilterParam(TypedDict, total=False):
136
+ clauses: Required[Union[Iterable[ClausesDirectFilterCondition], Iterable[ClausesNestedMeterFilter]]]
137
+ """
138
+ Filter clauses - can be direct conditions or nested filters (up to 3 levels
139
+ deep)
140
+ """
141
+
142
+ conjunction: Required[Literal["and", "or"]]
143
+ """Logical conjunction to apply between clauses (and/or)"""
@@ -0,0 +1,18 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import TypedDict
6
+
7
+ __all__ = ["MeterListParams"]
8
+
9
+
10
+ class MeterListParams(TypedDict, total=False):
11
+ archived: bool
12
+ """List archived meters"""
13
+
14
+ page_number: int
15
+ """Page number default is 0"""
16
+
17
+ page_size: int
18
+ """Page size default is 10 max is 100"""
@@ -10,7 +10,13 @@ __all__ = ["NewCustomerParam"]
10
10
 
11
11
  class NewCustomerParam(TypedDict, total=False):
12
12
  email: Required[str]
13
+ """Email is required for creating a new customer"""
13
14
 
14
- name: Required[str]
15
+ name: Optional[str]
16
+ """Optional full name of the customer.
17
+
18
+ If provided during session creation, it is persisted and becomes immutable for
19
+ the session. If omitted here, it can be provided later via the confirm API.
20
+ """
15
21
 
16
22
  phone_number: Optional[str]
@@ -3,16 +3,45 @@
3
3
  from typing import Dict, List, Optional
4
4
  from datetime import datetime
5
5
 
6
- from .refund import Refund
7
6
  from .dispute import Dispute
8
7
  from .._models import BaseModel
9
8
  from .currency import Currency
10
9
  from .country_code import CountryCode
11
10
  from .intent_status import IntentStatus
11
+ from .refund_status import RefundStatus
12
12
  from .billing_address import BillingAddress
13
13
  from .customer_limited_details import CustomerLimitedDetails
14
14
 
15
- __all__ = ["Payment", "ProductCart"]
15
+ __all__ = ["Payment", "Refund", "ProductCart"]
16
+
17
+
18
+ class Refund(BaseModel):
19
+ business_id: str
20
+ """The unique identifier of the business issuing the refund."""
21
+
22
+ created_at: datetime
23
+ """The timestamp of when the refund was created in UTC."""
24
+
25
+ is_partial: bool
26
+ """If true the refund is a partial refund"""
27
+
28
+ payment_id: str
29
+ """The unique identifier of the payment associated with the refund."""
30
+
31
+ refund_id: str
32
+ """The unique identifier of the refund."""
33
+
34
+ status: RefundStatus
35
+ """The current status of the refund."""
36
+
37
+ amount: Optional[int] = None
38
+ """The refunded amount."""
39
+
40
+ currency: Optional[Currency] = None
41
+ """The currency of the refund, represented as an ISO 4217 currency code."""
42
+
43
+ reason: Optional[str] = None
44
+ """The reason provided for the refund, if any. Optional."""
16
45
 
17
46
 
18
47
  class ProductCart(BaseModel):
@@ -87,6 +116,12 @@ class Payment(BaseModel):
87
116
  card_type: Optional[str] = None
88
117
  """The type of card DEBIT or CREDIT"""
89
118
 
119
+ checkout_session_id: Optional[str] = None
120
+ """
121
+ If payment is made using a checkout session, this field is set to the id of the
122
+ session.
123
+ """
124
+
90
125
  discount_id: Optional[str] = None
91
126
  """The discount id if discount is applied"""
92
127
 
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .payment import Payment
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["PaymentCancelledWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Payment):
14
+ payload_type: Optional[Literal["Payment"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class PaymentCancelledWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["payment.cancelled"]
29
+ """The event type"""
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .payment import Payment
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["PaymentCancelledWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Payment):
14
+ payload_type: Optional[Literal["Payment"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class PaymentCancelledWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["payment.cancelled"]
29
+ """The event type"""
@@ -42,6 +42,9 @@ class PaymentCreateParams(TypedDict, total=False):
42
42
  discount_code: Optional[str]
43
43
  """Discount Code to apply to the transaction"""
44
44
 
45
+ force_3ds: Optional[bool]
46
+ """Override merchant default 3DS behaviour for this payment"""
47
+
45
48
  metadata: Dict[str, str]
46
49
  """
47
50
  Additional metadata associated with the payment. Defaults to empty if not
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .payment import Payment
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["PaymentFailedWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Payment):
14
+ payload_type: Optional[Literal["Payment"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class PaymentFailedWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["payment.failed"]
29
+ """The event type"""
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .payment import Payment
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["PaymentFailedWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Payment):
14
+ payload_type: Optional[Literal["Payment"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class PaymentFailedWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["payment.failed"]
29
+ """The event type"""
@@ -17,6 +17,7 @@ PaymentMethodTypes: TypeAlias = Literal[
17
17
  "eps",
18
18
  "ideal",
19
19
  "przelewy24",
20
+ "paypal",
20
21
  "affirm",
21
22
  "klarna",
22
23
  "sepa",
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .payment import Payment
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["PaymentProcessingWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Payment):
14
+ payload_type: Optional[Literal["Payment"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class PaymentProcessingWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["payment.processing"]
29
+ """The event type"""
@@ -0,0 +1,29 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+ from typing_extensions import Literal
6
+
7
+ from .payment import Payment
8
+ from .._models import BaseModel
9
+
10
+ __all__ = ["PaymentProcessingWebhookEvent", "Data"]
11
+
12
+
13
+ class Data(Payment):
14
+ payload_type: Optional[Literal["Payment"]] = None
15
+ """The type of payload in the data field"""
16
+
17
+
18
+ class PaymentProcessingWebhookEvent(BaseModel):
19
+ business_id: str
20
+ """The business identifier"""
21
+
22
+ data: Data
23
+ """Event-specific data"""
24
+
25
+ timestamp: datetime
26
+ """The timestamp of when the event occurred"""
27
+
28
+ type: Literal["payment.processing"]
29
+ """The event type"""