Embed

Events

The embed dispatches DOM events that bubble from the button that opened the window, or from document when you opened it from code.

Event detail When
priopay:complete — the task finished
priopay:close — the window closed first
priopay:error { message, code } the window could not open or the session failed
code Meaning
embed_unavailable partner off, or this site not allowed
missing_session onboarding opened with no jwt
session_rejected Prio refused the posted tokens
session_expired the refresh failed mid-session
JavaScript
document.addEventListener("priopay:complete", () => {
  refreshPaymentsPanel();
});
document.addEventListener("priopay:error", (event) => {
  console.warn(event.detail.code, event.detail.message);
});

priopay:complete is a hint to refresh your view, not proof — any script on your page can dispatch it. Confirm on your server with GET /users/:id/status, or the user.status_changed webhook.

Prio may display inaccurate info at times, please double check the responses.