USDC subscription payments. Let’s walk through how you could integrate Otim to support crypto subscriptions.
First, update your frontend to allow users to connect their Otim-delegated account. For users that don’t have an Otim-delegated account, direct them to the Otim onboarding page. For users that already have an Otim-delegated account, direct them to a page that prompts them to visit their Otim dashboard and approve your Instruction request.
Next, we’ll use Otim’s API to request the user to subscribe to Netflix. Under the hood, we’ll be requesting that users execute the TransferERC20 Action on a monthly basis. Let’s break this down:
-
set
Instruction.actionto the address of theTransferERC20Action -
set
Instruction.argumentsto encoded calldata specifying:-
set
Schedule.intervalto one month in seconds -
the token address of
USDC - the address of the Netflix treasury account
-
the amount of
USDCthe user must pay each month
-
set
- get notified on their Otim dashboard
- review the request to make sure they agree to the terms
- sign the request to activate the Instruction
InstructionExecuted(bytes32 indexed instructionId, uint256 executionCount). You simply listen for this event to be emitted from the user’s account with the correct instructionId. As long as it’s emitted on-schedule, you can continue to provide services.