Recurring payments

Create subscriptions that would automatically be paid through out a timeframe.

Talk to an expert

Discover how Request Network API can enhance your app's features - book a call with us.

Overview

The Recurring Payments feature allows you to create and manage subscription-like payments on the blockchain. The API handles the scheduling and triggering of these payments, providing a reliable way to automate regular transfers.

Core functionality

  • Create Recurring Schedules: Define a payment schedule with a start date, frequency (daily, weekly, monthly, yearly), and total number of payments. The system will generate a payment permit that encapsulates all the payment details.

  • Payer Authorization: To authorize the payment series, the payer signs the payment permit with an EIP-712 signature. This single authorization allows the system to trigger all subsequent payments in the schedule without further interaction from the payer. For the first payment, the payer may also need to approve a token allowance for the recurring payment contract if they haven't already.

  • Automated Payments: Once the payer has authorized the schedule, the Request Network API backend systems automatically trigger the payments at the specified intervals. You can rely on the API to handle the entire lifecycle of the recurring payments.

  • Status Tracking and Webhooks: You can monitor the status of each recurring payment, including processed payments, failures, and completion status (e.g., active, paused, completed). Webhook notifications will be sent for key events like payment.confirmed and payment.failed, allowing your application to react in real time.

  • Flexible Management: The API provides the ability to manage the lifecycle of a recurring payment. You can cancel a recurring payment schedule to stop future payments. If a payment fails (e.g., due to insufficient funds), the schedule will be paused, and you can unpause it once the issue is resolved. Unpausing a recurring payment once issues are resolved would allow the subscription to catch up on any missed payments.

Security & Trust

Our recurring payments feature is built on a non-custodial smart contract that enforces several security measures to protect payers' funds and ensure predictable behavior. The core principle is that all payment parameters are defined upfront and cryptographically signed by the payer, preventing any unauthorized changes.

