import type { PurchaseConfirmation, PurchaseFlowOptions, PurchaseFlowPurchase } from "./purchase-flow-core"; type IapkitStore = "apple" | "google" | "amazon" | "horizon"; /** How an app without its own backend confirms purchases with IAPKit. */ export interface IapkitConfirmationOptions
{
/**
* A publishable key (`openiap-kit_pk_...`), which is safe to ship in an
* app. Leave it out where the SDK has one configured, such as Expo's
* `iapkitApiKey`.
*/
apiKey?: string;
/** A self-hosted or local IAPKit origin. Defaults to https://kit.openiap.dev. */
baseUrl?: string;
amazon?: {
/** Verify App Tester receipts with the Amazon RVS Cloud Sandbox. */
sandbox?: boolean;
/** Expected verdict environment; defaults to Sandbox with sandbox, otherwise Production. */
expectedEnvironment?: "Sandbox" | "Production";
/** RVS reports a subscription term under its parent SKU; maps one to the other. */
verifiedProductId?: (productId: string) => string;
};
/** The IAPKit store that verifies a community store's evidence, such as an Amazon RVS adapter. */
verifyAs?: (purchase: P) => IapkitStore | undefined;
/** Credits consumables before finishing; must be idempotent per purchase.id. */
grant?: (purchase: P, context: {
isConsumable: boolean;
}) => Promise (verifyPurchaseWithProvider: (props: IapkitVerificationProps) => Promise ): PurchaseFlowOptions ["confirmWithBackend"];
/**
* @internal Use the SDK's confirmOnDeviceIOS.
* The SDK's `confirmOnDeviceIOS`, given its `getPendingTransactionsIOS`, for an
* app with neither a backend nor IAPKit. StoreKit verified the transaction if
* it lists it as unfinished, or, for a purchase the flow already finished, in
* `getTransactionHistoryIOS`, from the purchase's environment. A revoked or
* upgraded one is `invalid`, and an expired one `verification_delayed`, since
* billing grace can still cover it; `grant` runs before an unfinished one is
* finished, and again for a finished non-consumable a restore reads.
*/
export declare function createDeviceConfirmationIOS (getPendingTransactionsIOS: () => Promise , options?: {
/** Required for consumables; credit each purchase.id only once. */
grant?: (purchase: P, context: {
isConsumable: boolean;
}) => Promise ;
}): PurchaseFlowOptions ["confirmWithBackend"];
/** @internal Builds the IAPKit request; throws for a store IAPKit cannot verify. */
export declare function toIapkitVerificationProps (purchase: P, options: IapkitConfirmationOptions ): IapkitVerificationProps;
/**
* @internal Use the SDK's confirmWithIapkit.
* Turns IAPKit's answer into the flow's confirmation. Anything that may be a
* configuration error rather than a rejected payment throws, so the flow
* reports `failed` and leaves the purchase unfinished: evidence for another
* store, product, or environment, `inauthentic` (IAPKit's answer to a product
* or package mismatch, and to every Horizon rejection), and a valid state this
* product type cannot be granted from.
*/
export declare function readIapkitVerification (result: IapkitVerificationResult, purchase: P, context: {
isConsumable: boolean;
}, options?: Omit