{"eip":1337,"title":"Subscriptions on the blockchain","description":"Monthly subscriptions are a key monetization channel for legacy web, and arguably they are the most healthy monetization channel for businesses on the legacy web (especially when compared to ad/surveillance) based models.","authors":["Kevin Owocki \u003ckevin@gitcoin.co\u003e","Andrew Redden \u003candrew@blockcrushr.com\u003e","Scott Burke \u003cscott@blockcrushr.com\u003e","Kevin Seagraves \u003ck.s.seagraves@gmail.com\u003e","Luka Kacil \u003cluka.kacil@gmail.com\u003e","Štefan Šimec \u003cstefan.simec@gmail.com\u003e","Piotr Kosiński (@kosecki123)","ankit raj \u003ctradeninja7@gmail.com\u003e","John Griffin \u003cjohn@atchai.com\u003e","Nathan Creswell \u003cnathantr@gmail.com\u003e"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2018-08-01","requires":[20,165],"discussionsTo":"https://ethereum-magicians.org/t/eip-1337-subscriptions-on-the-blockchain/4422","repo":"ERCs","label":"ERC-1337","officialUrl":"https://eips.ethereum.org/EIPS/eip-1337","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1337.md","url":"https://eips.huatuo.xyz/eip-1337/","tldr":{"en":"A proposed standard for recurring crypto payments in which users sign a subscription once and the merchant later submits that signature to pull each period's payment.","ja":"定期的な暗号資産の支払いのための標準案。ユーザーが一度サブスクリプションに署名し、販売者が後でその署名を提出して、各期間の支払いを引き出す。","ko":"정기 암호화폐 결제를 위한 표준 제안. 사용자가 구독에 한 번 서명하면, 판매자가 나중에 그 서명을 제출해 각 기간의 결제금을 가져간다.","zh":"一项关于定期加密货币支付的标准提案：用户只需签署一次订阅，商家之后提交该签名来提取每个周期的付款。"},"tags":["subscriptions","payments","meta-transactions","erc20"],"explainers":{"en":{"lang":"en","tldr":"A proposed standard for recurring crypto payments in which users sign a subscription once and the merchant later submits that signature to pull each period's payment.","tags":["subscriptions","payments","meta-transactions","erc20"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1337/","markdown":"## What problem does it solve?\n\nMonthly subscriptions are a core business model on the web, but on Ethereum every payment needs the payer to sign a fresh transaction. Expecting a user to come back each month and send tokens by hand does not work for a SaaS-style product.\n\nERC-1337 proposes a standard way to do \"pull\" payments: the user signs the terms of a subscription once, the merchant keeps that signature off-chain, and the merchant (or a relayer) submits it each period to collect payment. The authors compare it to a card-on-file token held by a payment processor.\n\n## How it works\n\nThe subscriber's contract (the spec has a smart-contract wallet in mind) exposes a small interface and supports [ERC-165](/eip-165/) interface detection.\n\n1. **Build the terms.** `getSubscriptionHash(recipient, value, data, operation, txGas, dataGas, gasPrice, gasToken, meta)` returns a hash of all the parameters together with the contract address. `meta` packs extra fields such as the period (`DAY`, `WEEK`, `MONTH`) and an optional expiration.\n2. **Sign once.** The owner signs that hash and hands the signature and inputs to the merchant.\n3. **Collect each period.** The merchant calls `executeSubscription(...)` with the same inputs plus the signature. The contract checks the signature and that the period has elapsed, then performs the payment (an ETH transfer, an [ERC-20](/eip-20/) transfer, a call, etc., chosen by `operation`).\n4. **Manage it.** `getSubscriptionStatus` returns the status and the next withdrawal time. The owner can sign a status change (pause, cancel) obtained from `getModifyStatusHash` and submit it via `modifyStatus`.\n\nStatuses are `ACTIVE`, `PAUSED`, `CANCELLED` and `EXPIRED`. The gas fields let the executor be reimbursed for submitting the transaction, optionally in a token.\n\n## Sample code\n\nSubscriber side, illustrative (ethers v6). The spec does not fix the exact signature format, so check what your contract verifies:\n\n```ts\nimport { Contract, Wallet, getBytes, ZeroAddress } from \"ethers\";\n\nconst sub = new Contract(SUBSCRIPTION_CONTRACT, [\n  \"function getSubscriptionHash(address,uint256,bytes,uint8,uint256,uint256,uint256,address,bytes) view returns (bytes32)\",\n], provider);\n\nconst ERC20_OP = 3; // Enum.Operation.ERC20\nconst hash = await sub.getSubscriptionHash(\n  MERCHANT, 10_000_000n, TOKEN_CALLDATA, ERC20_OP,\n  100_000n, 0n, 0n, ZeroAddress, META_BYTES,\n);\n\nconst signature = await owner.signMessage(getBytes(hash));\n// send { inputs, signature } to the merchant, who later calls executeSubscription(...)\n```\n\n## Things to know\n\n- **Status: Stagnant.** Sections such as Test Cases and Implementation are still marked TBD, and some function signatures in the spec are incomplete (for example a missing comma), so it is not implementable verbatim.\n- As the spec itself notes, a signed subscription remains executable unless its hash is recorded on-chain and its status changed. Cancelling means submitting a signed status change, not just stopping off-chain.\n- Today, recurring and delegated payments are more often built with smart accounts and session keys or with token allowances plus signed approvals such as [ERC-2612](/eip-2612/), rather than with this interface.\n"},"ja":{"lang":"ja","tldr":"定期的な暗号資産の支払いのための標準案。ユーザーが一度サブスクリプションに署名し、販売者が後でその署名を提出して、各期間の支払いを引き出す。","tags":["subscriptions","payments","meta-transactions","erc20"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1337/","markdown":"## 何を解決するのか\n\n月額課金のサブスクリプションはウェブの中核的なビジネスモデルですが、Ethereum では、支払いのたびに支払者が新しいトランザクションに署名する必要があります。SaaS 型の製品で、ユーザーが毎月戻ってきて手動でトークンを送ってくれることを期待しても、うまくいきません。\n\nERC-1337 は、「プル型」の支払いを行う標準的な方法を提案します。ユーザーがサブスクリプションの条件に一度署名し、販売者がその署名をオフチェーンで保管し、販売者（またはリレイヤー）が期間ごとにそれを提出して支払いを回収します。著者らは、これを決済代行業者が保持する、カード情報を預かるトークンになぞらえています。\n\n## 仕組み\n\n加入者のコントラクト（仕様はスマートコントラクトウォレットを想定しています）は、小さなインターフェースを公開し、[ERC-165](/eip-165/) のインターフェース検出をサポートします。\n\n1. **条件を組み立てる。** `getSubscriptionHash(recipient, value, data, operation, txGas, dataGas, gasPrice, gasToken, meta)` は、すべてのパラメータとコントラクトアドレスをまとめたハッシュを返します。`meta` には、期間（`DAY`、`WEEK`、`MONTH`）や任意の有効期限といった追加フィールドが詰められています。\n2. **一度だけ署名する。** 所有者がそのハッシュに署名し、署名と入力を販売者に渡します。\n3. **期間ごとに回収する。** 販売者は、同じ入力と署名を付けて `executeSubscription(...)` を呼びます。コントラクトは署名と、期間が経過したことを確認してから、支払い（ETH の送金、[ERC-20](/eip-20/) の送金、呼び出しなど。`operation` で選択）を実行します。\n4. **管理する。** `getSubscriptionStatus` はステータスと次回の引き出し時刻を返します。所有者は、`getModifyStatusHash` から得たステータス変更（一時停止、キャンセル）に署名し、`modifyStatus` で提出できます。\n\nステータスは `ACTIVE`、`PAUSED`、`CANCELLED`、`EXPIRED` です。ガスのフィールドにより、実行者はトランザクションの提出にかかった費用を、必要に応じてトークンで払い戻してもらえます。\n\n## サンプルコード\n\n加入者側の例（ethers v6、説明用）です。仕様は正確な署名形式を定めていないため、ご自身のコントラクトが何を検証するかを確認してください。\n\n```ts\nimport { Contract, Wallet, getBytes, ZeroAddress } from \"ethers\";\n\nconst sub = new Contract(SUBSCRIPTION_CONTRACT, [\n  \"function getSubscriptionHash(address,uint256,bytes,uint8,uint256,uint256,uint256,address,bytes) view returns (bytes32)\",\n], provider);\n\nconst ERC20_OP = 3; // Enum.Operation.ERC20\nconst hash = await sub.getSubscriptionHash(\n  MERCHANT, 10_000_000n, TOKEN_CALLDATA, ERC20_OP,\n  100_000n, 0n, 0n, ZeroAddress, META_BYTES,\n);\n\nconst signature = await owner.signMessage(getBytes(hash));\n// send { inputs, signature } to the merchant, who later calls executeSubscription(...)\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。** Test Cases や Implementation などのセクションは今も TBD とされ、仕様の一部の関数シグネチャは不完全（たとえばカンマの欠落）なため、そのままでは実装できません。\n- 仕様自身が述べているとおり、署名済みのサブスクリプションは、そのハッシュがオンチェーンに記録されてステータスが変更されない限り、実行可能なままです。キャンセルとは、署名したステータス変更を提出することであり、単にオフチェーンで止めることではありません。\n- 現在、定期的な支払いや委任された支払いは、このインターフェースよりも、スマートアカウントとセッションキー、またはトークンの allowance と [ERC-2612](/eip-2612/) のような署名付き承認の組み合わせで作られることが多くなっています。\n"},"ko":{"lang":"ko","tldr":"정기 암호화폐 결제를 위한 표준 제안. 사용자가 구독에 한 번 서명하면, 판매자가 나중에 그 서명을 제출해 각 기간의 결제금을 가져간다.","tags":["subscriptions","payments","meta-transactions","erc20"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1337/","markdown":"## 어떤 문제를 해결하나요?\n\n월 구독은 웹의 핵심 비즈니스 모델이지만, 이더리움에서는 결제할 때마다 결제자가 새 트랜잭션에 서명해야 합니다. 사용자가 매달 돌아와 직접 토큰을 보내 주기를 기대하는 방식은 SaaS형 제품에는 맞지 않습니다.\n\nERC-1337은 \"풀(pull)\" 결제를 하는 표준 방식을 제안합니다. 사용자가 구독 조건에 한 번 서명하고, 판매자가 그 서명을 오프체인에 보관하다가, 기간마다 판매자(또는 릴레이어)가 이를 제출해 결제금을 수령합니다. 저자들은 이를 결제 대행사가 보관하는 카드 정보 토큰(card-on-file token)에 비유합니다.\n\n## 어떻게 동작하나요?\n\n구독자의 컨트랙트(명세는 스마트 컨트랙트 지갑을 염두에 둡니다)는 작은 인터페이스를 노출하며 [ERC-165](/eip-165/) 인터페이스 탐지를 지원합니다.\n\n1. **조건 만들기.** `getSubscriptionHash(recipient, value, data, operation, txGas, dataGas, gasPrice, gasToken, meta)`는 모든 파라미터와 컨트랙트 주소를 묶은 해시를 반환합니다. `meta`에는 기간(`DAY`, `WEEK`, `MONTH`)과 선택적인 만료 시각 같은 추가 필드가 담겨 있습니다.\n2. **한 번 서명하기.** 소유자가 그 해시에 서명하고 서명과 입력을 판매자에게 건넵니다.\n3. **기간마다 수령하기.** 판매자는 같은 입력과 서명을 담아 `executeSubscription(...)`을 호출합니다. 컨트랙트는 서명과 기간 경과 여부를 확인한 뒤 결제(ETH 전송, [ERC-20](/eip-20/) 전송, 호출 등, `operation`으로 선택)를 수행합니다.\n4. **관리하기.** `getSubscriptionStatus`는 상태와 다음 인출 시각을 반환합니다. 소유자는 `getModifyStatusHash`로 얻은 상태 변경(일시 정지, 취소)에 서명하고 `modifyStatus`로 제출할 수 있습니다.\n\n상태는 `ACTIVE`, `PAUSED`, `CANCELLED`, `EXPIRED`입니다. 가스 필드를 통해 실행자는 트랜잭션 제출 비용을, 원하면 토큰으로 보전받을 수 있습니다.\n\n## 샘플 코드\n\n구독자 측 예시이며 설명용입니다(ethers v6). 명세는 정확한 서명 형식을 고정하지 않으므로, 여러분의 컨트랙트가 무엇을 검증하는지 확인하세요.\n\n```ts\nimport { Contract, Wallet, getBytes, ZeroAddress } from \"ethers\";\n\nconst sub = new Contract(SUBSCRIPTION_CONTRACT, [\n  \"function getSubscriptionHash(address,uint256,bytes,uint8,uint256,uint256,uint256,address,bytes) view returns (bytes32)\",\n], provider);\n\nconst ERC20_OP = 3; // Enum.Operation.ERC20\nconst hash = await sub.getSubscriptionHash(\n  MERCHANT, 10_000_000n, TOKEN_CALLDATA, ERC20_OP,\n  100_000n, 0n, 0n, ZeroAddress, META_BYTES,\n);\n\nconst signature = await owner.signMessage(getBytes(hash));\n// send { inputs, signature } to the merchant, who later calls executeSubscription(...)\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.** Test Cases와 Implementation 같은 섹션은 여전히 TBD로 표시되어 있고, 명세의 일부 함수 시그니처는 불완전하여(예: 쉼표 누락) 그대로는 구현할 수 없습니다.\n- 명세 자체가 언급하듯, 서명된 구독은 그 해시가 온체인에 기록되고 상태가 변경되지 않는 한 계속 실행될 수 있습니다. 취소란 서명된 상태 변경을 제출하는 것이지, 오프체인에서 그냥 멈추는 것이 아닙니다.\n- 오늘날 정기 결제와 위임 결제는 이 인터페이스보다는 스마트 계정과 세션 키, 또는 토큰 allowance와 [ERC-2612](/eip-2612/) 같은 서명 기반 승인으로 구축하는 경우가 더 많습니다.\n"},"zh":{"lang":"zh","tldr":"一项关于定期加密货币支付的标准提案：用户只需签署一次订阅，商家之后提交该签名来提取每个周期的付款。","tags":["subscriptions","payments","meta-transactions","erc20"],"related":[20,165],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1337/","markdown":"## 它解决什么问题？\n\n按月订阅是网络上的核心商业模式，但在以太坊上，每次付款都需要付款人签署一笔新的交易。指望用户每月回来手动发送代币，对于 SaaS 类产品行不通。\n\nERC-1337 提出了一种实现\"拉取\"支付的标准方式：用户只签署一次订阅条款，商家把该签名保存在链下，每个周期由商家（或中继方）提交它来收款。作者将其比作支付处理商保存的卡片令牌（card-on-file token）。\n\n## 它如何运作\n\n订阅者的合约（规范设想的是智能合约钱包）公开一个小型接口，并支持 [ERC-165](/eip-165/) 接口检测。\n\n1. **构造条款。** `getSubscriptionHash(recipient, value, data, operation, txGas, dataGas, gasPrice, gasToken, meta)` 返回所有参数连同合约地址的哈希。`meta` 打包了额外字段，例如周期（`DAY`、`WEEK`、`MONTH`）和可选的到期时间。\n2. **签署一次。** 所有者对该哈希签名，并把签名和输入交给商家。\n3. **每个周期收款。** 商家用相同的输入加上签名调用 `executeSubscription(...)`。合约检查签名以及周期是否已经过去，然后执行付款（ETH 转账、[ERC-20](/eip-20/) 转账、调用等，由 `operation` 选择）。\n4. **管理订阅。** `getSubscriptionStatus` 返回状态和下一次提取时间。所有者可以对从 `getModifyStatusHash` 获得的状态变更（暂停、取消）签名，并通过 `modifyStatus` 提交。\n\n状态有 `ACTIVE`、`PAUSED`、`CANCELLED` 和 `EXPIRED`。gas 字段使执行者可以就提交交易的花费获得补偿，并可选择以代币支付。\n\n## 示例代码\n\n订阅者一侧，仅作说明（ethers v6）。规范没有固定确切的签名格式，因此请核实你的合约验证的是什么：\n\n```ts\nimport { Contract, Wallet, getBytes, ZeroAddress } from \"ethers\";\n\nconst sub = new Contract(SUBSCRIPTION_CONTRACT, [\n  \"function getSubscriptionHash(address,uint256,bytes,uint8,uint256,uint256,uint256,address,bytes) view returns (bytes32)\",\n], provider);\n\nconst ERC20_OP = 3; // Enum.Operation.ERC20\nconst hash = await sub.getSubscriptionHash(\n  MERCHANT, 10_000_000n, TOKEN_CALLDATA, ERC20_OP,\n  100_000n, 0n, 0n, ZeroAddress, META_BYTES,\n);\n\nconst signature = await owner.signMessage(getBytes(hash));\n// send { inputs, signature } to the merchant, who later calls executeSubscription(...)\n```\n\n## 需要注意\n\n- **状态：Stagnant。** 测试用例（Test Cases）和实现（Implementation）等章节仍标注为 TBD，规范中的一些函数签名也不完整（例如缺少逗号），因此无法照搬实现。\n- 正如规范本身所指出的，除非其哈希被记录到链上并更改了状态，否则已签名的订阅仍然可以执行。取消意味着提交一个已签名的状态变更，而不只是在链下停止。\n- 如今，定期支付和委托支付更多是用智能账户加会话密钥，或用代币 allowance 加 [ERC-2612](/eip-2612/) 之类的签名授权来构建，而不是使用这个接口。\n"}}}