Here are some key security features provided by the smart contract:

  • Signature-Protected Payments: Payments cannot be triggered without a valid EIP-712 signature from the payer. The smart contract verifies the signature for every payment attempt.

  • Immutable Recipient: The recipient's address is part of the signed data. Funds can only be sent to this specified address, which cannot be altered after the schedule is authorized.

  • Fixed Payment Amount: The amount for each payment is fixed in the signed permit. The smart contract will only transfer this exact amount, preventing any over- or under-payments.

  • Strict Payment Timing: Payments cannot be triggered before their scheduled time. The contract calculates the due date for each payment and will reject any attempts to trigger it prematurely.

  • No-Repeat Payments: The contract tracks payments, making it impossible to process the same payment more than once.

  • Enforced Payment Limit: The total number of payments is defined in the signed permit. The smart contract enforces this limit and will not allow any extra payments beyond the agreed-upon total.

  • Sequential Payments: Payments must be triggered in a strict, sequential order (e.g., payment #1, then #2, then #3). Any out-of-order attempt will fail, preventing missed or skipped payments from disrupting the schedule.

  • Signature Expiration: Each recurring payment schedule has a deadline. If the signature expires, no further payments can be triggered, providing a hard stop for the agreement.

Recurring payment workflow

The following diagram illustrates the typical flow for creating and managing recurring payments:

Supported Networks

Recurring payments are supported on the following Blockchain networks:

  • Ethereum

  • Polygon

  • Arbitrum

  • Gnosis

  • Base

  • Binance Smart Chain

  • Sepolia

Supported currencies

The recurring payments support all ERC20 currencies available in the supported networks

How it works

1. Create a recurring payment

To enable recurring payments, a schedule must be created with the following endpoint:

Initiate a payment

post

Initiate a payment without having to create a request first. Supports both one-time and recurring payments. For recurring payments, specify the recurrence object with start date, frequency, total executions, and payer address. The system will create a recurring payment schedule and return the necessary transactions for allowance approval and signature submission.

Header parameters
x-api-keystringRequired

API key for authentication

Body
payeestringRequired

The wallet address of the payee

amountstringRequired

The payable amount of the invoice, in human readable format

invoiceCurrencystringRequired

Invoice Currency ID, from the Request Network Token List e.g: USD

paymentCurrencystringRequired

Payment currency ID, from the Request Network Token List e.g: ETH-sepolia-sepolia

feePercentagestringOptional

Fee percentage to apply at payment time (e.g., '2.5' for 2.5%)

feeAddressstringOptional

Address to receive the fee

Responses
201
Request created and payment initiated successfully
application/json
Responseany
post
POST /v2/payouts HTTP/1.1
Host: api.request.network
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 213

{
  "payee": "0x6923831ACf5c327260D7ac7C9DfF5b1c3cB3C7D7",
  "amount": "10",
  "invoiceCurrency": "USD",
  "paymentCurrency": "ETH-sepolia-sepolia",
  "feePercentage": "0.02",
  "feeAddress": "0x6923831ACf5c327260D7ac7C9DfF5b1c3cB3C7D7"
}
{
  "requestId": "01e273ecc29d4b526df3a0f1f05ffc59372af8752c2b678096e49ac270416a7cdb",
  "paymentReference": "0xb3581f0b0f74cc61",
  "transactions": [
    {
      "data": "0xb868980b...00",
      "to": "0x11BF2fDA23bF0A98365e1A4e04A87C9339e8687",
      "value": {
        "type": "BigNumber",
        "hex": "0x038d7ea4c68000"
      }
    }
  ],
  "metadata": {
    "stepsRequired": 1,
    "needsApproval": false,
    "approvalTransactionIndex": null,
    "hasEnoughBalance": true,
    "hasEnoughGas": true
  }
}

The response includes a payment permit payload (EIP-712 typed data) for signature, and, if required, transactions for token allowance approval.

2. Payer authorization

The payer must:

  • Approve the recurring payment contract to spend the required amount of tokens (if not already approved)

  • Sign the payment permit using EIP-712 compatible wallet

Example

import { Wallet, providers } from "ethers";

const privateKey = 'WALLET_PRIVATE_KEY'
const provider = const provider = new providers.JsonRpcProvider(
	"RPC_URL",
);

const wallet = new Wallet(privateKey, provider);

const recurringPaymentPermit = ... // from API response
const signature = await wallet._signTypedData(
  recurringPaymentPermit.domain,
  recurringPaymentPermit.types,
  recurringPaymentPermit.values
);

3. Recurring payment activation

To activate the recurring payment, the resulting signature must be submitted to the following endpoint:

Submit a recurring payment signature

post

Submit a signature for a recurring payment permit to activate the recurring payment schedule. This endpoint is called after creating a recurring payment and obtaining the permit data. The signature authorizes the recurring payment contract to execute payments on behalf of the payer according to the schedule. Once activated, payments will be executed automatically at the specified intervals.

Path parameters
idstringRequired

The ID of the recurring payment

Example: 01JXYJKCAHGFTDR15F2D072ESG
Header parameters
x-api-keystringRequired

API key for authentication

Body
permitSignaturestringRequired

The signature of the recurring payment permit.

Responses
201
Recurring payment signature submitted successfully
application/json
post
POST /v2/payouts/recurring/{id} HTTP/1.1
Host: api.request.network
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 122

{
  "permitSignature": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1b"
}
{
  "message": "Recurring payment activated successfully",
  "id": "01JXYJKCAHGFTDR15F2D072ESG",
  "status": "active"
}

A successful response confirms activation. The schedule is now active and payments will be executed automatically.

4. Status monitoring

The status, processed payments, next payment date, and other details can be retrieved at any time.

Get the status of a recurring payment

get

Retrieve the current status and execution details of a recurring payment. Returns information about executed payments, remaining executions, next payment date, and overall status. This endpoint is useful for monitoring recurring payment progress and checking if payments are being executed as expected.

Path parameters
idstringRequired

The ID of the recurring payment

Example: 01JXYJKCAHGFTDR15F2D072ESG
Header parameters
x-api-keystringRequired

API key for authentication

Responses
200
Recurring payment status retrieved successfully
application/json
get
GET /v2/payouts/recurring/{id} HTTP/1.1
Host: api.request.network
x-api-key: text
Accept: */*
{
  "processedPayments": 3,
  "totalPayments": 30,
  "lastPaymentDate": "2025-01-04T10:00:00.000Z",
  "nextPaymentDate": "2025-01-05T10:00:00.000Z",
  "status": "active",
  "requests": [
    {
      "paymentReference": "0xb3581f0b0f74cc61",
      "requestId": "01e273ecc29d4b526df3a0f1f05ffc59372af8752c2b678096e49ac270416a7cdb"
    }
  ],
  "payments": [
    {
      "id": "01JXYJKCAHGFTDR15F2D072ESG",
      "amount": "10",
      "timestamp": "2025-01-04T10:00:00.000Z",
      "txHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
    }
  ]
}

5. Recurring payment management

Recurring payments can be cancelled or unpaused.

  • Cancel: stops all future payments

  • Unpause: resume the recurring payment after it fails three times (due to insufficient balance or allowance)

Update a recurring payment

patch

Update a recurring payment by cancelling it or unpausing it. When cancelling, optionally returns a transaction to decrease allowance. When unpausing, resumes execution of a paused recurring payment.

Path parameters
idstringRequired

The ID of the recurring payment

Example: 01JXYJKCAHGFTDR15F2D072ESG
Header parameters
x-api-keystringRequired

API key for authentication

Body
actionstring · enumRequired

The action to perform on the recurring payment

Possible values:
Responses
200
Recurring payment updated successfully
application/json
patch
PATCH /v2/payouts/recurring/{id} HTTP/1.1
Host: api.request.network
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 19

{
  "action": "cancel"
}
{
  "id": "01JXYJKCAHGFTDR15F2D072ESG",
  "status": "cancelled",
  "transactions": [
    {
      "to": "0xA0b86a33E6441b8c4C8C8C8C8C8C8C8C8C8C8C8",
      "data": "0x095ea7b30000000000000000000000000363dD3ccD4f187d7033c57354CA81f998451D590000000000000000000000000000000000000000000000000000000000000000",
      "value": "0x0"
    }
  ],
  "metadata": {
    "remainingPayments": 5,
    "remainingAmount": "5000000000000000000",
    "processedPayments": 3,
    "totalPayments": 8
  }
}

Last updated

Was this helpful?