Was this helpful?
Send stablecoin payments between accounts on Tempo. Payments can include optional memos for reconciliation and tracking.
TransferReceivePolicyGuard.TransferBlocked so redirected funds can be surfaced and claimed later.By the end of this guide you will be able to send payments on Tempo with an optional memo.
Send a payment using the standard transfer function:
Include a memo for payment reconciliation and tracking. The memo is a 32-byte value that can store payment references, invoice IDs, order numbers, or any other metadata.
Send multiple payments in a single transaction using batch transactions:
When you send a payment, the token contract emits events:
transferWithMemo)You can filter these events to track payments in your off-chain systems.
Users should see a loading state when the payment is being processed.
You can use the isPending property from the useTransferSync hook to show pending state to the user.
If an error unexpectedly occurs, you can display an error message to the user by using the error property from the useTransferSync hook.
import { Hooks } from 'wagmi/tempo'
function SendPayment() {
const sendPayment = Hooks.token.useTransferSync()
return (
<>
{/* ... your paymentform ... */}
{sendPayment.error && <div>Error: {sendPayment.error.message
Ensure that you have set up your project with Wagmi, a Tempo chain config, and a wallet connector:
Before you can send a payment, you need to fund your account. In this guide you will be sending AlphaUSD (0x20c000…0001).
The built-in Tempo testnet faucet funds accounts with AlphaUSD.
import { } from 'wagmi/tempo'
import { } from 'wagmi'
function () {
const { } = ()
const { , } = ..
return (
< ={() => ({ : })}
Add Funds
</>
)
}import { } from 'viem/chains'
import { , }
Now that you have AlphaUSD you are ready to add logic to send a payment with an optional memo.
Now that you can send a payment, you can display the transaction receipt on success.
Now that you have made a payment you can
import { } from 'wagmi/tempo'
import { , , } from 'viem'
function () {
const = ..()
return (
< ={
() => {
.()
const = new (. as HTMLFormElement)
const = (.('recipient') ||
'0x0000000000000000000000000000000000000000') as `0x${string}`
const = (.('memo') || '') as string
.({
: ('100', 6),
: ,
: '0x20c0000000000000000000000000000000000001',
: ? ((), { : 32 })
})
}
}>
<>
< ="recipient">Recipient address</>
< ="text" ="recipient" ="0x..." />
</>
<>
< ="memo">Memo (optional)</>
< ="text" ="memo" ="Optional memo" />
</>
<
="submit"
={.}
>
Send Payment
</>
</>
)
}import { } from 'viem/chains'
import { , }
import { } from 'wagmi/tempo'
import { , , } from 'viem'
function () {
const = ..()
return (
<>
{/* ... your payment form ... */}
{. && (
< ={`https://explore.tempo.xyz/tx/${...}`}>
View receipt
</> {}
)}
</>
)
}import { } from 'viem/chains'
import { , }