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

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_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

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.

https://developer.apple.com/documentation/appstoreserverapi/familysharedsubscriptionextensionineligibleerror

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

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

https://developer.apple.com/documentation/appstoreserverapi/invalidemptystorefrontcountrycodelisterror

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_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_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

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.

https://developer.apple.com/documentation/appstoreserverapi/originaltransactionidnotfoundretryableerror

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_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

api_error: APIError | None
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

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_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

class appstoreserverlibrary.api_client.AsyncAppStoreServerAPIClient(signing_key: bytes, key_id: str, issuer_id: str, bundle_id: str, environment: Environment)[source]

Bases: BaseAppStoreServerAPIClient

async async_close()[source]
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_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

class appstoreserverlibrary.api_client.BaseAppStoreServerAPIClient(signing_key: bytes, key_id: str, issuer_id: str, bundle_id: str, environment: Environment)[source]

Bases: object

class appstoreserverlibrary.api_client.GetTransactionHistoryVersion(value)[source]

Bases: str, Enum

V1 = 'v1'

Deprecated since version 1.3.0.

V2 = 'v2'