- Attribute payments and subscriptions collected through Stripe back to the install and ad campaign that drove them.
- See Stripe revenue alongside your app-store revenue in Appstack.
To successfully connect Stripe, you must:
- Have Owner/Admin access to an Appstack organization.
- Have your own backend create the Stripe objects your app charges through (Checkout Sessions, Subscriptions, or PaymentIntents). This integration is server-side, and can’t be done from the app alone.
This page covers attaching the Appstack ID to your Stripe data. If you haven’t installed the Appstack app from the Stripe App Marketplace and connected your account to your organization yet, do that first. From Appstack, go to Integrations > Stripe.
Why this needs your backend
Every other Appstack integration reads a value your app’s SDK already has. Stripe is different: the objects that generate your revenue events (Customer, Subscription, Checkout Session) are created by your server, not by code running on the device. There’s no SDK hook that can reach them. Stripe also enforces this at the API level: it only returns an object’s metadata to requests made with your secret key. A publishable key (the kind that ships inside a mobile app) never sees it, even if you try. So this has to be implemented once, in whatever backend code creates your Stripe objects. The upside is that it’s a small amount of work. Attach the ID once, when the customer checks out, and Stripe carries it forward automatically for the life of that subscription. You never touch it again for that customer, including at renewal, a year later.Connect to Stripe
Follow the steps to attribute your Stripe revenue:1
Get the Appstack ID in your app
Read the Appstack ID on-device, the same way you would for any partner integration, and send it to your own backend along with whatever request kicks off checkout.This isn’t a new endpoint: your app already calls your own backend to create the Checkout Session, since only server-side code can hold a Stripe secret key. Add the Appstack ID as one more field on that existing request.
2
Attach it when you create the Checkout Session
Which parameter you use depends on what you’re selling. Use exactly the key name One-time payments — set it under Using a Payment Link instead of your own backend? You won’t have server code running at click time, so use the This only reaches the initial purchase, not renewals. See the note below.
appstack_id: that’s what Appstack reads back out on our side.Subscriptions — set it under subscription_data.metadata. Stripe copies it onto the Subscription it creates, and from there onto every invoice that subscription ever generates, including renewals:payment_intent_data.metadata instead. Stripe copies it onto the PaymentIntent, and from there onto the resulting Charge:client_reference_id URL parameter instead:The link has to be built dynamically in your app at open time, with the real ID inserted: a static link copied from the Stripe dashboard has nowhere to put a per-user value.Why setting it once at checkout is enoughStripe takes an immutable snapshot of a subscription’s metadata onto every invoice it generates, for as long as that subscription exists. You don’t need to re-attach anything on renewal. Stripe does it automatically.
Payment Links carry less
client_reference_id only reaches the checkout.session.completed event. It never propagates to invoices, so it can attribute the first purchase but not a subscription’s renewals. It also silently drops values with characters outside A-Za-z0-9-_, with no error, so double-check the ID reaches Stripe intact.List of events
These are the raw Stripe events Appstack reads once your integration is set up. There’s no separate Appstack-specific naming for Stripe yet: you’ll see these under their normal Stripe names.Troubleshooting
General tips
- Set it server-side, not client-side. A publishable key can’t read or write metadata: attempting this from the app itself fails silently or is rejected by Stripe, depending on the call. It has to run wherever your backend creates the Checkout Session.
- Use the indirect parameter, not the top-level one.
subscription_data.metadata/payment_intent_data.metadata, not the Checkout Session’s ownmetadatafield. See the warning above. - Use the exact key
appstack_id. A typo or different casing means Appstack never finds it, with no error on either side. - Read invoices for subscription revenue, not charges. A subscription’s renewal charges don’t carry your metadata: only the invoice does.
- Contact support: if issues persist, reach out with specific error messages at support@appstack.tech.