Utility methods for users of the iaptic library.

Constructors

Methods

  • Generate a localized version of the billing cycle in a pricing phase.

    For supported languages, check IapticSupportedLocales.

    Example outputs:

    • "3x 1 month": for FINITE_RECURRING, 3 cycles, period "P1M"
    • "for 1 year": for NON_RECURRING, period "P1Y"
    • "every week": for `INFINITE_RECURRING, period "P1W"

    Parameters

    Returns string

    IapticRN.utils.formatBillingCycle(offer.pricingPhases[0])
    
  • Format a currency amount from micros with proper localization

    Parameters

    • amountMicros: number

      Amount in micros (1/1,000,000 of currency unit)

    • currency: string

      ISO 4217 currency code (e.g., 'USD', 'EUR')

    Returns string

    Formatted currency string

    Utils.formatCurrency(1990000, 'USD') // Returns "$1.99"
    Utils.formatCurrency(1000000, 'EUR') // Returns "€1"
  • Parameters

    • iso: `P${number}D` | `P${number}W` | `P${number}M` | `P${number}Y`
    • count: number
    • OptionalincludeCount: boolean

    Returns string

  • Returns the MD5 hash-value of the passed string.

    Parameters

    • account: string

    Returns string

  • Generate a UUID v3-like string from an account string.

    The username is first hashed with MD5, then formatted as a UUID v3-like string by adding dashes between the different parts of the hash.

    This is used to generate a appAccountToken for Apple App Store purchases.

    Parameters

    • account: string

      The account string

    Returns string

    The UUID v3-like string