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 window closed after the task finished
priopay:close — the window closed first
priopay:error { message, code } the window could not open or the session failed

For setup, finished means the application was submitted for review, not that it was approved.

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);
});

On a site that is not on your allowed list, priopay:error arrives after up to 10 seconds, or 2 seconds after the window's frame loads.

priopay:complete is a hint to refresh your view, not proof — any script on your page can dispatch it. A finished setup shows as review on GET /users/:id/status and sends no webhook. Confirm a pay-button payment with the invoice.created and invoice.updated webhooks, or the invoices read.