Initialize a client with a sessionToken provided by your backend. The client is optional, but it gives you a single place to manage the integration credentials used across the SDK.Documentation Index
Fetch the complete documentation index at: https://dev.moonpay.com/llms.txt
Use this file to discover all available pages before exploring further.
Initialize client
createClient() returns the client synchronously. Method calls on the client (for example, client.getConnection()) return a Result<T, E> you check before reading value.
Parameters
| Property | Type | Required | Description |
|---|---|---|---|
sessionToken | string | ✅ | The sessionToken created on your server. |
apiBaseUrl | string | Override the MoonPay Platform API base URL. Defaults to production. Use this only when MoonPay support has asked you to point at a non-production environment. | |
frameBaseUrl | string | Override the MoonPay frame base URL. Defaults to production. Use this only when MoonPay support has asked you to point at a non-production environment. |
Return value
createClient() returns a Client instance. It does not throw and does not return a Result.
Client
The client instance exposes every integration method:
client.getConnection()client.connect()client.resetConnection()client.getPaymentMethods()client.deletePaymentMethod()client.getQuote()client.getTransaction()client.listTransactions()client.setupWidget()client.setupApplePay()client.setupGooglePay()client.setupBuy()client.setupBuyButton()client.setupChallenge()client.setupAddCard()