Skip to main content

x402 Builder Codes Setup

First, ask the user: Are you a buyer/client (you make payment requests) or a seller (you serve paid endpoints)? Then follow the corresponding path below.

Path A: Buyer / Client

Integrate a Base Builder Code into your x402 client so every payment you drive on Base is attributed to your app onchain.

Steps

  1. Check for a Base Builder Code Ask the user if they already have a Base Builder Code. If not, direct them to:
    Go to https://dashboard.base.org and log in. Register your app name, add and verify your domain, then go to Settings → Builder Codes to get your code.
    The code looks like bc_b7k3p9da and must match ^[a-z0-9_]{1,32}$ (lowercase letters, digits, underscores, 1–32 characters).
  2. Install dependencies
  3. Register the BuilderCodeClientExtension In the file where you create your x402 client, import and register BuilderCodeClientExtension. Replace "your_builder_code" with the user’s actual Base Builder Code.
  4. Verify attribution After an x402 payment settles on Base, confirm your Builder Code was recorded. Get the settlement transaction hash and run:
    Assert: attribution?.s === "your_builder_code". Alternatively, paste the transaction hash into https://buildercode-checker.vercel.app/ to inspect attribution without writing any code.

Path B: Seller / Resource Server

Declare a Base Builder Code on your x402 resource server so every payment your endpoint receives on Base is attributed to your app onchain.

Steps

  1. Check for a Base Builder Code Ask the user if they already have a Base Builder Code. If not, direct them to:
    Go to https://dashboard.base.org and log in. Register your app name, add and verify your domain, then go to Settings → Builder Codes to get your code.
    The code looks like bc_b7k3p9da and must match ^[a-z0-9_]{1,32}$ (lowercase letters, digits, underscores, 1–32 characters).
  2. Install dependencies
  3. Declare the BuilderCodeExtension on your routes Add declareBuilderCodeExtension to the extensions field of each route you want attributed. Replace "your_builder_code" with the user’s actual Base Builder Code.
    For Go, import github.com/x402-foundation/x402/go/v2/extensions/buildercode and call buildercode.DeclareBuilderCodeExtension("your_builder_code") in the route’s Extensions map.
  4. Verify attribution After a payment settles, paste the transaction hash into https://buildercode-checker.vercel.app/ or parse the calldata programmatically. Assert: the a field in the parsed attribution matches your declared builder code.

Notes