react-native-iap
Version:
React Native In App Purchase Module.
115 lines (114 loc) • 3.81 kB
TypeScript
export declare enum IAPErrorCode {
E_IAP_NOT_AVAILABLE = "E_IAP_NOT_AVAILABLE",
E_UNKNOWN = "E_UNKNOWN",
E_USER_CANCELLED = "E_USER_CANCELLED",
E_USER_ERROR = "E_USER_ERROR",
E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE",
E_REMOTE_ERROR = "E_REMOTE_ERROR",
E_NETWORK_ERROR = "E_NETWORK_ERROR",
E_SERVICE_ERROR = "E_SERVICE_ERROR",
E_RECEIPT_FAILED = "E_RECEIPT_FAILED",
E_RECEIPT_FINISHED_FAILED = "E_RECEIPT_FINISHED_FAILED",
E_NOT_PREPARED = "E_NOT_PREPARED",
E_NOT_ENDED = "E_NOT_ENDED",
E_ALREADY_OWNED = "E_ALREADY_OWNED",
E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR",
E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR",
E_DEFERRED_PAYMENT = "E_DEFERRED_PAYMENT"
}
export declare enum ProrationModesAndroid {
IMMEDIATE_WITH_TIME_PRORATION = 1,
IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,
IMMEDIATE_WITHOUT_PRORATION = 3,
DEFERRED = 4,
UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0
}
export declare enum PurchaseStateAndroid {
UNSPECIFIED_STATE = 0,
PURCHASED = 1,
PENDING = 2
}
export declare const PROMOTED_PRODUCT = "iap-promoted-product";
export declare enum InstallSourceAndroid {
NOT_SET = 0,
GOOGLE_PLAY = 1,
AMAZON = 2
}
export interface ProductCommon {
title: string;
description: string;
price: string;
currency: string;
localizedPrice: string;
countryCodeIOS?: string;
}
export interface ProductPurchase {
productId: string;
transactionId?: string;
transactionDate: number;
transactionReceipt: string;
purchaseToken?: string;
dataAndroid?: string;
signatureAndroid?: string;
autoRenewingAndroid?: boolean;
purchaseStateAndroid?: PurchaseStateAndroid;
originalTransactionDateIOS?: string;
originalTransactionIdentifierIOS?: string;
isAcknowledgedAndroid?: boolean;
packageNameAndroid?: string;
developerPayloadAndroid?: string;
obfuscatedAccountIdAndroid?: string;
obfuscatedProfileIdAndroid?: string;
userIdAmazon?: string;
userMarketplaceAmazon?: string;
userJsonAmazon?: string;
}
export interface PurchaseResult {
responseCode?: number;
debugMessage?: string;
code?: string;
message?: string;
}
export interface PurchaseError {
responseCode?: number;
debugMessage?: string;
code?: string;
message?: string;
productId?: string;
}
export declare type InAppPurchase = ProductPurchase;
export interface SubscriptionPurchase extends ProductPurchase {
autoRenewingAndroid?: boolean;
originalTransactionDateIOS?: string;
originalTransactionIdentifierIOS?: string;
}
export declare type Purchase = InAppPurchase | SubscriptionPurchase;
export interface Discount {
identifier: string;
type: string;
numberOfPeriods: string;
price: string;
localizedPrice: string;
paymentMode: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';
subscriptionPeriod: string;
}
export interface Product<ProductId extends string = string> extends ProductCommon {
type: 'inapp' | 'iap';
productId: ProductId;
}
export interface Subscription extends ProductCommon {
type: 'subs' | 'sub';
productId: string;
discounts?: Discount[];
introductoryPrice?: string;
introductoryPriceAsAmountIOS?: string;
introductoryPricePaymentModeIOS?: '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';
introductoryPriceNumberOfPeriodsIOS?: string;
introductoryPriceSubscriptionPeriodIOS?: 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';
subscriptionPeriodNumberIOS?: string;
subscriptionPeriodUnitIOS?: '' | 'YEAR' | 'MONTH' | 'WEEK' | 'DAY';
introductoryPriceCyclesAndroid?: string;
introductoryPricePeriodAndroid?: string;
subscriptionPeriodAndroid?: string;
freeTrialPeriodAndroid?: string;
}