@@ -520,6 +520,7 @@ def create_portal_session(
520
520
portal_url : Optional [str ] = None ,
521
521
return_url : Optional [str ] = None ,
522
522
success_url : Optional [str ] = None ,
523
+ organization_id : Optional [str ] = None ,
523
524
) -> adminv1 .CreatePortalSessionResponse :
524
525
"""
525
526
Create Portal session.
@@ -535,16 +536,37 @@ def create_portal_session(
535
536
The portal URL, this is the target URL on the portal site.
536
537
537
538
If not defined the root URL for the portal will be used.
539
+
540
+ This does not need to be the full URL, you have the option
541
+ of passing in a path instead (e.g. `/`).
542
+
543
+ You also have the option of including the `{accountId}`
544
+ string in the path/URL which will be replaced with either the
545
+ UserHub user ID (if `organizationId` is not specified)
546
+ or the UserHub organization ID (if specified).
547
+
548
+ Examples:
549
+ * `/{accountId}` - the billing dashboard
550
+ * `/{accountId}/plans` - select a plan to checkout
551
+ * `/{accountId}/checkout/<some-plan-id>` - checkout specified plan
552
+ * `/{accountId}/members` - manage organization members
553
+ * `/{accountId}/invite` - invite a user to an organization
538
554
:param return_url:
539
555
The URL the user should be sent to when they want to return to
540
556
the app (e.g. cancel checkout).
541
557
542
558
If not defined the app URL will be used.
543
559
:param success_url:
544
- The URl the user should be sent after they successfully complete
560
+ The URL the user should be sent after they successfully complete
545
561
an action (e.g. checkout).
546
562
547
563
If not defined the return URL will be used.
564
+ :param organization_id:
565
+ The organization ID.
566
+
567
+ When specified the `{accountId}` in the `portalUrl` will be
568
+ replaced with the organization ID, otherwise the user ID
569
+ will be used.
548
570
"""
549
571
req = Request (
550
572
"admin.users.createPortalSession" ,
@@ -561,6 +583,8 @@ def create_portal_session(
561
583
body ["returnUrl" ] = return_url
562
584
if success_url :
563
585
body ["successUrl" ] = success_url
586
+ if organization_id :
587
+ body ["organizationId" ] = organization_id
564
588
565
589
req .set_body (body )
566
590
@@ -1079,6 +1103,7 @@ async def create_portal_session(
1079
1103
portal_url : Optional [str ] = None ,
1080
1104
return_url : Optional [str ] = None ,
1081
1105
success_url : Optional [str ] = None ,
1106
+ organization_id : Optional [str ] = None ,
1082
1107
) -> adminv1 .CreatePortalSessionResponse :
1083
1108
"""
1084
1109
Create Portal session.
@@ -1094,16 +1119,37 @@ async def create_portal_session(
1094
1119
The portal URL, this is the target URL on the portal site.
1095
1120
1096
1121
If not defined the root URL for the portal will be used.
1122
+
1123
+ This does not need to be the full URL, you have the option
1124
+ of passing in a path instead (e.g. `/`).
1125
+
1126
+ You also have the option of including the `{accountId}`
1127
+ string in the path/URL which will be replaced with either the
1128
+ UserHub user ID (if `organizationId` is not specified)
1129
+ or the UserHub organization ID (if specified).
1130
+
1131
+ Examples:
1132
+ * `/{accountId}` - the billing dashboard
1133
+ * `/{accountId}/plans` - select a plan to checkout
1134
+ * `/{accountId}/checkout/<some-plan-id>` - checkout specified plan
1135
+ * `/{accountId}/members` - manage organization members
1136
+ * `/{accountId}/invite` - invite a user to an organization
1097
1137
:param return_url:
1098
1138
The URL the user should be sent to when they want to return to
1099
1139
the app (e.g. cancel checkout).
1100
1140
1101
1141
If not defined the app URL will be used.
1102
1142
:param success_url:
1103
- The URl the user should be sent after they successfully complete
1143
+ The URL the user should be sent after they successfully complete
1104
1144
an action (e.g. checkout).
1105
1145
1106
1146
If not defined the return URL will be used.
1147
+ :param organization_id:
1148
+ The organization ID.
1149
+
1150
+ When specified the `{accountId}` in the `portalUrl` will be
1151
+ replaced with the organization ID, otherwise the user ID
1152
+ will be used.
1107
1153
"""
1108
1154
req = Request (
1109
1155
"admin.users.createPortalSession" ,
@@ -1120,6 +1166,8 @@ async def create_portal_session(
1120
1166
body ["returnUrl" ] = return_url
1121
1167
if success_url :
1122
1168
body ["successUrl" ] = success_url
1169
+ if organization_id :
1170
+ body ["organizationId" ] = organization_id
1123
1171
1124
1172
req .set_body (body )
1125
1173
0 commit comments