Request Network Docs
WebsiteGithubStatusDiscord
  • Request Network Docs
  • Request Network API
    • Create and Pay Requests
    • Crosschain Payments
    • Crypto-to-fiat Payments
    • Batch Payments
    • EasyInvoice: API Demo App
    • API Portal: Manage API Keys and Webhooks
    • Full API Reference
    • Migrate to V2
  • General
    • Lifecycle of a Request
    • Request Scan
    • Supported Chains
      • Smart Contract Addresses
    • Request Network Token List
  • Advanced
    • Request Network SDK
      • Get Started
        • Quickstart - Browser
        • Quickstart - Node.js
        • Installation
        • SDK Injector
        • Request Node Gateways
      • SDK Demo Apps
        • Request Invoicing
          • Pay from Safe Multisig
        • Request Checkout
        • Components
          • Create Invoice Form
          • Invoice Dashboard
          • Payment Widget
          • Add Stakeholder
      • SDK Guides
        • Request Client
          • Configure the Request Client
          • Updating a Request
          • Payment Reference
          • Compute a Request ID without creating the request
          • Use your own signature mechanism
          • Support a new currency
          • In-Memory Requests
        • Encryption and Decryption
          • Encrypt with a wallet signature using Lit Protocol
          • Encrypt with an Ethereum private key
          • Share an encrypted request
        • Payment
          • Detect a payment
          • Native Payment
          • Conversion Payment
          • Declarative Payment
          • Configuring Payment Fees
          • Single Request Forwarder
          • Batch Payment
          • Swap-to-Pay Payment
          • Swap-to-Conversion Payment
          • Transferable Receivable Payment
          • Meta Payments
          • Escrow Payment
          • Streaming Payment
          • Pay through a proxy-contract with a multisig
          • Hinkal Private Payments
        • Mobile using Expo
      • SDK Reference
        • request-client.js
          • RequestNetwork
            • createRequest()
            • computeRequestId()
            • fromRequestId()
            • fromIdentity()
            • fromTopic()
          • Request
            • waitForConfirmation()
            • getData()
            • refresh()
            • cancel()
            • accept()
            • increaseExpectedAmountRequest()
            • reduceExpectedAmountRequest()
          • IIdentity
          • IRequestDataWithEvents
          • PaymentReferenceCalculator
        • payment-processor
          • payRequest()
        • web3-signature
          • Web3SignatureProvider
        • epk-signature
          • EthereumPrivateKeySignatureProvider
        • epk-decryption
          • EthereumPrivateKeyDecryptionProvider
    • Protocol Overview
      • SDK and Request Node Overview
      • Payment Networks
      • Private Requests using Encryption
      • Smart Contracts Overview
    • Internal SDK Architecture
      • Request Logic
      • Advanced Logic
      • Transaction
      • Data-access
      • Storage
      • Data flow
      • Request IPFS network
  • FAQ
  • Glossary
  • Contributing
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Request Network API

Batch Payments

Process multiple payment requests or payouts efficiently in a single blockchain transaction

PreviousCrypto-to-fiat PaymentsNextEasyInvoice: API Demo App

Last updated 1 day ago

Was this helpful?

Talk to an expert

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

Overview

Batch payments enable you to process multiple payment requests efficiently in a single blockchain transaction, reducing gas costs and simplifying multi-recipient workflows.

Two Types of Batch Payments:

Batch Pay Invoices

Process previously created requests using their request IDs and receive payment calldata that can be executed on-chain to pay multiple requests simultaneously.

Batch Payouts

Submit new payment requests that are immediately processed, creating requests and returning payment calldata in a single API call for instant multi-recipient payments.

Key Benefits

  • Gas Efficiency: Significantly reduce transaction costs by batching multiple payments

  • Simplified UX: Process up to 200 payments in a single transaction

  • Mixed Payment Types: Support ERC20, native tokens, and conversion payments in the same batch

  • Atomic Execution: All payments succeed or fail together, ensuring consistency

