Skip to main content

API - Get subscription

This API route will let you get the latest transaction of a auto-renewable subscription by providing the original purchase id.

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
StringOriginal purchase id

Query parameters

environment(Optional)Values
StringApp environment (production by default)

Response properties

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/subscription/5da20ea9fbd92641ae8d0c03

Response

{
id: '5da20ea9fbd92641ae8d0c03',
purchaseDate: '2019-10-12T17:34:33.256Z',
quantity: 1,
platform: 'ios',
country: 'US',
tags: {},
orderId: '9873637705964380',
app: '5d86507259e828b8fe321f7e',
user: '5d865c10c41280ba7f0ce9c2',
userId: '62785074-8f32-42a5-b86b-90dbd79ce212',
product: '5d86507259e828b8fe321f8a',
listing: '5d86507259e828b8fe321f32',
store: '5d86507259e828b8fe321f85',
receipt: '5d86507259e828b8fe321f34',
currency: 'USD',
price: 19.99,
convertedCurrency: 'USD',
convertedPrice: 19.99,
isSandbox: false,
isRefunded: false,
isSubscription: true,
isSubscriptionActive: true,
isSubscriptionRenewable: true,
isSubscriptionRetryPeriod: false,
isTrialConversion: false,
subscriptionState: 'active',
subscriptionPeriodType: 'normal',
expirationDate: '2019-11-12T17:34:33.256Z',
linkedPurchase: '2d865c10c41280ba7f0ce9c4',
originalPurchase: '2d865c10c41280ba7f0ce9c4',
productSku: 'membership_pricing1',
productType: 'renewable_subscription'
}