AppMonetization / Client / create_billing_portal_session

create_billing_portal_session

AppMonetization.Client.create_billing_portal_session(**kwargs)

Opens the AWS App Monetization hosted customer billing portal for a user. This operation returns the billing portal URL that your application redirects the user’s browser to. No state is persisted.

See also: AWS API Documentation

Request Syntax

response = client.create_billing_portal_session(
    appId='string',
    userId='string',
    returnUrl='string',
    refreshUrl='string',
    sessionDurationSeconds=123,
    clientToken='string',
    scope='sandbox'|'live'
)
Parameters:
  • appId (string) –

    [REQUIRED]

    The ID of the app the portal is for.

  • userId (string) –

    [REQUIRED]

    The ID of the end user the portal is for. Do not include personally identifiable or otherwise sensitive data in this value.

  • returnUrl (string) –

    [REQUIRED]

    A URL in your app. A plan checkout started from the portal doesn’t redirect here: after payment, the buyer returns to the portal’s My subscription page. Bound into the session and reused for every checkout the buyer launches from the portal.

  • refreshUrl (string) –

    [REQUIRED]

    A URL in your app. A plan checkout started from the portal doesn’t redirect here: if the buyer cancels, they return to the portal’s plans page. Bound into the session alongside returnUrl.

  • sessionDurationSeconds (integer) – The lifetime of the hosted session, in seconds, counted from this call. Omit to use the service default. It does not set how long billingPortalUrl works; see expiresAt.

  • clientToken (string) –

    A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request but does not return an error.

    This field is autopopulated if not provided.

  • scope (string) –

    [REQUIRED]

    Required. The environment: live or sandbox.

Return type:

dict

Returns:

Response Syntax

{
    'billingPortalUrl': 'string',
    'sessionToken': 'string',
    'expiresAt': datetime(2015, 1, 1),
    'manageToken': 'string'
}

Response Structure

  • (dict) –

    Output for CreateBillingPortalSession.

    • billingPortalUrl (string) –

      The URL of the billing portal page to redirect the end user’s browser to. The URL carries a short-lived session token or a single-use link in its fragment. The link works once, until expiresAt or the end of the session if sooner.

    • sessionToken (string) –

      The billing portal session token carried in the fragment of billingPortalUrl. Absent when billingPortalUrl carries a single-use link instead.

    • expiresAt (datetime) –

      The time when the single-use link in billingPortalUrl expires, 10 minutes after it was created. After this time the URL no longer works and you must create a new session.

    • manageToken (string) –

      A short-lived token that authorizes updates to the buyer profile from the billing portal. Returned only with sessionToken.

Exceptions