Batch Processing Limits

The theoretical limit for batch payments is 100-200 payments per transaction, depending on:

  • Payment complexity (ERC20 vs native tokens vs conversions)

  • Available block gas limit on the target network

  • Smart contract computational requirements

For optimal performance, we recommend starting with smaller batches (10-50 payments) and scaling based on your network conditions.

Batch Payment Workflow

Endpoints

Implementation Examples

The following examples demonstrate how to implement batch payment calldata execution in your application. Note: The API returns unsigned transaction calldata - your application must handle sending these transactions to the blockchain.

Batch Pay Invoices Example

import { ethers } from 'ethers';

// Get unsigned calldata to pay existing requests by their IDs
const batchPayResponse = await fetch('https://api.request.network/v2/payouts/batch', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'your-api-key',
    'x-platform-id': 'your-platform-id'
  },
  body: JSON.stringify({
    requestIds: [
      "01e273ecc29d4b526df3a0f1f05ffc59372af8752c2b678096e49ac270416a7cdb",
      "02f384fdd39e5c627e04b1f2e6fd60593783b8863c3c789197f5bd381527b8ecd"
    ],
    payer: "0x2e2E5C79F571ef1658d4C2d3684a1FE97DD30570"
  })
});

const { batchPaymentTransaction, ERC20ApprovalTransactions } = await batchPayResponse.json();

// Your app must implement sending these transactions to the blockchain
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();

// 1. Handle ERC20 approvals if needed
for (const approval of ERC20ApprovalTransactions) {
  const tx = await signer.sendTransaction(approval);
  await tx.wait();
}

// 2. Send the batch payment transaction
const batchTx = await signer.sendTransaction(batchPaymentTransaction);
await batchTx.wait();

Batch Payouts Example

// Create new requests and process them immediately
const batchPayResponse = await fetch('https://api.request.network/v2/payouts/batch', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'your-api-key',
    'x-platform-id': 'your-platform-id'
  },
  body: JSON.stringify({
    requests: [
      {
        payee: "0x6923831ACf5c327260D7ac7C9DfF5b1c3cB3C7D7",
        amount: "10",
        invoiceCurrency: "USD",
        paymentCurrency: "USDC-sepolia"
      },
      {
        payee: "0xb07D2398d2004378cad234DA0EF14f1c94A530e4",
        amount: "25.50",
        invoiceCurrency: "EUR", 
        paymentCurrency: "DAI-sepolia"
      }
    ],
    payer: "0x2e2E5C79F571ef1658d4C2d3684a1FE97DD30570"
  })
});

const { batchPaymentTransaction, ERC20ApprovalTransactions } = await batchPayResponse.json();

// Your app must implement the blockchain transaction execution
// (same pattern as Batch Pay Invoices example above)

Supported Payment Types

Batch payments support mixing different payment types in a single transaction:

  • ERC20 Token Payments: Standard token transfers

  • Native Token Payments: ETH, MATIC, etc.

Key Implementation Notes

Your Responsibility

  • API Call: Your application calls the Request Network API to get transaction data

  • Blockchain Execution: Your application executes the returned transaction data on the blockchain

  • Error Handling: Your application handles transaction failures and retries

Best Practices

  1. Validate Addresses: Always validate recipient addresses before submitting batch payments

  2. Test on Testnets: Start with small batches on test networks before production deployment

  3. Handle Failures Gracefully: Implement proper error handling for transaction failures

  4. Gas Estimation: Consider gas costs when determining optimal batch sizes

  5. User Experience: Provide clear progress indicators for multi-step approval processes

Error Handling

Common error scenarios and their solutions:

  • Network Mismatch: Ensure all requests use the same blockchain network

  • Insufficient Funds: Verify payer has sufficient balance for all payments plus gas

  • Invalid Addresses: Validate all payee addresses before batch submission

  • Gas Limit Exceeded: Reduce batch size if hitting network gas limits

