Package com.apple.itunes.storekit.client
Class BaseAppStoreServerAPIClient
java.lang.Object
com.apple.itunes.storekit.client.BaseAppStoreServerAPIClient
- Direct Known Subclasses:
AppStoreServerAPIClient
An abstract base class for an
AppStoreServerAPIClient
that allows replacing the underlying HTTP client-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static interface
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBaseAppStoreServerAPIClient
(BearerTokenAuthenticatorInterface bearerTokenAuthenticator, Environment environment) BaseAppStoreServerAPIClient
(String signingKey, String keyId, String issuerId, String bundleId, Environment environment) -
Method Summary
Modifier and TypeMethodDescriptionextendRenewalDateForAllActiveSubscribers
(MassExtendRenewalDateRequest massExtendRenewalDateRequest) Uses a subscription’s product identifier to extend the renewal date for all of its eligible active subscribers.extendSubscriptionRenewalDate
(String originalTransactionId, ExtendRenewalDateRequest extendRenewalDateRequest) Extends the renewal date of a customer’s active subscription using the original transaction identifier.getAllSubscriptionStatuses
(String transactionId, Status[] status) Get the statuses for all of a customer’s auto-renewable subscriptions in your app.getNotificationHistory
(String paginationToken, NotificationHistoryRequest notificationHistoryRequest) Get a list of notifications that the App Store server attempted to send to your server.getRefundHistory
(String transactionId, String revision) Get a paginated list of all of a customer’s refunded in-app purchases for your app.getStatusOfSubscriptionRenewalDateExtensions
(String requestIdentifier, String productId) Checks whether a renewal date extension request completed, and provides the final count of successful or failed extensions.getTestNotificationStatus
(String testNotificationToken) Check the status of the test App Store server notification sent to your server.getTransactionHistory
(String transactionId, String revision, TransactionHistoryRequest transactionHistoryRequest) Deprecated.getTransactionHistory
(String transactionId, String revision, TransactionHistoryRequest transactionHistoryRequest, GetTransactionHistoryVersion version) Get a customer’s in-app purchase transaction history for your app.getTransactionInfo
(String transactionId) Get information about a single transaction for your app.protected String
getUrlForEnvironment
(Environment environment) lookUpOrderId
(String orderId) Get a customer’s in-app purchases from a receipt using the order ID.protected <T> T
makeHttpCall
(String path, String method, Map<String, List<String>> queryParameters, Object body, Class<T> clazz) protected abstract BaseAppStoreServerAPIClient.HttpResponseInterface
makeRequest
(String path, String method, Map<String, List<String>> queryParameters, Map<String, String> headers, String contentType, String body) Make an HTTP requestAsk App Store Server Notifications to send a test notification to your server.void
sendConsumptionData
(String transactionId, ConsumptionRequest consumptionRequest) Send consumption information about a consumable in-app purchase to the App Store after your server receives a consumption request notification.
-
Field Details
-
url
-
-
Constructor Details
-
BaseAppStoreServerAPIClient
public BaseAppStoreServerAPIClient(String signingKey, String keyId, String issuerId, String bundleId, Environment environment) -
BaseAppStoreServerAPIClient
public BaseAppStoreServerAPIClient(BearerTokenAuthenticatorInterface bearerTokenAuthenticator, Environment environment)
-
-
Method Details
-
getUrlForEnvironment
-
makeRequest
protected abstract BaseAppStoreServerAPIClient.HttpResponseInterface makeRequest(String path, String method, Map<String, List<String>> queryParameters, Map<String, throws IOExceptionString> headers, String contentType, String body) Make an HTTP request- Parameters:
path
- The path of the requestmethod
- The HTTP method of the requestqueryParameters
- A map of query parameters for the requestheaders
- A map of headers for the requestcontentType
- The content type of the request, nullablebody
- The Java object representing the body, nullable- Returns:
- An
BaseAppStoreServerAPIClient.HttpResponseInterface
representing the status code and optional response body - Throws:
IOException
- If an exception was thrown while making the request
-
makeHttpCall
protected <T> T makeHttpCall(String path, String method, Map<String, List<String>> queryParameters, Object body, Class<T> clazz) throws IOException, APIException- Throws:
IOException
APIException
-
extendRenewalDateForAllActiveSubscribers
public MassExtendRenewalDateResponse extendRenewalDateForAllActiveSubscribers(MassExtendRenewalDateRequest massExtendRenewalDateRequest) throws APIException, IOException Uses a subscription’s product identifier to extend the renewal date for all of its eligible active subscribers.- Parameters:
massExtendRenewalDateRequest
- 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 processedIOException
- If an exception was thrown while making the request- See Also:
-
extendSubscriptionRenewalDate
public ExtendRenewalDateResponse extendSubscriptionRenewalDate(String originalTransactionId, ExtendRenewalDateRequest extendRenewalDateRequest) throws APIException, IOException Extends the renewal date of a customer’s active subscription using the original transaction identifier.- Parameters:
originalTransactionId
- The original transaction identifier of the subscription receiving a renewal date extension.extendRenewalDateRequest
- 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 processedIOException
- If an exception was thrown while making the request- See Also:
-
getAllSubscriptionStatuses
public StatusResponse getAllSubscriptionStatuses(String transactionId, Status[] status) throws APIException, IOException Get the statuses for all of a customer’s auto-renewable subscriptions in your app.- Parameters:
transactionId
- 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 processedIOException
- If an exception was thrown while making the request- See Also:
-
getRefundHistory
public RefundHistoryResponse getRefundHistory(String transactionId, String revision) throws APIException, IOException Get a paginated list of all of a customer’s refunded in-app purchases for your app.- Parameters:
transactionId
- 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 processedIOException
- If an exception was thrown while making the request- See Also:
-
getStatusOfSubscriptionRenewalDateExtensions
public MassExtendRenewalDateStatusResponse getStatusOfSubscriptionRenewalDateExtensions(String requestIdentifier, String productId) throws APIException, IOException Checks whether a renewal date extension request completed, and provides the final count of successful or failed extensions.- Parameters:
requestIdentifier
- The UUID that represents your request to the Extend Subscription Renewal Dates for All Active Subscribers endpoint.productId
- 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 processedIOException
- If an exception was thrown while making the request- See Also:
-
getTestNotificationStatus
public CheckTestNotificationResponse getTestNotificationStatus(String testNotificationToken) throws APIException, IOException Check the status of the test App Store server notification sent to your server.- Parameters:
testNotificationToken
- 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 processedIOException
- If an exception was thrown while making the request- See Also:
-
getNotificationHistory
public NotificationHistoryResponse getNotificationHistory(String paginationToken, NotificationHistoryRequest notificationHistoryRequest) throws APIException, IOException Get a list of notifications that the App Store server attempted to send to your server.- Parameters:
paginationToken
- 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.notificationHistoryRequest
- 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 processedIOException
- If an exception was thrown while making the request- See Also:
-
getTransactionHistory
@Deprecated(since="2.2.0") public HistoryResponse getTransactionHistory(String transactionId, String revision, TransactionHistoryRequest transactionHistoryRequest) throws APIException, IOException Deprecated. -
getTransactionHistory
public HistoryResponse getTransactionHistory(String transactionId, String revision, TransactionHistoryRequest transactionHistoryRequest, GetTransactionHistoryVersion version) throws APIException, IOException Get a customer’s in-app purchase transaction history for your app.- Parameters:
transactionId
- 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.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 processedIOException
- If an exception was thrown while making the request- See Also:
-
getTransactionInfo
public TransactionInfoResponse getTransactionInfo(String transactionId) throws APIException, IOException Get information about a single transaction for your app.- Parameters:
transactionId
- The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.- Returns:
- A response that contains signed transaction information for a single transaction.
- Throws:
APIException
- If a response was returned indicating the request could not be processedIOException
- If an exception was thrown while making the request- See Also:
-
lookUpOrderId
Get a customer’s in-app purchases from a receipt using the order ID.- Parameters:
orderId
- 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 processedIOException
- If an exception was thrown while making the request- See Also:
-
requestTestNotification
Ask App Store Server Notifications to send a test notification to your server.- Returns:
- A response that contains the test notification token.
- Throws:
APIException
- If a response was returned indicating the request could not be processedIOException
- If an exception was thrown while making the request- See Also:
-
sendConsumptionData
public void sendConsumptionData(String transactionId, ConsumptionRequest consumptionRequest) throws APIException, IOException Send consumption information about a consumable in-app purchase to the App Store after your server receives a consumption request notification.- Parameters:
transactionId
- 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.consumptionRequest
- The request body containing consumption information.- Throws:
APIException
- If a response was returned indicating the request could not be processedIOException
- If an exception was thrown while making the request- See Also:
-