The
subscribe function creates recurring USDC subscriptions using spend permissions on the Base network. This enables you to charge users periodically without requiring approval for each transaction. No fees for merchants or users.Parameters
Ethereum address that will be the spender (your application’s address).Pattern:
^0x[0-9a-fA-F]{40}$Check if the payer’s wallet has sufficient USDC balance before creating the subscription. If true, subscription creation will fail if the payer doesn’t have enough balance to cover the recurring charge. Default: true
Returns
Errors
Thesubscribe function throws an error when subscription creation fails. The error object contains a message explaining what went wrong.
Error Handling
Always wrap calls tosubscribe in a try-catch block:
Error Handling