AppMonetization / Client / create_one_time_checkout_session

create_one_time_checkout_session

AppMonetization.Client.create_one_time_checkout_session(**kwargs)

Creates a checkout session for a one-time purchase of usage packs or add-ons against the user’s current subscription, or against the app when the user has no subscription. A one-time purchase always requires payment, so the response returns a checkout URL and a checkout session identifier. To subscribe a user to a plan or change the user’s plan, use CreateSubscriptionCheckoutSession.

See also: AWS API Documentation

Request Syntax

response = client.create_one_time_checkout_session(
    appId='string',
    userId='string',
    items=[
        {
            'oneTimePriceId': 'string',
            'quantity': 123
        },
    ],
    returnUrl='string',
    clientToken='string',
    scope='sandbox'|'live'
)
Parameters:
  • appId (string) –

    [REQUIRED]

    The ID of the app the purchase is for.

  • userId (string) –

    [REQUIRED]

    The ID of the end user making the purchase. Do not include personally identifiable or otherwise sensitive data in this value.

  • items (list) –

    [REQUIRED]

    The purchasables to buy. Each line is a usage pack or add-on and the number of units to buy.

    • (dict) –

      A single line in a one-time purchase cart: the one-time price to buy and how many units.

      • oneTimePriceId (string) – [REQUIRED]

        The id of the one-time price to buy.

      • quantity (integer) –

        The number of units of the one-time price to buy.

  • returnUrl (string) –

    [REQUIRED]

    The URL the buyer’s browser is sent to after they complete payment at checkout (the checkout page’s success-redirect target). A one-time purchase always requires payment, so there is no cancel-redirect field on this operation.

  • 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

{
    'checkoutUrl': 'string',
    'expiresAt': datetime(2015, 1, 1),
    'checkoutSessionId': 'string'
}

Response Structure

  • (dict) –

    Output for CreateOneTimeCheckoutSession. A one-time purchase always requires payment, so the response always carries a checkout URL.

    • checkoutUrl (string) –

      An absolute HTTP or HTTPS URL the buyer’s browser is redirected to in order to complete payment.

    • expiresAt (datetime) –

      The time when the checkout session expires.

    • checkoutSessionId (string) –

      The ID of the created checkout session.

Exceptions