client.connect().
The SDK runs the check in a hidden frame, decrypts the returned credentials, and primes the client so that subsequent SDK calls (such as getPaymentMethods() or getQuote()) are authenticated automatically.
Get a connection
Parameters
client.getConnection() takes an optional options object.
Result
client.getConnection() returns a Result<Connection, GetConnectionError>.
Result envelope
Result<Connection, GetConnectionError>
Connection
Connection is a discriminated union over status. The fields present depend on the status:
Fields
UnavailableReason
UnavailableReason is exported from @moonpay/platform-sdk-web. It is present only when status is "unavailable". It can be missing, and MoonPay can add values. Handle a missing or unrecognized value like generic.
CustomerCapabilities
Capabilities and regulatory requirements for the customer.
RampsCapability
types.ts
GetConnectionError
GetConnectionError covers failures to run the connection check (for example, a frame handshake timeout).