create_one_time_checkout_session
¶
create_one_time_checkout_session(
app_id: AppId,
user_id: UserId,
items: CheckoutItemList,
return_url: Url,
scope: RequestScope,
*,
config_overrides: Optional[AppMonetizationClientConfig] = None,
client_token: Optional[ClientToken] = None,
) -> CreateOneTimeCheckoutSessionResponse
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.
Parameters:
-
app_id(AppId) –The ID of the app the purchase is for.
-
user_id(UserId) –The ID of the end user making the purchase. Do not include personally identifiable or otherwise sensitive data in this value.
-
items(CheckoutItemList) –The purchasables to buy. Each line is a usage pack or add-on and the number of units to buy.
-
return_url(Url) –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.
-
client_token(Optional[ClientToken], default:None) –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.
-
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.
-
ServiceUnavailableException–The service is temporarily unavailable. Retry the request after the time in retryAfterSeconds.
-
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.