Skip to main content
Base Account enables users to pay for gas in ERC20 tokens! Tokens can be accepted for payment by passed in app paymasters in addition to a set of universally supported tokens, such as USDC (this set to be expanded soon). This guide outlines how to set up your own app paymaster which will accept your token as payment.

Choose a Paymaster Service Provider

As a prerequisite, you’ll need to obtain a paymaster service URL from a paymaster service provider. ERC20 paymasters have additional requirements that will be outlined below. We recommend the Coinbase Developer Platform paymaster because it supports Base Account ERC20 token gas payments out of the box. CDP also provides free credits when you sign up. Otherwise if using a different paymaster provider, it must conform to the specification outlined in ERC20 Compatible Paymasters to correctly work with Base Account.

App Setup for Custom Token

Once you have a paymaster that is compatible with ERC20 gas payments on Base Account, you are only responsible for including the approvals to the paymaster for your token. It is recommended to periodically top up the allowance once they hit some threshold.
Top Up Paymaster Allowance
That is it! Base Account will handle the rest as long as it is compatible as outlined below.

ERC20 Compatible Paymasters

Coinbase Developer Platform is compatible out of the box and we will be working with other teams to include support soon! The paymaster must handle the pm_getPaymasterStubData and pm_getPaymasterData JSON-RPC requests specified by ERC-7677 in addition to pm_getAcceptedPaymentTokens. We step through each request and response below.

pm_getPaymasterStubData and pm_getPaymasterData

  1. The paymaster must use the specified ERC20 for payment if specified in the 7677 context field under erc20.
  2. Upon rejection / failure the paymaster should return a data field in the JSONRPC response which could be used to approve the paymaster and includes:
  • acceptedTokens array which is a struct including the token address
  • paymasterAddress field which is the paymaster address which will perform the token transfers.
  1. Upon success the paymaster must return a tokenPayment field in the result. This includes:
  • tokenAddress address of the token used for payment
  • maxFee the maximum fee to show in the UI
  • decimals decimals to use in the UI
  • name name of the token
Base Account will simulate the transaction to ensure success and accurate information.

Request

This is a standard V0.6 Entrypoint request example with the additional context for the specified token to be used.
Request

Response

Successful response:
Success Response
Rejection response:
Rejection Response

pm_getAcceptedPaymentTokens

pm_getAcceptedPaymentTokens returns an array of tokens the paymaster will accept for payment. The request contains the entrypoint and the chain id with optional context.

Request

Request

Response

Response