react-native-billing-sdk
Version:
Implementation of Android Billing Client v6.0
91 lines • 3.7 kB
TypeScript
import { BillingSdkAndroidConstants } from './constants';
export declare namespace BillingSdkAndroidTypes {
type ProductDetailParams = {
productId: string;
productType: BillingSdkAndroidConstants.ProductType;
};
type PricingPhase = {
billingPeriod: string;
formattedPrice: string;
priceAmountMicros: string;
priceCurrencyCode: string;
recurrenceMode: BillingSdkAndroidConstants.RecurrenceMode;
billingCycleCount: number;
};
type SubscriptionOfferDetails = {
basePlanId: string;
offerToken: string;
offerId: string | null;
offerTags: string[];
pricingPhases: PricingPhase[];
};
type OneTimePurchaseOfferDetails = {
formattedPrice: string;
priceCurrencyCode: string;
priceAmountMicros: string;
};
type ProductDetails = {
name: string;
title: string;
productId: string;
productType: string;
description: string;
subscriptionOfferDetails: SubscriptionOfferDetails[] | null;
oneTimePurchaseOfferDetails: OneTimePurchaseOfferDetails | null;
};
type AccountIdentifiers = {
obfuscatedAccountId: string;
obfuscatedProfileId: string;
};
type PurchaseHistoryRecord = {
developerPayload: string;
originalJson: string;
productId: string;
purchaseTime: string;
purchaseToken: string;
quantity: number;
signature: string;
};
type Purchase = {
accountIdentifiers: AccountIdentifiers | null;
developerPayload: string;
orderId: string;
originalJson: string;
packageName: string;
productId: string;
purchaseState: BillingSdkAndroidConstants.PurchaseState;
purchaseTime: string;
purchaseToken: string;
quantity: number;
signature: string;
isAcknowledged: boolean;
isAutoRenewing: boolean;
};
interface BillingSdkError extends Error {
code: BillingSdkAndroidConstants.ResponseCode;
}
interface IBillingSdkAndroidNative {
startConnection: () => Promise<void>;
endConnection: () => Promise<void>;
getConnectionState: () => Promise<BillingSdkAndroidConstants.ConnectionState>;
queryProductDetails: (productIds: string[], productType: BillingSdkAndroidConstants.ProductType) => Promise<ProductDetails[]>;
launchBillingFlow: (productId: string, offerToken?: string, oldPurchaseToken?: string, subscriptionReplacementMode?: BillingSdkAndroidConstants.SubscriptionReplacementMode) => Promise<void>;
acknowledgePurchase: (purchaseToken: string) => Promise<void>;
queryPurchaseHistory: (productType: BillingSdkAndroidConstants.ProductType) => Promise<PurchaseHistoryRecord[] | null>;
queryPurchases: (productType: BillingSdkAndroidConstants.ProductType) => Promise<Purchase[]>;
consume: (purchaseToken: string) => Promise<void>;
}
type PurchaseUpdatedListenerParams = {
responseCode: BillingSdkAndroidConstants.ResponseCode;
debugMessage: string;
purchases: Purchase[] | null;
};
type PurchaseUpdatedListener = (params: PurchaseUpdatedListenerParams) => void;
type BillingServiceDisconnectedListener = () => void;
type RemoveListener = () => void;
interface IBillingSdkAndroid extends IBillingSdkAndroidNative {
setPurchaseUpdatedListener: (listener: PurchaseUpdatedListener) => RemoveListener;
setBillingServiceDisconnectedListener: (listener: BillingServiceDisconnectedListener) => RemoveListener;
}
}
//# sourceMappingURL=types.d.ts.map