Web SDK
Errors
Every error and warning the SDK and its delivery API can produce, what causes it and how to fix it.
Where errors show up
| Call | Load failures | Other errors |
|---|---|---|
presentPaywall, mountPaywall, loadPaywall | The promise rejects. Use try/catch. | onError |
startAutoPlacements | onError | onError |
React <Paywall> | onError | onError |
<uikit-paywall> | uikit-error event | uikit-error event |
API error codes
The delivery API answers errors as { error: { code, message } }. The SDK throws UIKit: followed by the message.
| Status | code | Message | Cause and fix |
|---|---|---|---|
| 401 | invalid_key | Missing or invalid public key | The key is missing, mistyped, revoked, or not a pk_ key. Copy it from API keys. |
| 403 | origin_not_allowed | ORIGIN is not in this project's allowed websites | Add the site in Allowed websites. |
| 404 | not_found | Placement not found | The key matches no placement. Check spelling and the project. |
| 404 | not_found | Paywall not found | The placement has no screen chosen. |
| 404 | not_found | Published paywall not found | The screen was never published (or was deleted). Publish it. |
| 400 | bad_request | Body must be JSON, or a field message | An events request was malformed. Not caused by normal use. |
| 429 | rate_limited | Too many events, slow down | More than 1200 events a minute on one key. Events are dropped. |
| 500 | internal | Something went wrong on our side. Try again. | Server fault. A saved copy is used if there is one. |
A 5xx answer, a network failure or a timeout uses the saved copy when one exists. A 4xx answer is never replaced by a copy.
Messages thrown by the SDK
| Message | Cause and fix |
|---|---|
UIKit: call configure({ apiKey }) before loading a placement | Call configure first. |
UIKit: the paywall took too long to load | No answer within timeoutMs and no saved copy. |
UIKit: could not load paywall (STATUS) | A non-OK answer with no message. |
Could not load paywall (STATUS) from URL | A URL source answered non-2xx. |
Not a paywall JSON: expected components_config.base | The JSON or URL does not hold a screen. |
UIKit: pass onPurchase to handle purchase buttons | A purchase button was tapped with no onPurchase. Sent to onError. |
UIKit: set element.onPurchase to handle purchase buttons | The same, for the web component. |
UIKit: screen ID could not be loaded | A linked screen failed to load. It is retried on the next tap. |
UIKit: not opening "..." : only http(s), mailto and tel links open | A link with another scheme was refused. |
Warnings
[UIKit] No price for package(s) ... Pass them in products is logged to the console when a package ID has no price.