@reown/appkit-pay
npm package.usePay
. This hook receives two parameter to manage the success or the error in the process.
usePay(parameters?: UsePayParameters): UsePayReturn
parameters
: Optional onSuccess
and onError
callbacks.returns
: { open, isPending, isSuccess, isError, error, data }
useAvailableExchanges(options?: { isFetchOnInit?: boolean } & GetExchangesParams): UseAvailableExchangesReturn
options
: Control initial fetch behavior.returns
: { data, isLoading, error, fetch }
type GetExchangesParams= { page?: number asset?: string amount?: number | string network?: CaipNetworkId }
usePayUrlActions(): { getUrl, openUrl }
getUrl(exchangeId, params): Promise<PayUrlResponse>
openUrl(exchangeId, params, openInNewTab?): Promise<PayUrlResponse>
(Returns { url, sessionId }
)useExchangeBuyStatus(params: UseExchangeBuyStatusParameters): UseExchangeBuyStatusReturn
params
: { exchangeId, sessionId, pollingInterval?, isEnabled?, onSuccess?, onError? }
returns
: { data, isLoading, error, refetch }