Demo Application

See the batch payment feature in action in our EasyInvoice demo application:

EasyInvoice Batch Pay Invoices

EasyInvoice: Batch Payouts

Single Network Limitation: All requests in a batch must be on the same blockchain network. Need multi-network batch payments? to discuss this feature.

: Requests denominated in one currency but paid in another (e.g., USD invoices paid with USDC)

For detailed information on all available endpoints and their parameters, please refer to the full .

For more implementation details, explore the .

book a call
Book a call
Conversion Payments
Request Network API Reference
EasyInvoice source code
  • Overview
  • Batch Pay Invoices
  • Batch Payouts
  • Key Benefits
  • Batch Processing Limits
  • Batch Payment Workflow
  • Endpoints
  • POSTPay multiple requests in one transaction
  • Implementation Examples
  • Supported Payment Types
  • Key Implementation Notes
  • Your Responsibility
  • Best Practices
  • Error Handling
  • Demo Application
  • EasyInvoice Batch Pay Invoices
  • EasyInvoice: Batch Payouts

Pay multiple requests in one transaction

post

Pays multiple payment requests in one transaction by either creating new requests or using existing request IDs. All requests must be on the same network. Supports mixed ERC20, Native, and conversion requests.

Header parameters
x-api-keystringRequired

API key for authentication

Body
requestIdsstring[]Optional

The request IDs of the existing requests to be paid. Requests must be on the same network. Either requests or requestIds must be provided, but not both.

payerstringOptional

The wallet address of the payer, user to check if approval is needed or not.

Responses
200
Batch payment calldata retrieved successfully
application/json
400
Requests must be on the same network
application/json
401
Unauthorized
429
Too Many Requests
post
POST /v2/payouts/batch HTTP/1.1
Host: api.request.network
x-api-key: text
Content-Type: application/json
Accept: */*
Content-Length: 747

{
  "requests": [
    {
      "payee": "0x6923831ACf5c327260D7ac7C9DfF5b1c3cB3C7D7",
      "amount": "2",
      "invoiceCurrency": "FAU-sepolia",
      "paymentCurrency": "FAU-sepolia"
    },
    {
      "payee": "0x6923831ACf5c327260D7ac7C9DfF5b1c3cB3C7D7",
      "amount": "2",
      "invoiceCurrency": "fUSDC-sepolia",
      "paymentCurrency": "fUSDC-sepolia"
    },
    {
      "payee": "0xb07D2398d2004378cad234DA0EF14f1c94A530e4",
      "amount": "10",
      "invoiceCurrency": "USD",
      "paymentCurrency": "FAU-sepolia"
    },
    {
      "payee": "0x6923831ACf5c327260D7ac7C9DfF5b1c3cB3C7D7",
      "amount": "0.00001",
      "invoiceCurrency": "ETH-sepolia-sepolia",
      "paymentCurrency": "ETH-sepolia-sepolia"
    },
    {
      "payee": "0x6923831ACf5c327260D7ac7C9DfF5b1c3cB3C7D7",
      "amount": "10",
      "invoiceCurrency": "USD",
      "paymentCurrency": "ETH-sepolia-sepolia"
    }
  ],
  "payer": "0x2e2E5C79F571ef1658d4C2d3684a1FE97DD30570"
}
{
  "ERC20ApprovalTransactions": [
    {
      "data": "0x095ea7b3...",
      "to": "0x370DE27fdb7D1Ff1e1BaA7D11c5820a324Cf623C",
      "value": 0
    }
  ],
  "batchPaymentTransaction": {
    "data": "0x92cddb91...",
    "to": "0x67818703c92580c0e106e401F253E8A410A66f8B",
    "value": {
      "type": "BigNumber",
      "hex": "0x0d83b3d1afc58b"
    }
  }
}