Skip to main content

URL

https://blocks.moonpay.com/platform/v1/apple-pay

Requirements

Size

The frame container height must be 56px. Width is flexible; the Apple Pay button inside the frame uses 100% of the container width.

Permissions

The payment permission policy is required.
Example
<iframe
  src="https://blocks.moonpay.com/platform/v1/apple-pay"
  allow="payment"
/>

Initialization parameters

PropertyTypeRequiredDescription
clientTokenstring✅The client token returned from the connect flow.
channelIdstring✅A 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.
signaturestring✅The quote signature from the quote endpoint. Pass signature as returned.

Events

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

Outbound events

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

handshake

The frame requests that you open a message channel.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "handshake"
}

ready

The frame finished loading and the UI is fully rendered. You can use this to coordinate UI transitions if needed.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "ready"
}

complete

The transaction is complete. Use the transaction ID to track status updates (for example, by polling or via webhooks).
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "complete",
  "payload": {
    "transaction": {
      "id": "txn_01",
      "status": "pending"
    }
  }
}

error

This event dispatches errors that occur in the flow and, if available, provides steps for recovery.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "error",
  "payload": {
    "code": "ipAddressMismatch",
    "message": "The client IP address does not match the session."
  }
}

Inbound events

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

ack

Acknowledge the handshake.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "ack"
}

setQuote

Provide a new quote to the frame. Pass signature as returned by the quote endpoint. Upon receiving this event, the frame disables the Apple Pay button until the quote is revalidated.
{
  "version": 2,
  "meta": { "channelId": "ch_1" },
  "kind": "setQuote",
  "payload": {
    "quote": {
      "signature": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9..."
    }
  }
}