Overview
@elata-biosciences/app-payments lets your app open Elata’s checkout and
check what the user owns. Elata runs checkout, takes payment in USDC, and
records ownership. Your app never touches wallets or payment details.
Your item catalog is set up by the Elata team. Contact us with the items,
titles, and prices you want to sell.
The correct flow
Gate your UI on ownership first, then purchase, then apply the benefit.requestPurchase records that the user owns an item. Your app decides what
owning it does.
Things to know
Branch on status, never on txHash
Branch on status, never on txHash
If the user already owns the item, Elata skips payment and returns
{ status: "success", txHash: "" }. Code that checks if (result.txHash) will mishandle this.Two price formats
Two price formats
CatalogItem.priceUsdc is in USDC base units (6 decimals): "50000" is $0.05. RequestPurchaseInput.priceUsdc is a free-form display hint Elata ignores. Elata always charges the catalog price.Items are one-time unlocks
Items are one-time unlocks
Each item is bought once. Consumables (spend-per-use balances) and recurring billing aren’t supported through items. For recurring revenue use a subscription plan.
Timeouts
Timeouts
requestPurchase waits up to 5 minutes for the user to finish checkout. getCatalog, getOwnedItems, and hasItem default to 10 seconds. Outside Elata nothing answers, so handle timeout by showing items as available.Errors
Calls reject only withAppPaymentsError, which has a code:
A normal
cancelled or error purchase outcome resolves; it doesn’t reject.
Security model
- Your app can’t fake ownership. Ownership is recorded by Elata only after payment is verified.
- Your app never sees payment details, wallet keys, or session tokens.
- Repeating a request with the same
requestIdwon’t charge twice. - Revenue from item sales is paid to the app owner’s wallet.
Try it
examples/iap-demo: one self-contained HTML file with a built-in mock store, so you can run the full flow locally.- Package README on npm