Chargeline docs
v1.0.0
Get help
● Set up

Purchase verification
Apple and Google, optional.

The server can ask the stores whether a purchase is real and record it as revenue. It is off by default; the app works without it.

App Store Server APIGoogle Play service account

01What it does

When on, the app sends the purchase proof to POST /v1/purchases/verify: the App Store signed transaction (JWS) or transaction id, or the Google Play purchase token. The server checks it with the store and records a revenue event (store transaction id, gross price, time). It stores no install id with it. Credentials are write-only in the console and encrypted with ADMIN_SECRET_KEY.

Verified purchases then appear under Console, Revenue. This is a record of what the stores confirm; it is not a payout statement and does not include store fees or tax.

02Apple

  1. Console, Purchases: turn on Verify App Store purchases and enter your iOS bundle id.
  2. A signed transaction (JWS) is checked against Apple's public root certificate; no key is needed for that.
  3. To also look up a transaction by its id you need an App Store Server API key: in App Store Connect, Users and Access, Integrations, In-App Purchase (or App Store Connect API area as your account shows it), generate a key. Download the .p8 file once (Apple shows it only once), and note the Key ID and the Issuer ID.
  4. Paste Key ID, Issuer ID and the contents of the .p8 file into the three secret fields and use Test connection.

The server tries Production first, then Sandbox. Sandbox purchases are accepted as valid but not recorded as revenue.

03Google Play

  1. In Google Cloud (the project linked to your Play account) create a service account and download a JSON key. Enable the Google Play Android Developer API for that project.
  2. In Play Console, Users and permissions: invite the service account's email and give it View app information and View financial data (the second one shows the amount paid) for your app.
  3. Console, Purchases: turn on Verify Google Play purchases, enter the Android package name, and paste the whole JSON into Google Play service account. Use Test connection.

Acknowledgement is done by the app, not the server. The server only reads the purchase; the app calls completePurchase, which acknowledges it on Android. Permissions can take some time to apply after you invite the account.

04What is not verified

The store calls were only tested against mocked responses by the author. Run one real purchase with a test account on each store and check that it appears under Revenue before you rely on it.