All articles

App Store attribution

How to attribute App Store subscription renewals to an affiliate

Map the first paid transaction, every renewal, refunds, and cancellations to a single commission state using an appAccountToken and App Store Server Notifications v2.

Published · Last reviewed

Written by Attribloom Engineering · Reviewed by Attribloom Product · Last reviewed

One token, a whole subscription lifecycle

A subscription is not one event. It is a first purchase, then a series of renewals, sometimes a refund, sometimes a cancellation. To pay an affiliate fairly you have to tie all of those events back to the same referral and keep a running commission state, not just credit the first charge.

The key that makes this possible is the StoreKit 2 appAccountToken. It is a UUID your app sets on the purchase, and Apple echoes it back in the signed transaction and in every App Store Server Notification about that subscription. Because the same token rides every renewal notification, each renewal resolves to the same affiliate without any new client action.

The event to commission map

App Store Server Notifications v2 arrive as signed JWS messages with a notificationType. Attribloom verifies each one against Apple's certificate chain, reads the appAccountToken, finds the affiliate, and moves the commission state accordingly.

  • First paid transaction: confirm the conversion and accrue commission on the real transaction value, excluding trials.
  • Renewal: accrue again against the same affiliate, because the token is carried on the renewal notification.
  • Refund: reverse the commission for that transaction through a clawback.
  • Cancellation: stop future accrual. A cancellation is not a refund, so it does not reverse commission already earned on paid periods.

Why renewals need a hold, not just a credit

A renewal can still be refunded after it is charged. Attribloom matures each commission for 30 days before it becomes payable, so a refund that lands inside that window reverses cleanly before any money settles. If a refund arrives after payout, the amount is recorded against the affiliate's future balance.

All of this posts to a double-entry ledger in integer minor units, so a duplicate notification cannot double-pay and a reversal is always a balanced entry. Apple re-delivers notifications and Attribloom deduplicates by notification identifier, which is what makes the renewal stream safe to replay.

Sources and verification

Primary documentation last checked on 2026-07-20. Each source below links the exact page and its own last-checked date.

Next steps

Frequently asked

Does each renewal need the app to set the token again?

No. You set the appAccountToken once on the original purchase. Apple carries it on every renewal notification, so renewals attribute to the same affiliate with no further client action.

Is a cancellation treated like a refund?

No. A cancellation stops future renewals and future accrual, but it does not reverse commission already earned on periods the customer paid for. Only a refund triggers a clawback of a specific transaction.

What if a renewal is refunded after the affiliate was paid?

The commission is clawed back against the affiliate's future balance, and written down as a loss only if it cannot be recovered. The 30-day hold is designed to catch most refunds before payout.

In the glossary

Continue reading

Get startedSee pricingMore articles