| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# File generated from our OpenAPI spec |
| 3 |
from stripe._request_options import RequestOptions |
| 4 |
from typing import List |
| 5 |
from typing_extensions import Literal, NotRequired, TypedDict |
| 6 |
|
| 7 |
|
| 8 |
class SessionCreateParams(RequestOptions): |
| 9 |
configuration: NotRequired[str] |
| 10 |
""" |
| 11 |
The ID of an existing [configuration](https://docs.stripe.com/api/customer_portal/configurations) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration. |
| 12 |
""" |
| 13 |
customer: NotRequired[str] |
| 14 |
""" |
| 15 |
The ID of an existing customer. |
| 16 |
""" |
| 17 |
customer_account: NotRequired[str] |
| 18 |
""" |
| 19 |
The ID of an existing account. |
| 20 |
""" |
| 21 |
expand: NotRequired[List[str]] |
| 22 |
""" |
| 23 |
Specifies which fields in the response should be expanded. |
| 24 |
""" |
| 25 |
flow_data: NotRequired["SessionCreateParamsFlowData"] |
| 26 |
""" |
| 27 |
Information about a specific flow for the customer to go through. See the [docs](https://docs.stripe.com/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows. |
| 28 |
""" |
| 29 |
locale: NotRequired[ |
| 30 |
Literal[ |
| 31 |
"auto", |
| 32 |
"bg", |
| 33 |
"cs", |
| 34 |
"da", |
| 35 |
"de", |
| 36 |
"el", |
| 37 |
"en", |
| 38 |
"en-AU", |
| 39 |
"en-CA", |
| 40 |
"en-GB", |
| 41 |
"en-IE", |
| 42 |
"en-IN", |
| 43 |
"en-NZ", |
| 44 |
"en-SG", |
| 45 |
"es", |
| 46 |
"es-419", |
| 47 |
"et", |
| 48 |
"fi", |
| 49 |
"fil", |
| 50 |
"fr", |
| 51 |
"fr-CA", |
| 52 |
"hr", |
| 53 |
"hu", |
| 54 |
"id", |
| 55 |
"it", |
| 56 |
"ja", |
| 57 |
"ko", |
| 58 |
"lt", |
| 59 |
"lv", |
| 60 |
"ms", |
| 61 |
"mt", |
| 62 |
"nb", |
| 63 |
"nl", |
| 64 |
"pl", |
| 65 |
"pt", |
| 66 |
"pt-BR", |
| 67 |
"ro", |
| 68 |
"ru", |
| 69 |
"sk", |
| 70 |
"sl", |
| 71 |
"sv", |
| 72 |
"th", |
| 73 |
"tr", |
| 74 |
"vi", |
| 75 |
"zh", |
| 76 |
"zh-HK", |
| 77 |
"zh-TW", |
| 78 |
] |
| 79 |
] |
| 80 |
""" |
| 81 |
The IETF language tag of the locale customer portal is displayed in. If blank or auto, the customer's `preferred_locales` or browser's locale is used. |
| 82 |
""" |
| 83 |
on_behalf_of: NotRequired[str] |
| 84 |
""" |
| 85 |
The `on_behalf_of` account to use for this session. When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal. For more information, see the [docs](https://docs.stripe.com/connect/separate-charges-and-transfers#settlement-merchant). Use the [Accounts API](https://docs.stripe.com/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account's branding settings, which the portal displays. |
| 86 |
""" |
| 87 |
return_url: NotRequired[str] |
| 88 |
""" |
| 89 |
The default URL to redirect customers to when they click on the portal's link to return to your website. |
| 90 |
""" |
| 91 |
|
| 92 |
|
| 93 |
class SessionCreateParamsFlowData(TypedDict): |
| 94 |
after_completion: NotRequired["SessionCreateParamsFlowDataAfterCompletion"] |
| 95 |
""" |
| 96 |
Behavior after the flow is completed. |
| 97 |
""" |
| 98 |
subscription_cancel: NotRequired[ |
| 99 |
"SessionCreateParamsFlowDataSubscriptionCancel" |
| 100 |
] |
| 101 |
""" |
| 102 |
Configuration when `flow_data.type=subscription_cancel`. |
| 103 |
""" |
| 104 |
subscription_update: NotRequired[ |
| 105 |
"SessionCreateParamsFlowDataSubscriptionUpdate" |
| 106 |
] |
| 107 |
""" |
| 108 |
Configuration when `flow_data.type=subscription_update`. |
| 109 |
""" |
| 110 |
subscription_update_confirm: NotRequired[ |
| 111 |
"SessionCreateParamsFlowDataSubscriptionUpdateConfirm" |
| 112 |
] |
| 113 |
""" |
| 114 |
Configuration when `flow_data.type=subscription_update_confirm`. |
| 115 |
""" |
| 116 |
type: Literal[ |
| 117 |
"payment_method_update", |
| 118 |
"subscription_cancel", |
| 119 |
"subscription_update", |
| 120 |
"subscription_update_confirm", |
| 121 |
] |
| 122 |
""" |
| 123 |
Type of flow that the customer will go through. |
| 124 |
""" |
| 125 |
|
| 126 |
|
| 127 |
class SessionCreateParamsFlowDataAfterCompletion(TypedDict): |
| 128 |
hosted_confirmation: NotRequired[ |
| 129 |
"SessionCreateParamsFlowDataAfterCompletionHostedConfirmation" |
| 130 |
] |
| 131 |
""" |
| 132 |
Configuration when `after_completion.type=hosted_confirmation`. |
| 133 |
""" |
| 134 |
redirect: NotRequired["SessionCreateParamsFlowDataAfterCompletionRedirect"] |
| 135 |
""" |
| 136 |
Configuration when `after_completion.type=redirect`. |
| 137 |
""" |
| 138 |
type: Literal["hosted_confirmation", "portal_homepage", "redirect"] |
| 139 |
""" |
| 140 |
The specified behavior after the flow is completed. |
| 141 |
""" |
| 142 |
|
| 143 |
|
| 144 |
class SessionCreateParamsFlowDataAfterCompletionHostedConfirmation(TypedDict): |
| 145 |
custom_message: NotRequired[str] |
| 146 |
""" |
| 147 |
A custom message to display to the customer after the flow is completed. |
| 148 |
""" |
| 149 |
|
| 150 |
|
| 151 |
class SessionCreateParamsFlowDataAfterCompletionRedirect(TypedDict): |
| 152 |
return_url: str |
| 153 |
""" |
| 154 |
The URL the customer will be redirected to after the flow is completed. |
| 155 |
""" |
| 156 |
|
| 157 |
|
| 158 |
class SessionCreateParamsFlowDataSubscriptionCancel(TypedDict): |
| 159 |
retention: NotRequired[ |
| 160 |
"SessionCreateParamsFlowDataSubscriptionCancelRetention" |
| 161 |
] |
| 162 |
""" |
| 163 |
Specify a retention strategy to be used in the cancellation flow. |
| 164 |
""" |
| 165 |
subscription: str |
| 166 |
""" |
| 167 |
The ID of the subscription to be canceled. |
| 168 |
""" |
| 169 |
|
| 170 |
|
| 171 |
class SessionCreateParamsFlowDataSubscriptionCancelRetention(TypedDict): |
| 172 |
coupon_offer: ( |
| 173 |
"SessionCreateParamsFlowDataSubscriptionCancelRetentionCouponOffer" |
| 174 |
) |
| 175 |
""" |
| 176 |
Configuration when `retention.type=coupon_offer`. |
| 177 |
""" |
| 178 |
type: Literal["coupon_offer"] |
| 179 |
""" |
| 180 |
Type of retention strategy to use with the customer. |
| 181 |
""" |
| 182 |
|
| 183 |
|
| 184 |
class SessionCreateParamsFlowDataSubscriptionCancelRetentionCouponOffer( |
| 185 |
TypedDict, |
| 186 |
): |
| 187 |
coupon: str |
| 188 |
""" |
| 189 |
The ID of the coupon to be offered. |
| 190 |
""" |
| 191 |
|
| 192 |
|
| 193 |
class SessionCreateParamsFlowDataSubscriptionUpdate(TypedDict): |
| 194 |
subscription: str |
| 195 |
""" |
| 196 |
The ID of the subscription to be updated. |
| 197 |
""" |
| 198 |
|
| 199 |
|
| 200 |
class SessionCreateParamsFlowDataSubscriptionUpdateConfirm(TypedDict): |
| 201 |
discounts: NotRequired[ |
| 202 |
List["SessionCreateParamsFlowDataSubscriptionUpdateConfirmDiscount"] |
| 203 |
] |
| 204 |
""" |
| 205 |
The coupon or promotion code to apply to this subscription update. |
| 206 |
""" |
| 207 |
items: List["SessionCreateParamsFlowDataSubscriptionUpdateConfirmItem"] |
| 208 |
""" |
| 209 |
The [subscription item](https://docs.stripe.com/api/subscription_items) to be updated through this flow. Currently, only up to one may be specified and subscriptions with multiple items are not updatable. |
| 210 |
""" |
| 211 |
subscription: str |
| 212 |
""" |
| 213 |
The ID of the subscription to be updated. |
| 214 |
""" |
| 215 |
|
| 216 |
|
| 217 |
class SessionCreateParamsFlowDataSubscriptionUpdateConfirmDiscount(TypedDict): |
| 218 |
coupon: NotRequired[str] |
| 219 |
""" |
| 220 |
The ID of the coupon to apply to this subscription update. |
| 221 |
""" |
| 222 |
promotion_code: NotRequired[str] |
| 223 |
""" |
| 224 |
The ID of a promotion code to apply to this subscription update. |
| 225 |
""" |
| 226 |
|
| 227 |
|
| 228 |
class SessionCreateParamsFlowDataSubscriptionUpdateConfirmItem(TypedDict): |
| 229 |
id: str |
| 230 |
""" |
| 231 |
The ID of the [subscription item](https://docs.stripe.com/api/subscriptions/object#subscription_object-items-data-id) to be updated. |
| 232 |
""" |
| 233 |
price: NotRequired[str] |
| 234 |
""" |
| 235 |
The price the customer should subscribe to through this flow. The price must also be included in the configuration's [`features.subscription_update.products`](https://docs.stripe.com/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-products). |
| 236 |
""" |
| 237 |
quantity: NotRequired[int] |
| 238 |
""" |
| 239 |
[Quantity](https://docs.stripe.com/subscriptions/quantities) for this item that the customer should subscribe to through this flow. |
| 240 |
""" |