Skip to main content

SDK Reference - restore

React native
Flutter
Swift
Kotlin

The restore method resynchronizes the purchased transactions from the user's store account (Apple/Google Play).

If a transaction has never been processed by IAPHUB, it will be returned in the newPurchases array of the response.
Additionally, if an active product (subscription/non-consumable) is already associated with another user ID, the product will seamlessly transfer to the new user and will be returned in the transferredActiveProducts array of the response. If you wish to disable this feature, you can conveniently manage it from the settings within the IAPHUB dashboard.

For apps lacking an authentication system, users can restore an active product (subscription/non-consumable), on up to 5 devices using the same Apple or Google account.

It's a good idea to let users know they can restore their purchases if they have any issue. You should add a visible button in your app that triggers the method. This is helpful if they ever have trouble accessing their subscriptions. By suggesting a restore, you can help them fix any issues and make sure they can use your app smoothly.

Example

var response = await Iaphub.restore();
React Native
Flutter
Swift
Kotlin

Parameters

This method does not require any parameters.

Response

Object
ArrayArray of new purchases
Array
Object
StringIAPHUB product ID
typeValues
StringProduct type
StringProduct sku
NumberPrice amount
StringPrice currency
StringLocalized product price (Ex: '$12.99')
StringLocalized product title from IAPHUB if available; otherwise, the title from Apple or Google
StringLocalized product description from IAPHUB if available; otherwise, the title from Apple or Google.
Only available if the product belongs to a group
StringIAPHUB group ID
StringName of the product group created on IAPHUB
Only available if the product has associated metadata
ObjectProduct metadata
StringIAPHUB purchase ID
StringPurchase date
platformValues
StringPlatform
BooleanIndicates if the purchase was made in the sandbox environment (testing)
BooleanIndicates if the purchase was made using a promo code
StringPromo code (Android: only available for subscriptions vanity codes, not available for one time codes) (iOS: the value is the offer reference name)
StringAndroid purchase token
StringWebhook status
Only available for a subscription
StringDuration of the subscription cycle specified in the ISO 8601 format
ArrayOrdered list of the subscription intro phases
Array element
typeValues
StringIntro phase type
NumberIntro phase price
StringIntro phase currency code (Ex: 'USD')
StringIntro phase localized price (Ex: '$2.99')
NumberNumber of cycles of the intro phase
StringDuration of a cycle specified in the ISO 8601 format
StringSubscription expiration date
StringSubscription original purchase id
StringIndicates if the subscription will renew automatically
BooleanIndicates if the subscription is shared by a family member (iOS subscriptions only).
StringSubscription product id of the next renewal (only defined if different than the current product)
StringSubscription product sku of the next renewal (only defined if different than the current product)
StringCurrent state of the subscription
StringPeriod type of the subscription
StringDate when the subscription will automatically resume after being paused (Android subscriptions only).
ArrayArray of existing active products transferred to the user
Array
Object
StringIAPHUB product ID
typeValues
StringProduct type
StringProduct sku
NumberPrice amount
StringPrice currency
StringLocalized product price (Ex: '$12.99')
StringLocalized product title from IAPHUB if available; otherwise, the title from Apple or Google
StringLocalized product description from IAPHUB if available; otherwise, the title from Apple or Google.
Only available if the product belongs to a group
StringIAPHUB group ID
StringName of the product group created on IAPHUB
Only available if the product has associated metadata
ObjectProduct metadata
StringIAPHUB purchase ID
StringPurchase date
platformValues
StringPlatform
BooleanIndicates if the purchase was made in the sandbox environment (testing)
BooleanIndicates if the purchase was made using a promo code
StringPromo code (Android: only available for subscriptions vanity codes, not available for one time codes) (iOS: the value is the offer reference name)
StringAndroid purchase token
Only available for a subscription
StringDuration of the subscription cycle specified in the ISO 8601 format
ArrayOrdered list of the subscription intro phases
Array element
typeValues
StringIntro phase type
NumberIntro phase price
StringIntro phase currency code (Ex: 'USD')
StringIntro phase localized price (Ex: '$2.99')
NumberNumber of cycles of the intro phase
StringDuration of a cycle specified in the ISO 8601 format
StringSubscription expiration date
StringSubscription original purchase id
StringIndicates if the subscription will renew automatically
BooleanIndicates if the subscription is shared by a family member (iOS subscriptions only).
StringSubscription product id of the next renewal (only defined if different than the current product)
StringSubscription product sku of the next renewal (only defined if different than the current product)
StringCurrent state of the subscription
StringPeriod type of the subscription
StringDate when the subscription will automatically resume after being paused (Android subscriptions only).