Skip to main content

API - Get purchases

This API route returns the app transactions, sorted by creation date in descending order.

GET

Authentication

Authentication is required by using your Api Key in the Authorization header.

Authorization: ApiKey [SERVER_API_KEY]
note

You should only use this API call from your server.
For security reasons, each API endpoint has a rate limit of 5 requests per second.

Url parameters

StringApp id

Query parameters

environment(Optional)Values
StringApp environment (production by default)
page(Optional)
NumberPage number (Page 1 by default)
pageId(Optional)
StringPage id (required only if page > 1) This parameter ensures that the paging system loads the correct page. If your request involves a large number of transactions and this parameter is missing, the request may fail.
limit(Optional)
NumberNumber of results per page (20 by default, 100 maximum)
user(Optional)
StringFilter by the user (IAPHUB internal user id)
userId(Optional)
StringFilter by the user id (custom user id)
StringFilter by the original purchase (to get all the transactions of a same subscription)

Response properties

BooleanTrue if another page of results is available
StringNext page id (to be provided in the 'pageId' property of the API when loading the next page)
ArrayPurchases list
Array element
StringId of the purchase
StringDate of purchase
NumberQuantity
platformValues
StringPlatform
StringCountry of the user on purchase
ObjectTags of the user on purchase
StringIOS/Android order id of the purchase
StringApp id
StringUser id (from IAPHUB)
StringUser id (you provided at login) of the user that purchased the product
StringReceipt id
StringAndroid purchase token
StringProduct id
StringProduct sku
StringProduct type of the purchase
Only if the product has a group
StringProduct group name
StringListing id
StringStore id
NumberStore segment index (when a store is used for testing, 0 by default)
StringPrice currency
NumberPrice amount
StringCurrency configured on your app settings
NumberPrice amount converted to the currency of your app
BooleanTrue if it is a sandbox purchase
BooleanTrue if it has been purchased from a promo code (only available on the initial transaction of a auto-renewable subscription)
Only if isPromo is true
StringPromo code (Android: only available for subscriptions vanity codes, not available for one time codes) (iOS: the value is the offer reference name) (only available on the initial transaction of a auto-renewable subscription)
BooleanTrue if the purchase has been refunded
Only if isRefunded is true
StringDate of the refund
StringReason of the refund
NumberRefund amount (using the currency of purchase)
NumberRefund amount (using the converted currency)
BooleanTrue if it is a subscription
Only if isSubscription is true
BooleanTrue if the subscription is currently active
BooleanTrue if the subscription is renewable
BooleanTrue if it is shared by a family member (iOS only)
BooleanTrue if the subscription is currently trying to be renewed
BooleanTrue if the subscription is currently in a grace period
BooleanTrue if the purchase is the conversion of a trial
StringCurrent state of the subscription
StringPeriod type of the subscription
StringReason for the cancellation of the auto-renewable subscription.
DateDate of auto-renewable subscription cancellation detected by IAPHUB.
Only when the transaction has been created because of a subscription replace
StringProration mode
StringProduct id of next renewal
StringProduct sku of next renewal
StringDate of the subscription expiration
StringDate when the subscription will automatically resume after being paused. Note that this feature is available only on Android.
StringNext purchase id of a renewable subscription
StringPrevious purchase id of a renewable subscription
StringOriginal purchase id of a renewable subscription

Example

Url

https://api.iaphub.com/v1/app/5d86507259e828b8fe321f7e/purchases?fromDate=2019-10-12&order=asc

Response

{
hasNextPage: false,
list: [
{
id: '5da20ea9fbd92641ae8d0c03',
purchaseDate: '2019-10-12T17:34:33.256Z',
quantity: 1,
platform: 'ios',
country: 'US',
tags: {},
orderId: '9873637705964380',
app: '5d86507259e828b8fe321f7e',
user: '5d865c10c41280ba7f0ce9c2',
userId: '4',
product: '5d86507259e828b8fe321f8a',
listing: '5d86507259e828b8fe321f32',
store: '5d86507259e828b8fe321f85',
currency: 'USD',
price: 19.99,
convertedCurrency: 'USD',
convertedPrice: 19.99,
isSandbox: false,
isRefunded: false,
isSubscription: true,
isSubscriptionActive: true,
isSubscriptionRenewable: true,
isSubscriptionRetryPeriod: false,
isTrialConversion: false,
subscriptionPeriodType: "normal",
expirationDate: '2019-11-12T17:34:33.256Z',
linkedPurchase: '2d865c10c41280ba7f0ce9c4',
originalPurchase: '2d865c10c41280ba7f0ce9c4',
productSku: 'membership_pricing1',
productType: 'renewable_subscription'
}
]
}