Backend Validation & Merchant API
Authenticate to the Onside Merchant API and validate transactions from your own backend.
Your backend validates a purchase by querying the Onside Merchant API for an order, verifying the signed response, and granting entitlements. This is a server-to-server flow — never ship your Merchant Secret in the app.
Prerequisites
Request these credentials from the Onside team at merchant-support@onside.io. Include your company name and app name:
Merchant ID
Merchant Secret
Secret Key ID (
kid)
Authentication
Authenticate each request with a JSON Web Token (JWT) in the Authorization header, signed with HS256 using your Merchant Secret.
Header
alg:HS256kid: your Secret Key ID
Claims
aud:onsideiss:onsidesub: your Merchant IDexpandnbf: a validity window of no more than 30 secondsjti: a unique token ID
Request
Fetch the in-app purchase history for an order:
Response
On success the Merchant API returns a signed JWS. After verifying it, the payload is a TransactionHistory object listing transaction events.
Verify the response
Verify the JWS signature using Onside's public keys, available at:
Then confirm the decoded payload against the TransactionHistory schema before granting entitlements.
Subscriptions
A subscription order is validated through the same endpoint and the same TransactionHistory shape. A subscription transaction differs from a one-time purchase in a few fields:
product_typeis"SUBSCRIPTION"(rather than"CONSUMABLE"/"NON_CONSUMABLE").expires_atholds the end of the current billing period — it isnullfor non-expiring products.subscription_ididentifies the subscription the transaction belongs to.Each renewal is an additional transaction in the
transactionsarray, withtransaction_reason"RENEWAL"and the sameoriginal_order_idas the first purchase.A refund sets
revocation_dateandrevocation_reason.
Treat the subscription as active when its most recent transaction has an expires_at in the future and a null revocation_date. The example below shows an initial purchase followed by one renewal:
API reference
The full request/response schema is documented in the API reference for this section (see the navigation entry under Backend Validation & Merchant API).
Last updated
Was this helpful?