---
eip: 1337
label: ERC-1337
title: Subscriptions on the blockchain
status: Stagnant
type: Standards Track
category: ERC
created: 2018-08-01
requires: 20, 165
official: https://eips.ethereum.org/EIPS/eip-1337
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1337.md
canonical: https://eips.huatuo.xyz/eip-1337/
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]
---

# ERC-1337: Subscriptions on the blockchain

> 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.

**TL;DR:** 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.

## What problem does it solve?

Monthly 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.

ERC-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.

## How it works

The subscriber's contract (the spec has a smart-contract wallet in mind) exposes a small interface and supports [ERC-165](/eip-165/) interface detection.

1. **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.
2. **Sign once.** The owner signs that hash and hands the signature and inputs to the merchant.
3. **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`).
4. **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`.

Statuses are `ACTIVE`, `PAUSED`, `CANCELLED` and `EXPIRED`. The gas fields let the executor be reimbursed for submitting the transaction, optionally in a token.

## Sample code

Subscriber side, illustrative (ethers v6). The spec does not fix the exact signature format, so check what your contract verifies:

```ts
import { Contract, Wallet, getBytes, ZeroAddress } from "ethers";

const sub = new Contract(SUBSCRIPTION_CONTRACT, [
  "function getSubscriptionHash(address,uint256,bytes,uint8,uint256,uint256,uint256,address,bytes) view returns (bytes32)",
], provider);

const ERC20_OP = 3; // Enum.Operation.ERC20
const hash = await sub.getSubscriptionHash(
  MERCHANT, 10_000_000n, TOKEN_CALLDATA, ERC20_OP,
  100_000n, 0n, 0n, ZeroAddress, META_BYTES,
);

const signature = await owner.signMessage(getBytes(hash));
// send { inputs, signature } to the merchant, who later calls executeSubscription(...)
```

## Things to know

- **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.
- 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.
- 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.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-1337
