Backend integration overview
Most Grona content runs in your app on the signed configuration alone. Offers that carry money are different. The app cannot prove who may receive an offer or what an order was worth, so your servers do that work. This page lists the four jobs your backend does in a Grona mobile integration and shows how they fit together.
The jobs
Section titled “The jobs”| Job | When | What your server does |
|---|---|---|
| Serve the grant source | When a shopper signs in, and again before their grants expire | Inside the shopper’s authenticated session, fetches their grants from Grona server to server and returns them to the app unchanged |
| Verify and redeem grants | When an order is placed | Verifies every grant token the app sent, re-checks the campaign’s conditions against the real order, uses each grant once, and applies the value from the verified claims |
| Report revenue | After orders | Sends order data from your order system, which is the revenue truth for Grona’s analysis |
| Manage keys | Before each key rotation | Pins Grona’s grant public keys by kid, and adds the next key before Grona signs with it |
If your app shows no offers, you need only the revenue job, so that campaigns are measured against real orders.
How the jobs fit together
Section titled “How the jobs fit together”-
The shopper signs in, and your app calls
identifywith their opaque customer id, for examplecus_7Hq2Lm9x. -
The SDK calls your app’s grant source, which calls your backend. Your backend calls Grona’s grants endpoint with your workspace secret key and returns the grants to the app. See Grants and order verification.
-
The SDK verifies the grants with the grant keys your app pins and renders the offers they match, for example a weekend offer of 10% off the order.
-
At checkout, your app sends the grant tokens of the active treatments with the order.
-
Your order backend verifies each token, records each grant as used inside the order transaction, and applies the treatment from the verified claims. A failed check means no treatment, and the order still succeeds.
-
Your order system reports the order to Grona. Grona joins it to the app’s events on the order id and the grant’s
jti. See Report revenue.
What stays with Grona
Section titled “What stays with Grona”- The configuration. Grona signs it and publishes it at your config URL. Your servers neither host nor sign it.
- Eligibility. Grona’s server decides which shopper gets which grant.
- Private keys. Grona holds the private keys that sign configurations, preview pins and grants. You receive only public keys. Grona does not publish them at a URL: it gives them to you, and you pin them. See Rotate signing keys.
- Single use. There is no Grona endpoint that redeems a grant. Your order database enforces single use on
jti.
Keys and secrets
Section titled “Keys and secrets”| Credential | Where it lives | Secret |
|---|---|---|
Workspace key, for example acme-market |
In your app | No. It is a public identifier |
| Config public keys | In your app | No |
| Grant public keys | In your app and in your order backend | No |
| Workspace secret key | On your servers only | Yes. Never ship it in the app |
See Keys and environments and Authentication.