subscribe Function
Create recurring USDC subscriptions on Base
Code Editor
Intended for testing purposes only. Never paste code from untrusted sources. Coinbase is not responsible for any loss of funds that you incur. Testnet funds hold no real value.
Quick Tips
- Get testnet USDC at https://faucet.circle.com/ - select "Base Sepolia" as the network
- subscriptionOwner is your application's address that will control the subscription
- recurringCharge is the amount of USDC to charge per period (e.g., "10.50" = $10.50)
- periodInDays sets the billing cycle (default: 30 days)
- overridePeriodInSecondsForTestnet allows faster testing cycles on testnet only
- The user can revoke the subscription at any time through their wallet
Output
Click "Execute Code" to run your code
getSubscriptionStatus Function
Check the status of a subscription
Code Editor
Intended for testing purposes only. Never paste code from untrusted sources. Coinbase is not responsible for any loss of funds that you incur. Testnet funds hold no real value.
Quick Tips
- Use the subscription ID returned from the subscribe function
- remainingChargeInPeriod shows how much can still be charged this period
- Make sure to use the same testnet setting as the original subscription
Output
Click "Execute Code" to run your code