azeth_create_payment_agreement
Create a recurring payment agreement between participants with a fixed interval. Automates periodic transfers like subscriptions or scheduled payments.
Instructions
Set up a recurring payment agreement to another participant. Payments execute on a fixed interval.
Use this when: You need automated recurring payments (subscriptions, data feeds, scheduled transfers) between participants.
Returns: The agreement ID, creation transaction hash, and the effective totalCap (hard on-chain spend ceiling).
Spend cap (totalCap): the on-chain module accrues payments pro-rata — a single execution can pay up to 3 missed intervals — so total payout may exceed amount × maxExecutions. totalCap is a hard on-chain ceiling on total payout. If omitted, it defaults to amount × maxExecutions × 3 (today's accrual worst case, made explicit and enforced) when maxExecutions is set, else amount × 365 (~1 year budget). The response always reports the effective cap.
Note: This creates an on-chain agreement via the PaymentAgreementModule. The payee or anyone can call execute once each interval has elapsed. Requires sufficient token balance for each execution. The payer account is determined by the AZETH_PRIVATE_KEY environment variable.
Example: { "payee": "Alice", "token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "amount": "1.00", "intervalSeconds": 86400 } Example with caps: { "payee": "Alice", "token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e", "amount": "0.50", "intervalSeconds": 3600, "maxExecutions": 3, "totalCap": "1.50" }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | Target chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet"). | |
| payee | Yes | Recipient: Ethereum address, participant name, "me", or "#N" (account index). | |
| token | Yes | Payment token address. Use an ERC-20 contract address (e.g., USDC) or 0x0000000000000000000000000000000000000000 for native ETH. | |
| amount | Yes | Payment amount per interval in human-readable units (e.g., "10.00" for 10 USDC). | |
| endTime | No | Unix timestamp in SECONDS (not ms) after which the agreement expires. Must be at least now + intervalSeconds (the chain rejects agreements that expire before their first execution) and within 100 years. Omit for no time limit. | |
| decimals | No | Token decimals. Defaults to 6 (USDC). Use 18 for WETH or native ETH. | |
| totalCap | No | Maximum total payout across all executions, in human-readable token units (e.g., "1.50"). Hard on-chain cap. Defaults to amount × maxExecutions × 3 when maxExecutions is set (3 = on-chain accrual worst case), else amount × 365. | |
| maxExecutions | No | Maximum number of payments. 0 or omit for unlimited. | |
| intervalSeconds | Yes | Time between payments in seconds (minimum 60). E.g., 86400 for daily, 604800 for weekly. |