Skip to main content
Build a checkout button that charges a user in USDSC. Inside the Startale App, gas is sponsored by Startale, so the user pays only the stablecoin amount. This walkthrough targets a Mini App. To ship the same flow as a standalone application, configure a paymaster through paymasterOptions and send through wallet_sendCalls rather than the useWriteContract path shown here, because only batched calls carry a custom paymaster.

What you’ll build

A single button that:
  1. Connects the user (if not yet connected).
  2. Sends a USDSC transfer from the smart account to a recipient address.
  3. Reads the on-chain receipt to confirm the payment.

Prerequisites

  • A working connect button.
  • A recipient address controlled by your app. Your own EOA is fine.
  • A smart account funded with USDSC.

Steps

1. Define constants

src/constants.ts

2. Build the pay button

src/PayButton.tsx

3. Render it

src/App.tsx

4. Verify the receipt

useWaitForTransactionReceipt from wagmi resolves once the transaction lands. The isSuccess flag flips when the receipt is available with status 'success'. For a deeper verification, read the recipient’s USDSC balance after the receipt:

Reading decimals dynamically

Hardcoding 6 works today, but if Startale ever upgrades USDSC to use different decimals, the math breaks. The defensive pattern reads them at runtime:
Cache the result; it doesn’t change often.

What you’ve learned

  • How to send an ERC-20 transfer from the user’s smart account.
  • That the user pays no gas inside the Startale App, where sponsorship is automatic.
  • How to confirm settlement on-chain with viem and wagmi.

Next

Build your first Mini App →