Skip to content

App Stores

After each purchase, the app receives a token which is sent to backend. It then talks to the respective store and verifies this token. If valid, it then assigns a subscription for the given user. In case of Group Premium it also makes that group Premium.

Subscriptions are slightly more complicated because we need to track whether they are still active to update our UI (and allow reactivating). App Store & Android have a defined callback url which is triggered when the status of a subscription changes. Stripe doesn't have this callback now because there is no UI outside of Settle Up where users can cancel their subscription.

Backend also iterates over all subscriptions about to expire / shortly expired and tries to verify them. After a configured time period it gives up and stops trying to verify.

Stripe offers

To configure a Stripe offer (which is already seeded in our database) go to Product Catalog -> Coupons -> Create Coupon. Give it a consumer-readable name and (important) our fixed ID which matches the offer key in database, e.g. cyber-mondaay-2025.

After you configure and save the coupon go to All products -> pick the product & price you're promoting. Then Edit metadata -> set key offerId and value the same ID you used for the coupon. Hit save and you're done.

AppStore offers

Promotional offers require a signature certifying user's eligibility. iOS app needs to call the generateOfferSignature callable function with payload

{
  productId: string;
  offerId: string;
}

The function returns a following object:

export interface OfferSignatureResponse {
  nonce: string;
  timestamp: number;
  keyId: string;
  signature: string;
}