Pre-authorization
Overview
The first step of integrating with the User Wallet Payments method requires the user to pre-authorize AEON Pay to link their wallet and specify an authorization amount.
Pre-authorization Example
This section provides a frontend example for managing USDT authorization on the BSC network.
You can download the pre-authorization demo Click Here.
Main Features
- Connect or disconnect MetaMask wallet
- Authorize USDT spending limit to a specified address
- Check the current USDT allowance
- Revoke authorization
Merchant Integration
Merchants should implement pre-authorization using the following parameters.
Key Variables
usdtAddress
: The USDT contract address on the BSC networkspender
: The address to which USDT spending is authorized, e.g.,0x8A86bEB8fD4CAd14baDa4531082a1E2207aFC51b
usdtABI
: A simplified ABI containing theapprove
andallowance
methods
Main Methods
connectWallet()
: Connects to the MetaMask wallet and stores the address.disconnectWallet()
: Disconnects the wallet and clears the saved address.onWalletConnected()
: Displays the wallet address, relevant buttons, and checks the current allowance.approveUSDT()
: Accepts user input for the amount and calls theapprove
method to authorize spending.checkAllowance()
: Calls theallowance
method to check and display the current authorization.revokeAllowance()
: Revokes the authorization by callingapprove(spender, 0)
.setLoading(isLoading, buttonId)
: Controls the loading state of the specified button.
User Steps
- Install MetaMask and connect to the BSC mainnet.
- Open the page and click Connect Wallet.
- Enter the authorization amount and click Approve.
- Click Check Allowance to view the current authorization status.
- Click Revoke Authorization to cancel the authorization.
Updated 10 days ago