Skip to content

Payment methods (React)

List wallets and exchanges for the loaded session with useGetPaymentMethods. The list refreshes when the session loads or refreshes. If you passed modules when creating the client, methods whose module is not enabled are omitted.

List and route

tsx
import {
  IntegrationProvider,
  IntegrationProviderType,
} from '@swapped/connect-sdk'
import { useGetPaymentMethods } from '@swapped/connect-sdk/react'

function PaymentMethods({
  onSelectBinance,
  onSelectCoinbase,
  onSelectCashApp,
}: {
  onSelectBinance: () => void
  onSelectCoinbase: () => void
  onSelectCashApp: () => void
}) {
  const { paymentMethods, isLoading, error } = useGetPaymentMethods()

  if (isLoading) return <p>Loading…</p>
  if (error) return <p>Failed to load methods</p>

  return (
    <ul>
      {paymentMethods.map(method => (
        <li key={method.id}>
          <button
            type="button"
            onClick={() => {
              if (method.provider === IntegrationProvider.Binance) {
                onSelectBinance()
              } else if (method.provider === IntegrationProvider.Coinbase) {
                onSelectCoinbase()
              } else if (method.provider === IntegrationProvider.CashApp) {
                onSelectCashApp()
              }
            }}
          >
            {method.name}
          </button>
        </li>
      ))}
    </ul>
  )
}

// Narrow to Exchange Pay providers only:
// useGetPaymentMethods({ type: IntegrationProviderType.ExchangePay })

// Cash App is not in the `exchanges` category:
// useGetPaymentMethods({ provider: IntegrationProvider.CashApp })

After the user picks Binance (or another Exchange Pay provider), continue to Exchange Pay. For Cash App (type: cash_app), continue to Cash App. For Coinbase (type: exchange_oauth), continue to Coinbase — a separate OAuth withdraw flow, not Exchange Pay. Use CoinbaseGuard / useCoinbaseAvailability to gate that route. For category: 'wallets' / type: wallet, continue to Wallets.

Shape

Each row is an IntegrationPaymentMethod — a union of wallet, exchange, and Cash App. Shared fields:

FieldUse for
idStable list key
nameFull label
shortName / uniqueShortNameCompact / disambiguated label
providerIntegrationProvider — route and getOne
typeDiscriminant: wallet, exchange_pay, exchange_oauth, cash_app, …
icon.light / icon.darkSmall picker icon
logo.light / logo.darkLarger brand mark
recommendedHighlight in the list
enabledPresent when the API sends it
priority / priorityWallet / priorityExchangeSort within a category

Narrow on type (or provider) before reading variant-only fields. Variants: IntegrationPaymentMethodWallet, IntegrationPaymentMethodExchange, IntegrationPaymentMethodCashApp. API: IntegrationPaymentMethod.

tsx
<img src={method.icon.dark || method.icon.light} alt="" />
<span>{method.shortName || method.name}</span>

Filters

FieldExample
category'exchanges' or 'wallets'
typeIntegrationProviderType.Wallet, IntegrationProviderType.ExchangePay, or IntegrationProviderType.CashApp
providerIntegrationProvider.CashApp, IntegrationProvider.Binance, or [IntegrationProvider.Binance, IntegrationProvider.Kucoin]

Imperative client

tsx
import { useSwappedConnectClient } from '@swapped/connect-sdk/react'

function RestartButton() {
  const client = useSwappedConnectClient()
  return (
    <button type="button" onClick={() => void client.restartSession()}>
      New payment
    </button>
  )
}

For a single method on the client, use client.paymentMethods.getOne({ provider: IntegrationProvider.CashApp }).