Sync a store transaction
Reports a store transaction from the device.
Voidhash verifies it with the store, records the purchase and grants its perks. One client address may send 300 a minute per project; past that the answer is 429 with a Retry-After header. Fails with Api/SdkTransactionRejectedError when the store can never accept the transaction as sent.
Guide: Install an SDK
A project publishable key, which ships inside apps. Send the end user's distinct id in x-distinct-id with it.
In: header
Header parameters
The distinct id of the end user the request acts for: the anonymous vh_anon_… id the SDK generated, or the id the app identified them with. At most 255 characters.
percent when x-distinct-id holds the RFC 3986 percent-encoded UTF-8 form of an id that is not printable ASCII; leave it out when the header holds the id as is.
Value in
- "percent"
The project's publishable key, vh_pk_…. A test key, vh_pk_test_…, works with store sandbox and test purchases.
The app's bundle id on iOS or package name on Android, which picks the project's store configuration for purchases and promotional offers. At most 255 characters.
length <= 255The end user's most preferred locale, such as en-US.
The app's version, such as 2.4.1.
true when the app sent the request from the background, otherwise false.
true when the app is a debug build, otherwise false. Only debug builds can make simulated development purchases.
A random id, new for every request, such as a lowercase UUID.
true when the SDK runs in observer mode: another billing integration owns purchases and the SDK only reports them. Otherwise false.
The platform the app runs on, such as ios, android or web. Records where a new person signed up.
The device's manufacturer, such as Apple or Google.
The device's model, such as iPhone15,2; in a browser, its navigator.platform.
native in an app, browser in a web page.
The version of the app hosting the SDK; native SDKs send the app's version, the web SDK leaves it out.
The operating system's version, such as 17.4; in a browser, its user agent.
The end user's preferred locales, most preferred first, separated by commas, such as en-US,de-DE.
The SDK making the request: ios, android, react-native or web. A native SDK driven by another reports the outer one, such as react-native.
The version of the SDK making the request, such as 1.4.0.
The app store storefront (country) the end user buys from, when the SDK knows it.
Request body
application/json
TypeScript definitions
Use the request body type in TypeScript.
An App Store transaction for the server to verify with Apple and record.
An App Store transaction.
Value in
- "ios"
StoreKit's transaction id, a decimal integer.
Why the SDK reports the transaction: restore for a restore the end user asked for, which may share or move a purchase another user owns as the project's paid access sharing setting allows; sync (the default) for anything else, which records it for this user.
The paywall the purchase was made on, when the SDK started it from one.
Examples
curl -X POST "https://api.voidhash.com/api/v1/sdk/sync-transaction" \ -H "x-distinct-id: user_8231" \ -H "x-publishable-key: vh_pk_..." \ -H "x-client-bundle-id: com.example.app" \ -H "Content-Type: application/json" \ -d '{ "platform": "ios", "transactionId": "2000000123456789", "paywallContext": { "showingId": "pw_loc_show_q2w8e4r6t1y9u3i7o5p0a2s4", "placement": "onboarding-end", "paywallId": "pw_r3t6y9u2i5o8p1a4s7d0f3g6" } }'{ "accepted": true, "pendingProductLink": false}{ "_tag": "Api/SdkValidationError", "message": "string"}{ "_tag": "Api/AuthenticationError", "cause": "string", "message": "string"}{ "_tag": "Api/SdkTransactionRejectedError", "reason": "string"}{ "_tag": "Api/SdkRateLimitedError", "message": "string"}{ "_tag": "Api/SdkServiceError", "cause": "string"}Response body
application/json
application/json
application/json
application/json
application/json
application/json
Errors
This operation adds no error codes of its own. It can fail with the errors every operation shares, such as unauthenticated; see Errors.
More in SDK
- Retrieve the person
GET - Identify a person
POST - Update the person's attributes
POST - Sign a promotional offer
POST - Record a development purchase
POST - Evaluate feature flags
POST - Resolve a paywall
POST - Retrieve the SDK schema
GET - Register a push device
POST - Refresh a push device
POST - Unregister a push device
POST
Something wrong or missing on this page? Tell us by email or on Discord.