Skip to main content
The reset frame is a headless page hosted on a MoonPay domain. Use it to clear the user’s authentication tokens stored on MoonPay’s domain, allowing partners to log users out. The frame communicates completion or errors to the parent window via postMessage.

URL

https://blocks.moonpay.com/platform/v1/reset

Initialization parameters

ParameterTypeRequiredDescription
channelIdstringA unique identifier for the frame generated on your client. This value is attached to each postMessage payload to help identify messages.

The format of this string is up to you.
clientTokenstringThe client token returned from the connect flow. Authorizes your domain to embed the frame (see note).
apiKeystringYour publishable API key. Also authorizes your domain to embed the frame.
The reset frame carries no session of its own, so MoonPay identifies your integration from the token you pass — either your connect-flow clientToken or your publishable apiKey. That identity authorizes your domain to embed the frame (via the frame-ancestors Content Security Policy). Without one, the browser blocks the frame from loading on your domain — it never runs, so it cannot even report an error; the parent simply never receives a handshake.

Events

All events are dispatched using the message pattern described in the frames protocol. Below are the event payloads specific to the reset frame.

Outbound events

frame->parent These events are sent from this frame to the parent window.

handshake

Sent when the frame loads. The parent must respond with ack.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "handshake"
}
type <> =  & {
  : 2;
  : { : string };
};

type  = <{
  : "handshake";
}>;

complete

Sent when the user’s session has been successfully cleared.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "complete"
}
type <> =  & {
  : 2;
  : { : string };
};

type  = <{
  : "complete";
}>;

error

Sent when the reset fails.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "error",
  "payload": {
    "code": "generic",
    "message": "Failed to clear session"
  }
}
type <> =  & {
  : 2;
  : { : string };
};

type  = <{
  : "error";
  : {
    : "generic";
    /** A developer-facing error message with details on recovery or documentation. This message is not intended to be rendered in UI. */
    : string;
  };
}>;

Inbound events

parent->frame These events are sent from the parent window to this frame.

ack

Must be sent in response to handshake. The frame will not proceed until it receives this.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "ack"
}
type <> =  & {
  : 2;
  : { : string };
};

type  = <{
  : "ack";
}>;