Skip to content

Setup Configuration

The UniwireSDK.setup() function accepts a configuration object with the following parameters.

All Parameters

js
UniwireSDK.setup({
    // Required
    account: 'your-account-id',
    profile: 'your-profile-id',
    
    // Optional configuration
    apiEndpoint: 'https://example.com/',
    passthrough: { orderId: '12345' },
    
    // Display options
    placement: 'modal', // 'modal' = overlay, 'inline' = embedded
    placementTarget: 'payment-container', // only used when placement: 'inline'
    
    // Integration defaults (can be overridden by button data attributes)
    integrationProvider: 'WE',
    integrationLabel: 'Buy with Card',
    showPaymentUrl: true,
    activeTab: 'pay-crypto',
    
    // Event callbacks
    onOpen: (data, code) => {
        console.log('Payment modal opened', data);
    },
    onSuccess: (data, code) => {
        console.log('Payment successful', data);
        // Handle successful payment
    },
    onUpdate: (data, code) => {
        console.log('Payment status updated', data);
    },
    onCancel: (data, code) => {
        console.log('Payment cancelled', data);
    },
    onIncomplete: (data, code) => {
        console.log('Payment incomplete', data);
    }
});

Required Parameters

account

  • Type: String (UUID)
  • Description: Your Uniwire account ID
  • Example: account: '79fadc6f-bbe1-4d5f-bc67-94a39fadb560'

Note: The account determines whether your integration uses testnet or mainnet networks. Different accounts can be configured for testing (testnet) or production (mainnet) environments.

profile

  • Type: String (UUID)
  • Description: Your Uniwire profile ID
  • Example: profile: '4da606c1-c38f-46a7-a9d1-623916b53440'

Note: The profile determines which cryptocurrencies are enabled and available for payments in your integration. Each profile can have different currency settings configured in your Uniwire dashboard.

Optional Parameters

apiEndpoint

  • Type: String
  • Description: Custom API endpoint URL
  • Default: https://uniwire.com/
  • Example: apiEndpoint: 'https://example.com/'

Setup Defaults (Overridable by Button Attributes)

The following parameters can be set as defaults in the setup configuration and will be overridden by corresponding data-* attributes on payment buttons:

passthrough

  • Type: Object or String (JSON)
  • Description: Additional data passed to callbacks and backend
  • Example: passthrough: { orderId: '12345', userId: 'user123' }

placement

  • Type: String
  • Description: Display mode (inline or modal)
  • Default: modal
  • Example: placement: 'inline'

Note: When placement: 'modal', the payment widget appears as an overlay on top of the page. When placement: 'inline', the widget is embedded directly into a specific element on the page with ID defined in placementTarget.

placementTarget

  • Type: String
  • Description: Target element ID for inline placement (only used when placement: 'inline')
  • Example: placementTarget: 'payment-container'

Note: This parameter is only used when placement: 'inline'. If not specified, the widget will be appended to the document body. The target element must exist in the DOM.

showPaymentUrl

  • Type: Boolean
  • Description: Show payment URL link in the modal
  • Button Override: data-show-payment-url
  • Example: showPaymentUrl: true

integrationProvider

  • Type: String
  • Description: Integration provider (e.g., 'WE')
  • Button Override: data-integration-provider

integrationLabel

  • Type: String
  • Description: Custom label for integration tab
  • Button Override: data-integration-label
  • Example: integrationLabel: 'Buy with Card'
  • Example: integrationProvider: 'WE'

integrationOnly

  • Type: Boolean
  • Description: Show only integration tab, skip crypto payment options
  • Button Override: data-integration-only
  • Example: integrationOnly: true

activeTab

  • Type: String
  • Description: Default active tab when modal opens
  • Button Override: data-active-tab
  • Options: 'pay-crypto', 'credit-card', 'integration'
  • Example: activeTab: 'integration'

Note: These parameters can be set globally in the setup configuration as defaults, but individual buttons can override them using the corresponding data-* attributes. Button attributes always take precedence over setup defaults.

Third-party Integrations

For detailed information about setting up third-party integrations (for fiat onramp, etc.), see our Third-party Integrations Guide.

Event Callbacks

onOpen

  • Type: Function
  • Description: Called when payment modal opens
  • Parameters: (data, code)
  • Example: onOpen: (data, code) => console.log('Modal opened', data)

onUpdate

  • Type: Function
  • Description: Called when payment status updates
  • Parameters: (data, code)
  • Example: onUpdate: (data, code) => console.log('Payment updated', data)

onSuccess

  • Type: Function
  • Description: Called when payment is successful
  • Parameters: (data, code)
  • Example: onSuccess: (data, code) => console.log('Payment successful', data)

onIncomplete

  • Type: Function
  • Description: Called when payment is incomplete
  • Parameters: (data, code)
  • Example: onIncomplete: (data, code) => console.log('Payment incomplete', data)

onCancel

  • Type: Function
  • Description: Called when payment is cancelled
  • Parameters: (data, code)
  • Example: onCancel: (data, code) => console.log('Payment cancelled', data)

onNetworkChange

  • Type: Function
  • Description: Called when network selection changes
  • Parameters: (data, code)
  • Example: onNetworkChange: (data, code) => console.log('Network changed', data)

Parameter Categories

Authentication

  • account - Your Uniwire account identifier
  • profile - Your Uniwire profile identifier

Configuration

  • apiEndpoint - Custom API endpoint
  • passthrough - Additional data for callbacks

Display Options

  • placement - Modal or inline display
  • placementTarget - Target element for inline mode

Integration

  • integrationProvider - Default payment provider

Button Data Attributes (Defaults)

  • integrationLabel - Custom integration tab label
  • showPaymentUrl - Show payment URL link
  • integration - Integration type
  • integrationProvider - Integration provider
  • integrationOnly - Show only integration tab
  • activeTab - Default active tab

Events

  • onOpen - Modal opened callback
  • onUpdate - Payment status callback
  • onSuccess - Payment success callback
  • onIncomplete - Payment incomplete callback
  • onCancel - Payment cancelled callback
  • onNetworkChange - Network change callback