Import
Usage
[abis/mintFunctionAbi.ts]
[components/BuyNFT.tsx]

Return Type: UseSelectPaymentModalReturnType
The hook returns an object with the following properties:
Properties
openSelectPaymentModal
(settings: SelectPaymentSettings) => void
Function to open the Payment Selection modal with the specified settings.
Parameters:
The settings object can include the following properties:
| Parameter | Type | Description |
|---|---|---|
collectibles | Array<{tokenId: string, quantity: string}> | Array of collectibles to purchase |
chain | number | Blockchain network ID |
price | string | Price in smallest unit of the currency |
targetContractAddress | string | Address of the contract to interact with |
recipientAddress | string | Address to receive the purchased items |
currencyAddress | string | Address of the currency token contract |
collectionAddress | string | Address of the NFT collection contract |
creditCardProviders | string[] | List of supported credit card providers (e.g., ‘transak’) |
copyrightText | string | Copyright text to display in the modal |
onSuccess | (txnHash: string) => void | Callback when transaction succeeds |
onError | (error: Error) => void | Callback when an error occurs |
onClose | () => void | Callback when the modal is closed |
txData | string | Encoded transaction data for the purchase |
forteConfig | object | Forte configuration |
forteConfig
TheforteConfig object must be provided to enable Forte payments.
The protocol must be set to either custom_evm_call or mint depending on whether the transaction is a mint or a general transaction.
Furthermore, a sellerAddress string must be provided, indicating the address of the seller in the case of a transaction or the address of the contract in the case of a mint
The calldata can be either a string with the calldata (the same as the txData already provided) or a structured calldata object, detailing the function name and the arguments. Crucially, the structured calldata requires a receiver address to be specified as shown in the example below.
closeSelectPaymentModal
() => void
Function to close the Payment Selection modal.
selectPaymentSettings
SelectPaymentSettings | undefined
The current settings configuration for the Payment Selection modal.
Notes
This hook provides methods to control the Payment Selection modal that allows users to purchase digital assets with multiple payment options. The modal offers various payment methods including:- Pay with cryptocurrency from the user’s wallet
- Swap tokens to pay with a different cryptocurrency
- Pay with credit/debit card
- Receive funds from another wallet