Skip to content

ElectronInAppPurchase

Unofficial

In-app purchases on the Mac App Store.

Import:

import type { ElectronInAppPurchase } from '@obsidian-typings/obsidian-public-latest';

Signature:

export interface ElectronInAppPurchase

Methods

Method Returns Description
addListener(event, listener) this Adds a listener for the transactions-updated event.

Emitted when one or more transactions have been updated.
canMakePayments() boolean Returns whether a user can make a payment.
finishAllTransactions() void Completes all pending transactions.
finishTransactionByDate(date) void Completes the pending transactions corresponding to the date.
getProducts(productIDs) Promise<ElectronProduct[]> Retrieves the product descriptions.
getReceiptURL() string Returns the path to the receipt.
on('transactions-updated', listener) this Registers a listener for the transactions-updated event.

Emitted when one or more transactions have been updated.
once(event, listener) this Registers a one-time listener for the transactions-updated event.

Emitted when one or more transactions have been updated.
purchaseProduct(productID, quantity?) Promise<boolean> Adds the specified product to the payment queue. You should listen for the transactions-updated event as soon as possible and certainly before you call purchaseProduct.
removeListener(event, listener) this Removes a previously added listener for the transactions-updated event.

Emitted when one or more transactions have been updated.
restoreCompletedTransactions() void Restores finished transactions. This method can be called either to install purchases on additional devices, or to restore purchases for an application that the user deleted and reinstalled.

The payment queue delivers a new transaction for each previously completed transaction that can be restored. Each transaction includes a copy of the original transaction.

Links to this page: