@moonpay/platform-protocol
v1.8.0
Published
Shared protocol types for the MoonPay Developer Platform
Keywords
Readme
@moonpay/platform-protocol
Shared protocol and API types for the MoonPay Developer Platform SDKs. This package is the single source of truth for the contract between MoonPay frames and partner integrations: wire protocol primitives, per-frame message maps, domain models, REST API types, and the Result type all SDK methods return.
It contains types only, plus the tiny ok() / err() helpers for constructing Result values — there is no other runtime code.
Installation
This package ships as a dependency of the platform SDKs (@moonpay/platform-sdk-web, @moonpay/platform-sdk-react-native, @moonpay/platform-sdk-node), so most integrations don't install it directly. Install it standalone when you need the types on their own:
npm install @moonpay/platform-protocolUsage
There is no barrel export — import from subpaths:
import type { Result } from '@moonpay/platform-protocol/result';
import type { Quote, Transaction } from '@moonpay/platform-protocol/api';
import { ConnectionStatus } from '@moonpay/platform-protocol/models/connection';
import type { Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget';Subpath exports
| Subpath | Contents |
|---------|----------|
| ./protocol | Wire format primitives: message envelope, handshake/ack, FrameError |
| ./result | Result<T, E>, EmptyResult<E>, ok(), err() |
| ./frames/* | Per-frame message maps (widget, apple-pay, google-pay, buy, buy-button, connect, auth, add-card, challenge, reset, customer-export) |
| ./sdks/* | SDK-facing event and setup error types per frame |
| ./models/* | Cross-frame domain models (connection, transaction, challenge) |
| ./api | REST API types (quotes, transactions, payment methods) |
| ./api/identity | Identity API types (deprecated — see ./api/customer) |
| ./api/customer | Customer API types |
| ./api/errors | API error types |
Documentation
Full guides and API reference: dev.moonpay.com
License
MIT
