AppMonetization / Client / create_plan

create_plan

AppMonetization.Client.create_plan(**kwargs)

Creates a pricing plan for an app. The plan’s identifier is not supplied in the request; AWS App Monetization mints a server-generated planId and returns it on the created plan. The new plan exists on the draft (DRAFT) offering until it is published with PublishDraft.

See also: AWS API Documentation

Request Syntax

response = client.create_plan(
    appId='string',
    definition={
        'name': 'string',
        'description': 'string',
        'billingCycle': 'MONTHLY'|'ANNUAL'|'ONE_TIME',
        'subscriptionPrice': {
            'currencyCode': 'string',
            'amount': 'string'
        },
        'includedQuotas': {
            'string': {
                'flat': {
                    'includedQuantity': 123,
                    'overagePolicy': 'NO_OVERAGE_THROTTLE'|'APPLY_FIXED_OVERAGE'|'APPLY_TIERED_OVERAGE',
                    'overagePrice': {
                        'currencyCode': 'string',
                        'amount': 'string'
                    },
                    'tieredOverage': {
                        'semantics': 'GRADUATED'|'VOLUME',
                        'tiers': [
                            {
                                'firstUnit': 123,
                                'lastUnit': 123,
                                'unitPrice': {
                                    'currencyCode': 'string',
                                    'amount': 'string'
                                }
                            },
                        ]
                    },
                    'maxQuantity': 123
                },
                'tiered': {
                    'includedQuantity': 123,
                    'tieredPrice': {
                        'semantics': 'GRADUATED'|'VOLUME',
                        'tiers': [
                            {
                                'firstUnit': 123,
                                'lastUnit': 123,
                                'unitPrice': {
                                    'currencyCode': 'string',
                                    'amount': 'string'
                                }
                            },
                        ]
                    },
                    'maxQuantity': 123
                }
            }
        },
        'taxCode': 'string',
        'paymentFailurePolicy': {
            'retryAttempts': 123,
            'retryWindowDays': 123,
            'downgradeToPlanId': 'string'
        }
    },
    clientToken='string',
    tags={
        'string': 'string'
    }
)
Parameters:
  • appId (string) –

    [REQUIRED]

    The ID of the app the plan belongs to.

  • definition (dict) –

    [REQUIRED]

    The pricing and packaging definition for the plan. The plan’s identifier is not supplied here: CreatePlan mints a server-generated planId and returns it on the created plan.

    • name (string) – [REQUIRED]

      A human-readable display name for the plan.

    • description (string) –

      A human-readable description of the plan.

    • billingCycle (string) – [REQUIRED]

      How often the plan bills.

    • subscriptionPrice (dict) – [REQUIRED]

      The recurring subscription price charged each billing cycle.

      • currencyCode (string) – [REQUIRED]

        The ISO 4217 currency code (three uppercase letters, for example, “USD”).

      • amount (string) – [REQUIRED]

        An arbitrary-precision decimal represented as a string (for example, “9.99”).

    • includedQuotas (dict) –

      The usage quotas included with the plan, keyed by metric ID. Each entry prices one metric with either a flat grant or a tiered-priced grant.

      • (string) –

        The service-assigned ID of a metric.

        • (dict) –

          How one metric is priced on a plan: exactly one of a flat grant or a tiered-priced grant. Both arms carry the free allowance ( includedQuantity) with the same meaning.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: flat, tiered.

          • flat (dict) –

            A flat grant: free allowance plus an optional overage policy.

            • includedQuantity (integer) – [REQUIRED]

              The free allowance included with the plan for this metric.

            • overagePolicy (string) –

              How usage beyond the included allowance is handled.

            • overagePrice (dict) –

              The per-unit price charged for usage beyond the included allowance under a fixed overage policy.

              • currencyCode (string) – [REQUIRED]

                The ISO 4217 currency code (three uppercase letters, for example, “USD”).

              • amount (string) – [REQUIRED]

                An arbitrary-precision decimal represented as a string (for example, “9.99”).

            • tieredOverage (dict) –

              The tiered overage schedule applied to usage beyond the included allowance under a tiered overage policy.

              • semantics (string) – [REQUIRED]

                Whether the bands price graduated (each band’s units at its own rate, summed) or volume (all charged units at the rate of the band reached).

              • tiers (list) – [REQUIRED]

                The ordered price bands, from lowest units to highest.

                • (dict) –

                  One band of a tiered price or overage schedule: a unit range and the per-unit price that applies within it.

                  • firstUnit (integer) – [REQUIRED]

                    The first unit covered by this band.

                  • lastUnit (integer) –

                    The last unit covered by this band. Absent on the final, unbounded band.

                  • unitPrice (dict) – [REQUIRED]

                    The per-unit price charged within this band.

                    • currencyCode (string) – [REQUIRED]

                      The ISO 4217 currency code (three uppercase letters, for example, “USD”).

                    • amount (string) – [REQUIRED]

                      An arbitrary-precision decimal represented as a string (for example, “9.99”).

            • maxQuantity (integer) –

              Usage at which further entitlement checks for this metric are denied, in whole units per billing period, counting the included allowance. Must be at least includedQuantity (equal is a hard stop at the allowance) and is allowed only on a grant that charges past its allowance. Checked at entitlement time against usage already recorded; one allowed action’s quantity is not clamped. Prepaid usage-pack units sit outside it. One cap per billing period. Absent means no cap.

          • tiered (dict) –

            A tiered-priced grant: free allowance plus a tier-ladder price schedule.

            • includedQuantity (integer) – [REQUIRED]

              The free allowance included with the plan for this metric. May be 0, in which case the metric is tier-priced from the first charged unit.

            • tieredPrice (dict) – [REQUIRED]

              The tiered price schedule applied to charged usage for this metric.

              • semantics (string) – [REQUIRED]

                Whether the bands price graduated (each band’s units at its own rate, summed) or volume (all charged units at the rate of the band reached).

              • tiers (list) – [REQUIRED]

                The ordered price bands, from lowest units to highest. Uses the same TierBand shape (firstUnit/lastUnit/unitPrice) as tiered overage bands.

                • (dict) –

                  One band of a tiered price or overage schedule: a unit range and the per-unit price that applies within it.

                  • firstUnit (integer) – [REQUIRED]

                    The first unit covered by this band.

                  • lastUnit (integer) –

                    The last unit covered by this band. Absent on the final, unbounded band.

                  • unitPrice (dict) – [REQUIRED]

                    The per-unit price charged within this band.

                    • currencyCode (string) – [REQUIRED]

                      The ISO 4217 currency code (three uppercase letters, for example, “USD”).

                    • amount (string) – [REQUIRED]

                      An arbitrary-precision decimal represented as a string (for example, “9.99”).

            • maxQuantity (integer) –

              Usage at which further entitlement checks for this metric are denied, in whole units per billing period, counting the included allowance. Must be at least includedQuantity (equal is a hard stop at the allowance) and is allowed only on a grant that charges past its allowance. Checked at entitlement time against usage already recorded; one allowed action’s quantity is not clamped. Prepaid usage-pack units sit outside it. One cap per billing period. Absent means no cap.

    • taxCode (string) –

      The product tax code for the plan’s price. See ProductTaxCode.

    • paymentFailurePolicy (dict) –

      How the plan handles a failed recurring payment.

      • retryAttempts (integer) –

        The total number of payment attempts for a failed recurring payment, including the first attempt, before the failure is final. For example, 3 means the first attempt and up to 2 retries.

      • retryWindowDays (integer) –

        The number of days over which to retry a failed recurring payment.

      • downgradeToPlanId (string) –

        Plan to move the subscriber to once the attempts are exhausted.

  • 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.

  • tags (dict) –

    Optional tags to add to the plan when it is created. Tagging on create also requires permission for appmonetization:TagResource.

    • (string) –

      A tag key. Keys that begin with aws: (in any letter case) are reserved and rejected.

      • (string) –

        A tag value.

