Skip to content
Docs
Documentation/Billing & subscriptions
Billing & subscriptions

Make an in-app purchase

Load mapped StoreKit subscription products and implement explicit purchase actions with Aplyna's Swift, React Native and Flutter iOS billing pilot.

On this page Load products from the configured storeStart checkout from a user actionHandle cancellation, pending and verification failureMeasure checkout cancellation

Load products from the configured store

Complete the billing quickstart first. Aplyna.billing.products() on React Native/Flutter and mappedProducts() on Swift return the configured StoreKit products. Display the returned localized price; never hard-code a currency, free-trial offer or discount. An empty result requires checking the selected app, environment, product mapping and Apple product availability.

React Native · load products
import Aplyna from '@aplyna/react-native';

const products = await Aplyna.billing.products();
// Render product.id, product.name and product.price in your own UI.

Start checkout from a user action

// Inside your explicit purchase action, after billing setup:
const customerInfo = await Aplyna.billing.purchase(selectedProduct.id);

Keep the selected store product stable during checkout, disable repeated purchase taps while it is in progress and update access from the returned verified entitlement. The native purchase sheet controls payment approval. Store-configured introductory offers and eligibility remain Apple decisions.

Handle cancellation, pending and verification failure

  • APLYNA_BILLING_CANCELLED closes checkout without granting access. Keep the user on their existing access state.
  • APLYNA_BILLING_PENDING requires a later verified result; pending does not grant an entitlement. Ask-to-Buy completion remains an explicit acceptance gap.
  • APLYNA_BILLING_ENVIRONMENT and APLYNA_BILLING_CUSTOMER_CONFLICT require correcting the selected store environment or ownership; never retry under another customer to bypass them.
  • A transport or verification failure must not create paid access. Unsubmitted StoreKit transactions remain unfinished so later synchronization can retry verification.

Measure checkout cancellation

No extra code is needed. With analytics configured for the same project and environment and the customer's consent, Aplyna's billing SDK already records purchase_started when the store payment sheet opens, then one outcome: purchase_cancelled when the store reports userCancelled or APLYNA_BILLING_CANCELLED, or purchase_completed, purchase_failed or purchase_pending. Each purchase_started counts as one attempt.

If your app opens store checkout without the billing SDK, track checkout_started when it invokes checkout, with checkout_id set to a new random ID for each attempt, and checkout_cancelled with the same checkout_id when the store reports a cancellation. Pass flowId or paywall_id on the start event when available. An installation that sends checkout_id events is counted only from them.

Charts → Conversion → Checkout cancellation rate displays store-reported cancellations divided by recorded attempts. It groups both counts by the attempt date. A store callback can be missing if the customer force-closes the app. Use a Test Store analytics key for sandbox measurements.