Aghanim Integration

Overview

Aghanim is a Direct-to-Consumer (D2C) platform for mobile games that enables in-game purchases and refunds outside of the App Store and Google Play via a web checkout.

The Aghanim integration in Magify allows you to:

  • sell in-game products directly to players;
  • use a single unified product catalog;
  • track purchases and refunds in Magify analytics;
  • treat D2C purchases on par with native store purchases.

The same product can be sold:

  • through Native Stores (App Store / Google Play);
  • through Aghanim (web checkout).

Conceptual Overview: How Aghanim Works

Aghanim is not a store and not a billing SDK.

It is an external D2C web checkout with several fundamental differences from native stores:

  • purchases happen outside the app, in a browser;
  • purchase confirmation is asynchronous;
  • purchases are not tied to the app session;
  • financial values at purchase time are estimated, not final.

These characteristics directly affect:

  • user experience,
  • SDK flow,
  • analytics,
  • pending states,
  • restore behavior.

All edge cases described below are expected behavior, not integration errors.


Platform Support and Payment Methods

App Store (iOS)

  • Aghanim is used as an external payment provider.
  • The purchase flow redirects the user to a browser.
  • Availability depends on regional restrictions and Apple policies.

Google Play (Android)

  • Aghanim does not replace Google Play Billing.
  • Purchases do not go through Google Play In-App Billing.

The Aghanim web checkout may support different payment methods depending on region and configuration, such as credit cards, Apple Pay, Google Pay, PayPal, and others.


Roles and Responsibilities

Aghanim

  • payment processing;
  • web checkout flow;
  • calculation of expected (estimated) revenue;
  • final revenue reconciliation;
  • webhook delivery.

Magify

  • unified product catalog;
  • product export to Aghanim;
  • webhook processing;
  • analytics;
  • store context (store_name);
  • reporting.

App / SDK

  • purchase UX logic;
  • purchase timeout handling;
  • pending state handling;
  • restore logic;
  • delayed / external purchase handling.

Purchase Lifecycle

  • The user initiates a purchase in the app.
  • The app opens the Aghanim web checkout in a browser.
  • The app goes to the background and may lose focus.
  • The user either completes the purchase or exits the checkout.
  • Aghanim sends:
    • item-add for a successful purchase,
    • item-remove for a refund.
  • The app returns to the foreground or restarts.
  • The SDK checks the purchase status.
  • The purchase is confirmed or remains in pending.

A purchase may be confirmed after an app restart — this is a valid and expected scenario.


Products and Pricing

General Rules

  • Products are created only in Magify.
  • Every product must exist in Aghanim.
  • Product catalog integration is one-way: Magify → Aghanim.
  • There is no reverse import from Aghanim to Magify.

Pricing

  • The same product can be sold in the store and via Aghanim only at the same price.
  • Aghanim-exclusive products may have different pricing.
  • In Aghanim, prices are shown as marketing prices (usually $0.01 lower).

Rounding

Prices are rounded to two decimal places.--- Unknown node: hardBreak ---If more precision is provided, mathematical rounding is applied.


Aghanim-Side Integration Setup

Project (Application)

Each Magify application requires a dedicated project in Aghanim.

An Aghanim project contains:

  • products;
  • payment configuration;
  • webhooks;
  • API access keys.

API Keys

The following keys are required:

  • API Key (production);
  • Sandbox API Key.

Webhooks

The following events must be enabled:

  • verify-player;
  • item-add;
  • item-remove.

Webhook secrets are used to validate incoming requests.

Sandbox Environment

Sandbox is fully isolated:

  • separate keys;
  • separate products;
  • separate transactions.

Magify Integration Setup

Integration path in the Magify UI:

Configuration → Integrations → Aghanim Integration → Create New

Required fields:

  • Application;
  • API Key;
  • Sandbox API Key;
  • Webhook Secret;
  • Sandbox Webhook Secret.

Product Import

  • Automatic import runs every 11 hours.
  • Manual bulk import for production and sandbox.
  • Single product import from
    --- Unknown node: hardBreak ---
    Remote Config → Native Elements.

Aghanim Webhooks

  • verify-player — pre-purchase validation;
  • item-add — successful purchase;
  • item-remove — refund.

Webhook events are the primary source of truth for purchase status.


Pending Status and Interrupted Purchases

If a user opens the Aghanim checkout, does not complete payment, and returns to the app, the purchase remains in pending.

The app must apply a timeout when waiting for purchase completion.--- Unknown node: hardBreak ---If the purchase is completed later, it should be processed as a delayed / external purchase.


Sessions and Counters

Aghanim purchases occur outside the app session.

If the user stays in the browser for an extended period:

  • the app session may expire;
  • session-based counters (Transaction / inApps) may reset to 0.

This does not affect purchase validity.


Restore and Re-Purchases

  • Previously purchased products are filtered at the campaign level.
  • Without restore, Magify does not detect Native Store purchases on iOS.
  • Aghanim supports its own restore mechanism.
  • Automatic restore on app launch is supported.

Store Context (store_name)

Supported values:

  • native
  • aghanim
  • mixed

store_name:

  • is calculated from nested campaigns;
  • can be inherited from a parent campaign;
  • is used for analytics in Magify.

Analytics, Revenue, and Reporting

Estimated Revenue

Aghanim sends expected revenue, calculated using estimated FX rates and payment fees.

Final revenue:

  • is reconciled by Aghanim;
  • typically finalized by the 10th of the following month;
  • is not re-sent to Magify.

Negative Revenue

The value in item-remove may exceed item-add.--- Unknown node: hardBreak ---If a single purchase is fully refunded, total revenue may become negative.

Analytics Limitations

  • Aghanim provides only in-app purchase metrics.
  • Store-level breakdown is not included in Aghanim data.
  • Store breakdown is handled in Magify and reflected in daily reports.

Country Field

  • In Magify, country reflects the device locale.
  • In Aghanim, country reflects the payment method / bank country.

Values may differ.


Unity SDK Reference

MagifyManager — Aghanim API--- Unknown node: hardBreak ---https://help.magify.com/unity-sdk/api-collection/magify-manager/magifymanager-aghanim

AghanimStore — Purchases--- Unknown node: hardBreak ---https://help.magify.com/unity-sdk/api-collection/purchases/aghanimstore