AppMonetization / Client / cancel_subscription
cancel_subscription¶
- AppMonetization.Client.cancel_subscription(**kwargs)¶
Cancels a user’s subscription at the end of the current billing period.
See also: AWS API Documentation
Request Syntax
response = client.cancel_subscription( appId='string', userId='string', effectiveAt=datetime(2015, 1, 1), scope='sandbox'|'live' )
- Parameters:
appId (string) –
[REQUIRED]
The ID of the app.
userId (string) –
[REQUIRED]
An opaque identifier that you assign to an end user. Do not include personally identifiable or otherwise sensitive data in this value.
effectiveAt (datetime) –
[REQUIRED]
The subscription’s current effective time, as returned by GetSubscription, used as an optimistic-concurrency check. If GetSubscription returns a pending change, pass
pendingChange.effectiveAt; otherwise passsubscription.effectiveAt. This value does not choose when the cancellation takes effect: a new cancellation takes effect at the end of the current billing period, returned ascancellationEffectiveAt. If the subscription’s effective time has changed since you read it (for example, because another plan change was made), the value no longer matches and the request fails with ConflictException; call GetSubscription again and retry with the new value. If the subscription is already cancelled or a cancellation is already scheduled, the request returns its current state and does not compare this value.scope (string) –
[REQUIRED]
Required. The environment: live or sandbox.
- Return type:
dict
- Returns:
Response Syntax
{ 'subscription': { 'appId': 'string', 'userId': 'string', 'planId': 'string', 'effectiveAt': datetime(2015, 1, 1), 'billingAnchorDate': datetime(2015, 1, 1), 'billingCycle': 'MONTHLY'|'ANNUAL'|'ONE_TIME' }, 'cancellationEffectiveAt': datetime(2015, 1, 1) }
Response Structure
(dict) –
Output for CancelSubscription.
subscription (dict) –
The subscription as it stands after the cancellation is scheduled.
appId (string) –
The ID of the app that the subscription belongs to.
userId (string) –
The opaque end-user identifier that the subscription belongs to.
planId (string) –
The ID of the plan that the user is subscribed to.
effectiveAt (datetime) –
The time when the subscription took effect.
billingAnchorDate (datetime) –
The fixed reference instant the recurring billing cycle is measured from. It is set when the subscription first takes effect and stays fixed as periods roll forward, so it is normally an older date than the current period — not the start of the current period. For the end of the current cycle, use
currentPeriodEndsAton GetSubscriptionResponse (derived from this anchor and the billing cycle) rather than this value.billingCycle (string) –
The billing cycle of the subscription, such as monthly or annual.
cancellationEffectiveAt (datetime) –
The time when the cancellation takes effect, at the end of the current billing period. The subscription remains active until this time.
Exceptions
AppMonetization.Client.exceptions.AccessDeniedExceptionAppMonetization.Client.exceptions.ValidationExceptionAppMonetization.Client.exceptions.ConflictExceptionAppMonetization.Client.exceptions.InternalServerExceptionAppMonetization.Client.exceptions.ResourceNotFoundExceptionAppMonetization.Client.exceptions.ThrottlingException