Return type:

dict

Returns:

Response Syntax

{
    'plan': {
        'appId': 'string',
        'planId': 'string',
        'definition': {
            'name': 'string',
            'description': 'string',
            'billingCycle': 'MONTHLY'|'ANNUAL'|'ONE_TIME',
            'subscriptionPrice': {
                'currencyCode': 'string',
                'amount': 'string'
            },
            'includedQuotas': {
                'string': {
                    'flat': {
                        'includedQuantity': 123,
                        'overagePolicy': 'NO_OVERAGE_THROTTLE'|'APPLY_FIXED_OVERAGE'|'APPLY_TIERED_OVERAGE',
                        'overagePrice': {
                            'currencyCode': 'string',
                            'amount': 'string'
                        },
                        'tieredOverage': {
                            'semantics': 'GRADUATED'|'VOLUME',
                            'tiers': [
                                {
                                    'firstUnit': 123,
                                    'lastUnit': 123,
                                    'unitPrice': {
                                        'currencyCode': 'string',
                                        'amount': 'string'
                                    }
                                },
                            ]
                        },
                        'maxQuantity': 123
                    },
                    'tiered': {
                        'includedQuantity': 123,
                        'tieredPrice': {
                            'semantics': 'GRADUATED'|'VOLUME',
                            'tiers': [
                                {
                                    'firstUnit': 123,
                                    'lastUnit': 123,
                                    'unitPrice': {
                                        'currencyCode': 'string',
                                        'amount': 'string'
                                    }
                                },
                            ]
                        },
                        'maxQuantity': 123
                    }
                }
            },
            'taxCode': 'string',
            'paymentFailurePolicy': {
                'retryAttempts': 123,
                'retryWindowDays': 123,
                'downgradeToPlanId': 'string'
            }
        },
        'stage': 'DRAFT'|'PUBLISHED',
        'createdAt': datetime(2015, 1, 1),
        'updatedAt': datetime(2015, 1, 1),
        'arn': 'string'
    }
}

