cancel_subscription
async
¶
cancel_subscription(
app_id: AppId,
user_id: UserId,
effective_at: Timestamp,
scope: RequestScope,
*,
config_overrides: Optional[AsyncAppMonetizationClientConfig] = None,
) -> CancelSubscriptionResponse
Cancels a user's subscription at the end of the current billing period.
Parameters:
-
app_id(AppId) –The ID of the app.
-
user_id(UserId) –An opaque identifier that you assign to an end user. Do not include personally identifiable or otherwise sensitive data in this value.
-
effective_at(Timestamp) –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(RequestScope) –Required. The environment: live or sandbox.
Raises:
-
AccessDeniedException–The caller does not have sufficient permission to perform this action.
-
ConflictException–The request conflicts with the current state of the resource, such as a duplicate identifier or a version mismatch. Retrieve the current state of the resource and retry the request.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ResourceNotFoundException–The referenced resource does not exist.
-
ThrottlingException–The request was denied due to request throttling.
-
ValidationException–The request failed input validation.
-
UnknownServiceError–The service returned an error code this client does not model.