palbaseDocs

Palbase IAP · API

POST/iap/paywalls/validate

Check a paywall

Checks a definition as publishing it would, without saving anything: every rule of its schema, and every package against the catalog as it is. A definition that passes is answered with its warnings (what App Review expects of a subscription's paywall: a restore button, the legal links); one that breaks a rule is refused with every problem (422 invalid_paywall).

Called by your server, with the project's secret key.

Headers

Idempotency-Keystring · optionalMakes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.

Request body

default_localestring · requiredThe language a text falls back to: a tag such as en or pt-BR.
footerobject · optionalA component, by its type. A newer schema adds components; an app never draws a definition with one it does not know.
headerobject · optionalA component, by its type. A newer schema adds components; an app never draws a definition with one it does not know.
localesobject · optionalThe texts in each language (at most 40), by language tag: a component's `{"t": key}` is the app's language's, or the default locale's when it lacks the key.
namestring · requiredThe paywall's name, for the people who edit it (1 to 100 characters).
rootobject · requiredA component, by its type. A newer schema adds components; an app never draws a definition with one it does not know.
schemainteger · requiredThe schema the definition is written in: 2. An app says the newest schema it draws (X-Palbase-Paywall-Schema) and is given the newest version written in it or an older one; an app that draws no schema this server takes is told to update (426).
sheetsobject · optionalThe sheets by id (lowercase letters, digits, _ and -, starting with a letter).
themeobject · requiredThe paywall's design system: colors for light and dark, a type scale, radii and spacing; the components name them.
curl
curl -X POST "https://<your-ref>.palbase.studio/iap/paywalls/validate" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"default_locale":"string","name":"string","root":{"action":{"type":"close"},"content":{"action":null,"content":null,"type":"button"},"type":"button"},"schema":2,"theme":{"colors":{"dark":{},"light":{}}}}'

Responses

200It passes; the warnings

400The request is malformed, or a field breaks a rule (the error names which)

401No key, not a key of this project, or a token that is not valid (the edge's answer)

403Not the project's secret key (`secret_key_required`)

409A request with this Idempotency-Key is still running (`idempotency_key_in_use`, Retry-After)

413The request is over 256 KiB (`request_too_large`)

422The definition breaks a rule (`invalid_paywall`, with every problem). Or the Idempotency-Key was sent with a different request (`idempotency_key_reused`)

429Over the project's request limit; Retry-After says when to try again

503The project's storage could not be read to check the paywall's assets (`storage_unavailable`); retrying is safe after Retry-After. Or temporarily unavailable

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation ValidatePaywall of iap's contract.