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

MethodReturnsDescription
addListener(event, listener)thisAdds a listener for the transactions-updated event.

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

Emitted when one or more transactions have been updated.
once(event, listener)thisRegisters 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)thisRemoves a previously added listener for the transactions-updated event.

Emitted when one or more transactions have been updated.
restoreCompletedTransactions()voidRestores 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: