appstoreserverlibrary.api_client module¶
- class appstoreserverlibrary.api_client.APIError(value)[source]¶
Bases:
IntEnum- ACCOUNT_NOT_FOUND = 4040001¶
An error that indicates the App Store account wasn’t found.
https://developer.apple.com/documentation/appstoreserverapi/accountnotfounderror
- ACCOUNT_NOT_FOUND_RETRYABLE = 4040002¶
An error response that indicates the App Store account wasn’t found, but you can try again.
https://developer.apple.com/documentation/appstoreserverapi/accountnotfoundretryableerror
- ALT_TEXT_TOO_LONG = 4000175¶
An error that indicates the alternative text for an image is too long.
https://developer.apple.com/documentation/retentionmessaging/alttexttoolongerror
- APP_NOT_FOUND = 4040003¶
An error that indicates the app wasn’t found.
https://developer.apple.com/documentation/appstoreserverapi/appnotfounderror
- APP_NOT_FOUND_RETRYABLE = 4040004¶
An error response that indicates the app wasn’t found, but you can try again.
https://developer.apple.com/documentation/appstoreserverapi/appnotfoundretryableerror
- APP_TRANSACTION_DOES_NOT_EXIST_ERROR = 4040019¶
An error response that indicates an app transaction doesn’t exist for the specified customer.
https://developer.apple.com/documentation/appstoreserverapi/apptransactiondoesnotexisterror
- APP_TRANSACTION_ID_NOT_SUPPORTED_ERROR = 4000048¶
An error that indicates the endpoint doesn’t support an app transaction ID.
https://developer.apple.com/documentation/appstoreserverapi/apptransactionidnotsupportederror
- BODY_TOO_LONG = 4000163¶
An error that indicates the body text is too long.
https://developer.apple.com/documentation/retentionmessaging/bodytoolongerror
- FAMILY_SHARED_SUBSCRIPTION_EXTENSION_INELIGIBLE = 4030007¶
An error that indicates a subscription isn’t directly eligible for a renewal date extension because the user obtained it through Family Sharing.
- FAMILY_TRANSACTION_NOT_SUPPORTED_ERROR = 4000185¶
An error that indicates the transaction is for a product the customer obtains through Family Sharing, which the endpoint doesn’t support.
https://developer.apple.com/documentation/appstoreserverapi/familytransactionnotsupportederror
- GENERAL_BAD_REQUEST = 4000000¶
An error that indicates an invalid request.
https://developer.apple.com/documentation/appstoreserverapi/generalbadrequesterror
- GENERAL_INTERNAL = 5000000¶
An error that indicates a general internal error.
https://developer.apple.com/documentation/appstoreserverapi/generalinternalerror
- GENERAL_INTERNAL_RETRYABLE = 5000001¶
An error response that indicates an unknown error occurred, but you can try again.
https://developer.apple.com/documentation/appstoreserverapi/generalinternalretryableerror
- HEADER_TOO_LONG = 4000162¶
An error that indicates the header text is too long.
https://developer.apple.com/documentation/retentionmessaging/headertoolongerror
- IMAGE_ALREADY_EXISTS = 4090000¶
An error that indicates the image identifier already exists.
https://developer.apple.com/documentation/retentionmessaging/imagealreadyexistserror
- IMAGE_IN_USE = 4030019¶
An error that indicates the image is currently in use as part of a message, so you can’t delete it.
https://developer.apple.com/documentation/retentionmessaging/imageinuseerror
- IMAGE_NOT_APPROVED = 4030018¶
An error that indicates the image isn’t in the approved state, so you can’t configure it as part of a default message.
https://developer.apple.com/documentation/retentionmessaging/imagenotapprovederror
- IMAGE_NOT_FOUND = 4040014¶
An error that indicates the system can’t find the image identifier.
https://developer.apple.com/documentation/retentionmessaging/imagenotfounderror
- INVALID_ACCOUNT_TENURE = 4000032¶
An error that indicates the value of the account tenure field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidaccounttenureerror
- INVALID_APP_ACCOUNT_TOKEN = 4000033¶
An error that indicates the value of the app account token field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidappaccounttokenerror
- INVALID_APP_ACCOUNT_TOKEN_UUID_ERROR = 4000183¶
An error that indicates the app account token value is not a valid UUID.
https://developer.apple.com/documentation/appstoreserverapi/invalidappaccounttokenuuiderror
- INVALID_APP_IDENTIFIER = 4000002¶
An error that indicates an invalid app identifier.
https://developer.apple.com/documentation/appstoreserverapi/invalidappidentifiererror
- INVALID_CONSUMPTION_STATUS = 4000034¶
An error that indicates the value of the consumption status field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidconsumptionstatuserror
- INVALID_CUSTOMER_CONSENTED = 4000035¶
An error that indicates the customer consented field is invalid or doesn’t indicate that the customer consented.
https://developer.apple.com/documentation/appstoreserverapi/invalidcustomerconsentederror
- INVALID_DELIVERY_STATUS = 4000036¶
An error that indicates the value in the delivery status field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invaliddeliverystatuserror
- INVALID_EMPTY_STOREFRONT_COUNTRY_CODE_LIST = 4000027¶
An error that indicates a required storefront country code is empty.
- INVALID_END_DATE = 4000016¶
An error that indicates the end date is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidenddateerror
- INVALID_EXCLUDE_REVOKED = 4000025¶
An error that indicates the query parameter exclude-revoked is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidexcluderevokederror
Deprecated since version 1.5.
- INVALID_EXTEND_BY_DAYS = 4000009¶
An error that indicates an invalid extend-by-days value.
https://developer.apple.com/documentation/appstoreserverapi/invalidextendbydayserror
- INVALID_EXTEND_REASON_CODE = 4000010¶
An error that indicates an invalid reason code.
https://developer.apple.com/documentation/appstoreserverapi/invalidextendreasoncodeerror
- INVALID_IMAGE = 4000161¶
An error that indicates the image that’s uploading is invalid.
https://developer.apple.com/documentation/retentionmessaging/invalidimageerror
- INVALID_IN_APP_OWNERSHIP_TYPE = 4000026¶
An error that indicates an invalid in-app ownership type parameter.
https://developer.apple.com/documentation/appstoreserverapi/invalidinappownershiptypeerror
- INVALID_LIFETIME_DOLLARS_PURCHASED = 4000037¶
An error that indicates the value in the lifetime dollars purchased field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidlifetimedollarspurchasederror
- INVALID_LIFETIME_DOLLARS_REFUNDED = 4000038¶
An error that indicates the value in the lifetime dollars refunded field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidlifetimedollarsrefundederror
- INVALID_LOCALE = 4000164¶
An error that indicates the locale is invalid.
https://developer.apple.com/documentation/retentionmessaging/invalidlocaleerror
- INVALID_NOTIFICATION_TYPE = 4000018¶
An error that indicates the notification type or subtype is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidnotificationtypeerror
- INVALID_ORIGINAL_TRANSACTION_ID = 4000008¶
An error that indicates an invalid original transaction identifier.
https://developer.apple.com/documentation/appstoreserverapi/invalidoriginaltransactioniderror
- INVALID_PAGINATION_TOKEN = 4000014¶
An error that indicates the pagination token is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidpaginationtokenerror
- INVALID_PLATFORM = 4000039¶
An error that indicates the value in the platform field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidplatformerror
- INVALID_PLAY_TIME = 4000040¶
An error that indicates the value in the playtime field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidplaytimeerror
- INVALID_PRODUCT_ID = 4000023¶
An error that indicates the product ID parameter is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidproductiderror
- INVALID_PRODUCT_TYPE = 4000022¶
An error that indicates an invalid product type parameter.
https://developer.apple.com/documentation/appstoreserverapi/invalidproducttypeerror
- INVALID_REQUEST_IDENTIFIER = 4000011¶
An error that indicates an invalid request identifier.
https://developer.apple.com/documentation/appstoreserverapi/invalidrequestidentifiererror
- INVALID_REQUEST_REVISION = 4000005¶
An error that indicates an invalid request revision.
https://developer.apple.com/documentation/appstoreserverapi/invalidrequestrevisionerror
- INVALID_REVOKED = 4000030¶
An error that indicates the revoked parameter contains an invalid value.
https://developer.apple.com/documentation/appstoreserverapi/invalidrevokederror
- INVALID_SAMPLE_CONTENT_PROVIDED = 4000041¶
An error that indicates the value in the sample content provided field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidsamplecontentprovidederror
- INVALID_SORT = 4000021¶
An error that indicates an invalid sort parameter.
https://developer.apple.com/documentation/appstoreserverapi/invalidsorterror
- INVALID_START_DATE = 4000015¶
An error that indicates the start date is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidstartdateerror
- INVALID_STATUS = 4000031¶
An error that indicates the status parameter is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidstatuserror
- INVALID_STOREFRONT_COUNTRY_CODE = 4000028¶
An error that indicates a storefront code is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidstorefrontcountrycodeerror
- INVALID_SUBSCRIPTION_GROUP_IDENTIFIER = 4000024¶
An error that indicates an invalid subscription group identifier.
https://developer.apple.com/documentation/appstoreserverapi/invalidsubscriptiongroupidentifiererror
- INVALID_TEST_NOTIFICATION_TOKEN = 4000020¶
An error that indicates the test notification token is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invalidtestnotificationtokenerror
- INVALID_TRANSACTION_ID = 4000006¶
An error that indicates an invalid transaction identifier.
https://developer.apple.com/documentation/appstoreserverapi/invalidtransactioniderror
- INVALID_TRANSACTION_NOT_CONSUMABLE = 4000043¶
An error that indicates the transaction identifier doesn’t represent a consumable in-app purchase.
https://developer.apple.com/documentation/appstoreserverapi/invalidtransactionnotconsumableerror
Deprecated since version 1.11.
- INVALID_TRANSACTION_TYPE_NOT_SUPPORTED = 4000047¶
An error that indicates the transaction identifier represents an unsupported in-app purchase type.
https://developer.apple.com/documentation/appstoreserverapi/invalidtransactiontypenotsupportederror
- INVALID_USER_STATUS = 4000042¶
An error that indicates the value in the user status field is invalid.
https://developer.apple.com/documentation/appstoreserverapi/invaliduserstatuserror
- MAXIMUM_NUMBER_OF_IMAGES_REACHED = 4030014¶
An error that indicates when you reach the maximum number of uploaded images.
https://developer.apple.com/documentation/retentionmessaging/maximumnumberofimagesreachederror
- MAXIMUM_NUMBER_OF_MESSAGES_REACHED = 4030016¶
An error that indicates when you reach the maximum number of uploaded messages.
https://developer.apple.com/documentation/retentionmessaging/maximumnumberofmessagesreachederror
- MESSAGE_ALREADY_EXISTS = 4090001¶
An error that indicates the message identifier already exists.
https://developer.apple.com/documentation/retentionmessaging/messagealreadyexistserror
- MESSAGE_NOT_APPROVED = 4030017¶
An error that indicates the message isn’t in the approved state, so you can’t configure it as a default message.
https://developer.apple.com/documentation/retentionmessaging/messagenotapprovederror
- MESSAGE_NOT_FOUND = 4040015¶
An error that indicates the system can’t find the message identifier.
https://developer.apple.com/documentation/retentionmessaging/messagenotfounderror
- MULTIPLE_FILTERS_SUPPLIED = 4000019¶
An error that indicates the request is invalid because it has too many constraints applied.
https://developer.apple.com/documentation/appstoreserverapi/multiplefilterssuppliederror
- ORIGINAL_TRANSACTION_ID_NOT_FOUND = 4040005¶
An error that indicates an original transaction identifier wasn’t found.
https://developer.apple.com/documentation/appstoreserverapi/originaltransactionidnotfounderror
- ORIGINAL_TRANSACTION_ID_NOT_FOUND_RETRYABLE = 4040006¶
An error response that indicates the original transaction identifier wasn’t found, but you can try again.
- PAGINATION_TOKEN_EXPIRED = 4000017¶
An error that indicates the pagination token expired.
https://developer.apple.com/documentation/appstoreserverapi/paginationtokenexpirederror
- RATE_LIMIT_EXCEEDED = 4290000¶
An error that indicates that the request exceeded the rate limit.
https://developer.apple.com/documentation/appstoreserverapi/ratelimitexceedederror
- SERVER_NOTIFICATION_URL_NOT_FOUND = 4040007¶
An error that indicates that the App Store server couldn’t find a notifications URL for your app in this environment.
https://developer.apple.com/documentation/appstoreserverapi/servernotificationurlnotfounderror
- START_DATE_AFTER_END_DATE = 4000013¶
An error that indicates that the end date precedes the start date, or the two dates are equal.
https://developer.apple.com/documentation/appstoreserverapi/startdateafterenddateerror
- START_DATE_TOO_FAR_IN_PAST = 4000012¶
An error that indicates that the start date is earlier than the earliest allowed date.
https://developer.apple.com/documentation/appstoreserverapi/startdatetoofarinpasterror
- STATUS_REQUEST_NOT_FOUND = 4040009¶
An error that indicates the server didn’t find a subscription-renewal-date extension request for the request identifier and product identifier you provided.
https://developer.apple.com/documentation/appstoreserverapi/statusrequestnotfounderror
- SUBSCRIPTION_EXTENSION_INELIGIBLE = 4030004¶
An error that indicates the subscription doesn’t qualify for a renewal-date extension due to its subscription state.
https://developer.apple.com/documentation/appstoreserverapi/subscriptionextensionineligibleerror
- SUBSCRIPTION_MAX_EXTENSION = 4030005¶
An error that indicates the subscription doesn’t qualify for a renewal-date extension because it has already received the maximum extensions.
https://developer.apple.com/documentation/appstoreserverapi/subscriptionmaxextensionerror
- TEST_NOTIFICATION_NOT_FOUND = 4040008¶
An error that indicates that the test notification token is expired or the test notification status isn’t available.
https://developer.apple.com/documentation/appstoreserverapi/testnotificationnotfounderror
- TRANSACTION_ID_IS_NOT_ORIGINAL_TRANSACTION_ID_ERROR = 4000187¶
An error that indicates the endpoint expects an original transaction identifier.
- TRANSACTION_ID_NOT_FOUND = 4040010¶
An error that indicates a transaction identifier wasn’t found.
https://developer.apple.com/documentation/appstoreserverapi/transactionidnotfounderror
- exception appstoreserverlibrary.api_client.APIException(http_status_code: int, raw_api_error: int | None = None, error_message: str | None = None)[source]¶
Bases:
Exception- error_message: str | None¶
- http_status_code: int¶
- raw_api_error: int | None¶
- class appstoreserverlibrary.api_client.AppStoreServerAPIClient(signing_key: bytes, key_id: str, issuer_id: str, bundle_id: str, environment: Environment)[source]¶
Bases:
BaseAppStoreServerAPIClient- configure_default_message(product_id: str, locale: str, default_configuration_request: DefaultConfigurationRequest)[source]¶
Configure a default message for a specific product in a specific locale.
- Parameters:
product_id – The product identifier for the default configuration.
locale – The locale for the default configuration.
default_configuration_request – The request body that includes the message identifier to configure as the default message.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/configure-default-message
- delete_default_message(product_id: str, locale: str)[source]¶
Delete a default message for a product in a locale.
- Parameters:
product_id – The product ID of the default message configuration.
locale – The locale of the default message configuration.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/delete-default-message
- delete_image(image_identifier: UUID)[source]¶
Delete a previously uploaded image.
- Parameters:
image_identifier – The identifier of the image to delete.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/delete-image
- delete_message(message_identifier: UUID)[source]¶
Delete a previously uploaded message.
- Parameters:
message_identifier – The identifier of the message to delete.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/delete-message
- extend_renewal_date_for_all_active_subscribers(mass_extend_renewal_date_request: MassExtendRenewalDateRequest) MassExtendRenewalDateResponse[source]¶
Uses a subscription’s product identifier to extend the renewal date for all of its eligible active subscribers. https://developer.apple.com/documentation/appstoreserverapi/extend_subscription_renewal_dates_for_all_active_subscribers
- Parameters:
mass_extend_renewal_date_request – The request body for extending a subscription renewal date for all of its active subscribers.
- Returns:
A response that indicates the server successfully received the subscription-renewal-date extension request.
- Throws APIException:
If a response was returned indicating the request could not be processed
- extend_subscription_renewal_date(original_transaction_id: str, extend_renewal_date_request: ExtendRenewalDateRequest) ExtendRenewalDateResponse[source]¶
Extends the renewal date of a customer’s active subscription using the original transaction identifier. https://developer.apple.com/documentation/appstoreserverapi/extend_a_subscription_renewal_date
- Parameters:
original_transaction_id – The original transaction identifier of the subscription receiving a renewal date extension.
extend_renewal_date_request – The request body containing subscription-renewal-extension data.
- Returns:
A response that indicates whether an individual renewal-date extension succeeded, and related details.
- Throws APIException:
If a response was returned indicating the request could not be processed
- get_all_subscription_statuses(transaction_id: str, status: List[Status] | None = None) StatusResponse[source]¶
Get the statuses for all of a customer’s auto-renewable subscriptions in your app. https://developer.apple.com/documentation/appstoreserverapi/get_all_subscription_statuses
- Parameters:
transaction_id – The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.
status – An optional filter that indicates the status of subscriptions to include in the response. Your query may specify more than one status query parameter.
- Returns:
A response that contains status information for all of a customer’s auto-renewable subscriptions in your app.
- Throws APIException:
If a response was returned indicating the request could not be processed
- get_app_transaction_info(transaction_id: str) AppTransactionInfoResponse[source]¶
Get a customer’s app transaction information for your app.
:param transaction_id Any originalTransactionId, transactionId or appTransactionId that belongs to the customer for your app. :return: A response that contains signed app transaction information for a customer. :raises APIException: If a response was returned indicating the request could not be processed :see: https://developer.apple.com/documentation/appstoreserverapi/get-app-transaction-info
- get_image_list() GetImageListResponse[source]¶
Get the image identifier and state for all uploaded images.
- Returns:
A response that contains status information for all images.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/get-image-list
- get_message_list() GetMessageListResponse[source]¶
Get the message identifier and state of all uploaded messages.
- Returns:
A response that contains status information for all messages.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/get-message-list
- get_notification_history(pagination_token: str | None, notification_history_request: NotificationHistoryRequest) NotificationHistoryResponse[source]¶
Get a list of notifications that the App Store server attempted to send to your server. https://developer.apple.com/documentation/appstoreserverapi/get_notification_history
- Parameters:
pagination_token – An optional token you use to get the next set of up to 20 notification history records. All responses that have more records available include a paginationToken. Omit this parameter the first time you call this endpoint.
notification_history_request – The request body that includes the start and end dates, and optional query constraints.
- Returns:
A response that contains the App Store Server Notifications history for your app.
- Throws APIException:
If a response was returned indicating the request could not be processed
- get_refund_history(transaction_id: str, revision: str | None) RefundHistoryResponse[source]¶
Get a paginated list of all of a customer’s refunded in-app purchases for your app. https://developer.apple.com/documentation/appstoreserverapi/get_refund_history
- Parameters:
transaction_id – The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.
revision – A token you provide to get the next set of up to 20 transactions. All responses include a revision token. Use the revision token from the previous RefundHistoryResponse.
- Returns:
A response that contains status information for all of a customer’s auto-renewable subscriptions in your app.
- Throws APIException:
If a response was returned indicating the request could not be processed
- get_status_of_subscription_renewal_date_extensions(request_identifier: str, product_id: str) MassExtendRenewalDateStatusResponse[source]¶
Checks whether a renewal date extension request completed, and provides the final count of successful or failed extensions. https://developer.apple.com/documentation/appstoreserverapi/get_status_of_subscription_renewal_date_extensions
- Parameters:
request_identifier – The UUID that represents your request to the Extend Subscription Renewal Dates for All Active Subscribers endpoint.
product_id – The product identifier of the auto-renewable subscription that you request a renewal-date extension for.
- Returns:
A response that indicates the current status of a request to extend the subscription renewal date to all eligible subscribers.
- Throws APIException:
If a response was returned indicating the request could not be processed
- get_test_notification_status(test_notification_token: str) CheckTestNotificationResponse[source]¶
Check the status of the test App Store server notification sent to your server. https://developer.apple.com/documentation/appstoreserverapi/get_test_notification_status
- Parameters:
test_notification_token – The test notification token received from the Request a Test Notification endpoint
- Returns:
A response that contains the contents of the test notification sent by the App Store server and the result from your server.
- Throws APIException:
If a response was returned indicating the request could not be processed
- get_transaction_history(transaction_id: str, revision: str | None, transaction_history_request: TransactionHistoryRequest, version: GetTransactionHistoryVersion = GetTransactionHistoryVersion.V1) HistoryResponse[source]¶
Get a customer’s in-app purchase transaction history for your app. https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history
- Parameters:
transaction_id – The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.
revision – A token you provide to get the next set of up to 20 transactions. All responses include a revision token. Note: For requests that use the revision token, include the same query parameters from the initial request. Use the revision token from the previous HistoryResponse.
transaction_history_request – The request parameters that includes the startDate,endDate,productIds,productTypes and optional query constraints.
version – The version of the Get Transaction History endpoint to use. V2 is recommended.
- Returns:
A response that contains the customer’s transaction history for an app.
- Throws APIException:
If a response was returned indicating the request could not be processed
- get_transaction_info(transaction_id: str) TransactionInfoResponse[source]¶
Get information about a single transaction for your app. https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info
:param transaction_id The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier. :return: A response that contains signed transaction information for a single transaction. :throws APIException: If a response was returned indicating the request could not be processed
- look_up_order_id(order_id: str) OrderLookupResponse[source]¶
Get a customer’s in-app purchases from a receipt using the order ID. https://developer.apple.com/documentation/appstoreserverapi/look_up_order_id
- Parameters:
order_id – The order ID for in-app purchases that belong to the customer.
- Returns:
A response that includes the order lookup status and an array of signed transactions for the in-app purchases in the order.
- Throws APIException:
If a response was returned indicating the request could not be processed
- request_test_notification() SendTestNotificationResponse[source]¶
Ask App Store Server Notifications to send a test notification to your server. https://developer.apple.com/documentation/appstoreserverapi/request_a_test_notification
- Returns:
A response that contains the test notification token.
- Throws APIException:
If a response was returned indicating the request could not be processed
- send_consumption_data(transaction_id: str, consumption_request: ConsumptionRequest)[source]¶
Send consumption information about a consumable in-app purchase to the App Store after your server receives a consumption request notification. https://developer.apple.com/documentation/appstoreserverapi/send_consumption_information
- Parameters:
transaction_id – The transaction identifier for which you’re providing consumption information. You receive this identifier in the CONSUMPTION_REQUEST notification the App Store sends to your server.
consumption_request – The request body containing consumption information.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- set_app_account_token(original_transaction_id: str, update_app_account_token_request: UpdateAppAccountTokenRequest)[source]¶
Sets the app account token value for a purchase the customer makes outside your app, or updates its value in an existing transaction. https://developer.apple.com/documentation/appstoreserverapi/set-app-account-token
:param original_transaction_id The original transaction identifier of the transaction to receive the app account token update. :param update_app_account_token_request The request body that contains a valid app account token value. :raises APIException: If a response was returned indicating the request could not be processed
- upload_image(image_identifier: UUID, image: bytes)[source]¶
Upload an image to use for retention messaging.
- Parameters:
image_identifier – A UUID you provide to uniquely identify the image you upload.
image – The image file to upload.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/upload-image
- upload_message(message_identifier: UUID, upload_message_request_body: UploadMessageRequestBody)[source]¶
Upload a message to use for retention messaging.
- Parameters:
message_identifier – A UUID you provide to uniquely identify the message you upload.
upload_message_request_body – The message text to upload.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/upload-message
- class appstoreserverlibrary.api_client.AsyncAppStoreServerAPIClient(signing_key: bytes, key_id: str, issuer_id: str, bundle_id: str, environment: Environment)[source]¶
Bases:
BaseAppStoreServerAPIClient- async configure_default_message(product_id: str, locale: str, default_configuration_request: DefaultConfigurationRequest)[source]¶
Configure a default message for a specific product in a specific locale.
- Parameters:
product_id – The product identifier for the default configuration.
locale – The locale for the default configuration.
default_configuration_request – The request body that includes the message identifier to configure as the default message.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/configure-default-message
- async delete_default_message(product_id: str, locale: str)[source]¶
Delete a default message for a product in a locale.
- Parameters:
product_id – The product ID of the default message configuration.
locale – The locale of the default message configuration.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/delete-default-message
- async delete_image(image_identifier: UUID)[source]¶
Delete a previously uploaded image.
- Parameters:
image_identifier – The identifier of the image to delete.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/delete-image
- async delete_message(message_identifier: UUID)[source]¶
Delete a previously uploaded message.
- Parameters:
message_identifier – The identifier of the message to delete.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/delete-message
- async extend_renewal_date_for_all_active_subscribers(mass_extend_renewal_date_request: MassExtendRenewalDateRequest) MassExtendRenewalDateResponse[source]¶
Uses a subscription’s product identifier to extend the renewal date for all of its eligible active subscribers. https://developer.apple.com/documentation/appstoreserverapi/extend_subscription_renewal_dates_for_all_active_subscribers
- Parameters:
mass_extend_renewal_date_request – The request body for extending a subscription renewal date for all of its active subscribers.
- Returns:
A response that indicates the server successfully received the subscription-renewal-date extension request.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async extend_subscription_renewal_date(original_transaction_id: str, extend_renewal_date_request: ExtendRenewalDateRequest) ExtendRenewalDateResponse[source]¶
Extends the renewal date of a customer’s active subscription using the original transaction identifier. https://developer.apple.com/documentation/appstoreserverapi/extend_a_subscription_renewal_date
- Parameters:
original_transaction_id – The original transaction identifier of the subscription receiving a renewal date extension.
extend_renewal_date_request – The request body containing subscription-renewal-extension data.
- Returns:
A response that indicates whether an individual renewal-date extension succeeded, and related details.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async get_all_subscription_statuses(transaction_id: str, status: List[Status] | None = None) StatusResponse[source]¶
Get the statuses for all of a customer’s auto-renewable subscriptions in your app. https://developer.apple.com/documentation/appstoreserverapi/get_all_subscription_statuses
- Parameters:
transaction_id – The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.
status – An optional filter that indicates the status of subscriptions to include in the response. Your query may specify more than one status query parameter.
- Returns:
A response that contains status information for all of a customer’s auto-renewable subscriptions in your app.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async get_app_transaction_info(transaction_id: str) AppTransactionInfoResponse[source]¶
Get a customer’s app transaction information for your app.
:param transaction_id Any originalTransactionId, transactionId or appTransactionId that belongs to the customer for your app. :return: A response that contains signed app transaction information for a customer. :raises APIException: If a response was returned indicating the request could not be processed :see: https://developer.apple.com/documentation/appstoreserverapi/get-app-transaction-info
- async get_image_list() GetImageListResponse[source]¶
Get the image identifier and state for all uploaded images.
- Returns:
A response that contains status information for all images.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/get-image-list
- async get_message_list() GetMessageListResponse[source]¶
Get the message identifier and state of all uploaded messages.
- Returns:
A response that contains status information for all messages.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/get-message-list
- async get_notification_history(pagination_token: str | None, notification_history_request: NotificationHistoryRequest) NotificationHistoryResponse[source]¶
Get a list of notifications that the App Store server attempted to send to your server. https://developer.apple.com/documentation/appstoreserverapi/get_notification_history
- Parameters:
pagination_token – An optional token you use to get the next set of up to 20 notification history records. All responses that have more records available include a paginationToken. Omit this parameter the first time you call this endpoint.
notification_history_request – The request body that includes the start and end dates, and optional query constraints.
- Returns:
A response that contains the App Store Server Notifications history for your app.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async get_refund_history(transaction_id: str, revision: str | None) RefundHistoryResponse[source]¶
Get a paginated list of all of a customer’s refunded in-app purchases for your app. https://developer.apple.com/documentation/appstoreserverapi/get_refund_history
- Parameters:
transaction_id – The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.
revision – A token you provide to get the next set of up to 20 transactions. All responses include a revision token. Use the revision token from the previous RefundHistoryResponse.
- Returns:
A response that contains status information for all of a customer’s auto-renewable subscriptions in your app.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async get_status_of_subscription_renewal_date_extensions(request_identifier: str, product_id: str) MassExtendRenewalDateStatusResponse[source]¶
Checks whether a renewal date extension request completed, and provides the final count of successful or failed extensions. https://developer.apple.com/documentation/appstoreserverapi/get_status_of_subscription_renewal_date_extensions
- Parameters:
request_identifier – The UUID that represents your request to the Extend Subscription Renewal Dates for All Active Subscribers endpoint.
product_id – The product identifier of the auto-renewable subscription that you request a renewal-date extension for.
- Returns:
A response that indicates the current status of a request to extend the subscription renewal date to all eligible subscribers.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async get_test_notification_status(test_notification_token: str) CheckTestNotificationResponse[source]¶
Check the status of the test App Store server notification sent to your server. https://developer.apple.com/documentation/appstoreserverapi/get_test_notification_status
- Parameters:
test_notification_token – The test notification token received from the Request a Test Notification endpoint
- Returns:
A response that contains the contents of the test notification sent by the App Store server and the result from your server.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async get_transaction_history(transaction_id: str, revision: str | None, transaction_history_request: TransactionHistoryRequest, version: GetTransactionHistoryVersion = GetTransactionHistoryVersion.V1) HistoryResponse[source]¶
Get a customer’s in-app purchase transaction history for your app. https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history
- Parameters:
transaction_id – The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.
revision – A token you provide to get the next set of up to 20 transactions. All responses include a revision token. Note: For requests that use the revision token, include the same query parameters from the initial request. Use the revision token from the previous HistoryResponse.
transaction_history_request – The request parameters that includes the startDate,endDate,productIds,productTypes and optional query constraints.
version – The version of the Get Transaction History endpoint to use. V2 is recommended.
- Returns:
A response that contains the customer’s transaction history for an app.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async get_transaction_info(transaction_id: str) TransactionInfoResponse[source]¶
Get information about a single transaction for your app. https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info
:param transaction_id The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier. :return: A response that contains signed transaction information for a single transaction. :throws APIException: If a response was returned indicating the request could not be processed
- async look_up_order_id(order_id: str) OrderLookupResponse[source]¶
Get a customer’s in-app purchases from a receipt using the order ID. https://developer.apple.com/documentation/appstoreserverapi/look_up_order_id
- Parameters:
order_id – The order ID for in-app purchases that belong to the customer.
- Returns:
A response that includes the order lookup status and an array of signed transactions for the in-app purchases in the order.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async request_test_notification() SendTestNotificationResponse[source]¶
Ask App Store Server Notifications to send a test notification to your server. https://developer.apple.com/documentation/appstoreserverapi/request_a_test_notification
- Returns:
A response that contains the test notification token.
- Throws APIException:
If a response was returned indicating the request could not be processed
- async send_consumption_data(transaction_id: str, consumption_request: ConsumptionRequest)[source]¶
Send consumption information about a consumable in-app purchase to the App Store after your server receives a consumption request notification. https://developer.apple.com/documentation/appstoreserverapi/send_consumption_information
- Parameters:
transaction_id – The transaction identifier for which you’re providing consumption information. You receive this identifier in the CONSUMPTION_REQUEST notification the App Store sends to your server.
consumption_request – The request body containing consumption information.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- async set_app_account_token(original_transaction_id: str, update_app_account_token_request: UpdateAppAccountTokenRequest)[source]¶
Sets the app account token value for a purchase the customer makes outside your app, or updates its value in an existing transaction. https://developer.apple.com/documentation/appstoreserverapi/set-app-account-token
:param original_transaction_id The original transaction identifier of the transaction to receive the app account token update. :param update_app_account_token_request The request body that contains a valid app account token value. :raises APIException: If a response was returned indicating the request could not be processed
- async upload_image(image_identifier: UUID, image: bytes)[source]¶
Upload an image to use for retention messaging.
- Parameters:
image_identifier – A UUID you provide to uniquely identify the image you upload.
image – The image file to upload.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/upload-image
- async upload_message(message_identifier: UUID, upload_message_request_body: UploadMessageRequestBody)[source]¶
Upload a message to use for retention messaging.
- Parameters:
message_identifier – A UUID you provide to uniquely identify the message you upload.
upload_message_request_body – The message text to upload.
- Raises:
APIException – If a response was returned indicating the request could not be processed
- See:
https://developer.apple.com/documentation/retentionmessaging/upload-message
- class appstoreserverlibrary.api_client.BaseAppStoreServerAPIClient(signing_key: bytes, key_id: str, issuer_id: str, bundle_id: str, environment: Environment)[source]¶
Bases:
object