For the complete documentation index, see llms.txt. This page is also available as Markdown.

Signed In-App Purchase History

Download a signed (JWS) in-app purchase history on the client using makeSignedInAppsHistoryRequest().

OnsideKit can produce a signed in-app purchase history as a compact JWS (JSON Web Signature) for the current user. Send it (or the order IDs it contains) to your backend to validate purchases — see Backend Validation & Merchant API.

Create the request

@MainActor static func makeSignedInAppsHistoryRequest()
    -> Result<OnsideSignedInAppsHistoryRequest, OnsideSignedInAppsHistoryRequestError>

The call returns a request object on success, or a pre-flight error:

switch Onside.makeSignedInAppsHistoryRequest() {
case .success(let request):
    request.delegate = self
    self.historyRequest = request   // retain it
    request.start()

case .failure(let error):
    // .notLoggedIn or .notSupportedInLocalTesting (pre-flight),
    // or a network error.
    print("Couldn't create history request: \(error)")
}

This API requires an authenticated user — it returns .notLoggedIn if there is no session (it does not trigger login). In local-testing mode it returns .notSupportedInLocalTesting.

The request object

Retain the request for the whole operation (a dropped reference is cancelled). Use stop() to cancel.

Handle the result

The history value

string is a convenience that UTF-8-decodes data; the JWS is normally a printable string, so it is usually non-nil.

Errors

OnsideSignedInAppsHistoryRequestError:

Case
Cause

.notLoggedIn

No authenticated user (this API does not trigger login).

.notSupportedInLocalTesting

Running with a .storekit local-testing configuration.

.connectionError

Network failure.

.serviceUnavailable

Server returned 5xx.

.appNotRegistered

The app/install isn't recognized by Onside (HTTP 404).

.cancelled

The request was cancelled.

.internalError

Parsing or other unexpected error.

Once your backend has the signed history (or the order IDs from it), continue with Backend Validation & Merchant API.

Last updated

Was this helpful?