Response Structure

  • (dict) –

    Output for CreatePlan.

    • plan (dict) –

      The newly created plan, carrying its server-generated planId. It exists on the draft (DRAFT) offering until it is published.

      • appId (string) –

        The ID of the app the plan belongs to.

      • planId (string) –

        The identifier of the plan. AWS App Monetization generates this value when the plan is created. It is unique within the app and is never reused. Treat it as opaque.

      • definition (dict) –

        The plan’s pricing and packaging definition.

        • name (string) –

          A human-readable display name for the plan.

        • description (string) –

          A human-readable description of the plan.

        • billingCycle (string) –

          How often the plan bills.

        • subscriptionPrice (dict) –

          The recurring subscription price charged each billing cycle.

          • currencyCode (string) –

            The ISO 4217 currency code (three uppercase letters, for example, “USD”).

          • amount (string) –

            An arbitrary-precision decimal represented as a string (for example, “9.99”).

        • includedQuotas (dict) –

          The usage quotas included with the plan, keyed by metric ID. Each entry prices one metric with either a flat grant or a tiered-priced grant.

          • (string) –

            The service-assigned ID of a metric.

            • (dict) –

              How one metric is priced on a plan: exactly one of a flat grant or a tiered-priced grant. Both arms carry the free allowance ( includedQuantity) with the same meaning.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: flat, tiered. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • flat (dict) –

                A flat grant: free allowance plus an optional overage policy.

                • includedQuantity (integer) –

                  The free allowance included with the plan for this metric.

                • overagePolicy (string) –

                  How usage beyond the included allowance is handled.

                • overagePrice (dict) –

                  The per-unit price charged for usage beyond the included allowance under a fixed overage policy.

                  • currencyCode (string) –

                    The ISO 4217 currency code (three uppercase letters, for example, “USD”).

                  • amount (string) –

                    An arbitrary-precision decimal represented as a string (for example, “9.99”).

                • tieredOverage (dict) –

                  The tiered overage schedule applied to usage beyond the included allowance under a tiered overage policy.

                  • semantics (string) –

                    Whether the bands price graduated (each band’s units at its own rate, summed) or volume (all charged units at the rate of the band reached).

                  • tiers (list) –

                    The ordered price bands, from lowest units to highest.

                    • (dict) –

                      One band of a tiered price or overage schedule: a unit range and the per-unit price that applies within it.

                      • firstUnit (integer) –

                        The first unit covered by this band.

                      • lastUnit (integer) –

                        The last unit covered by this band. Absent on the final, unbounded band.

                      • unitPrice (dict) –

                        The per-unit price charged within this band.

                        • currencyCode (string) –

                          The ISO 4217 currency code (three uppercase letters, for example, “USD”).

                        • amount (string) –

                          An arbitrary-precision decimal represented as a string (for example, “9.99”).

                • maxQuantity (integer) –

                  Usage at which further entitlement checks for this metric are denied, in whole units per billing period, counting the included allowance. Must be at least includedQuantity (equal is a hard stop at the allowance) and is allowed only on a grant that charges past its allowance. Checked at entitlement time against usage already recorded; one allowed action’s quantity is not clamped. Prepaid usage-pack units sit outside it. One cap per billing period. Absent means no cap.

              • tiered (dict) –

                A tiered-priced grant: free allowance plus a tier-ladder price schedule.

                • includedQuantity (integer) –

                  The free allowance included with the plan for this metric. May be 0, in which case the metric is tier-priced from the first charged unit.

                • tieredPrice (dict) –

                  The tiered price schedule applied to charged usage for this metric.

                  • semantics (string) –

                    Whether the bands price graduated (each band’s units at its own rate, summed) or volume (all charged units at the rate of the band reached).

                  • tiers (list) –

                    The ordered price bands, from lowest units to highest. Uses the same TierBand shape (firstUnit/lastUnit/unitPrice) as tiered overage bands.

                    • (dict) –

                      One band of a tiered price or overage schedule: a unit range and the per-unit price that applies within it.

                      • firstUnit (integer) –

                        The first unit covered by this band.

                      • lastUnit (integer) –

                        The last unit covered by this band. Absent on the final, unbounded band.

                      • unitPrice (dict) –

                        The per-unit price charged within this band.

                        • currencyCode (string) –

                          The ISO 4217 currency code (three uppercase letters, for example, “USD”).

                        • amount (string) –

                          An arbitrary-precision decimal represented as a string (for example, “9.99”).

                • maxQuantity (integer) –

                  Usage at which further entitlement checks for this metric are denied, in whole units per billing period, counting the included allowance. Must be at least includedQuantity (equal is a hard stop at the allowance) and is allowed only on a grant that charges past its allowance. Checked at entitlement time against usage already recorded; one allowed action’s quantity is not clamped. Prepaid usage-pack units sit outside it. One cap per billing period. Absent means no cap.

        • taxCode (string) –

          The product tax code for the plan’s price. See ProductTaxCode.

        • paymentFailurePolicy (dict) –

          How the plan handles a failed recurring payment.

          • retryAttempts (integer) –

            The total number of payment attempts for a failed recurring payment, including the first attempt, before the failure is final. For example, 3 means the first attempt and up to 2 retries.

          • retryWindowDays (integer) –

            The number of days over which to retry a failed recurring payment.

          • downgradeToPlanId (string) –

            Plan to move the subscriber to once the attempts are exhausted.

      • stage (string) –

        The offering stage the plan was read from.

      • createdAt (datetime) –

        The time the plan was created.

      • updatedAt (datetime) –

        The time the plan was last updated.

      • arn (string) –

        The Amazon Resource Name (ARN) of the plan.

Exceptions

  • AppMonetization.Client.exceptions.AccessDeniedException

  • AppMonetization.Client.exceptions.ValidationException

  • AppMonetization.Client.exceptions.ConflictException

  • AppMonetization.Client.exceptions.InvalidConfigurationException

  • AppMonetization.Client.exceptions.IdempotencyConflictException

  • AppMonetization.Client.exceptions.InternalServerException

  • AppMonetization.Client.exceptions.ServiceQuotaExceededException

  • AppMonetization.Client.exceptions.ResourceNotFoundException

  • AppMonetization.Client.exceptions.RevisionConflictException

  • AppMonetization.Client.exceptions.ThrottlingException