Request Network Docs
WebsiteGithubStatusDiscord
  • Request Network Docs
  • Request Network API
    • Create and Pay Requests
    • Crosschain Payments
    • EasyInvoice: API Demo App
    • API Portal: Manage API Keys and Webhooks
      • Manage API Keys and Webhooks programmatically
    • Full API Reference
  • 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
  • Create a request
  • Update a request
  • Pay a request
  • Retrieve a request / Detect a payment

Was this helpful?

Edit on GitHub
Export as PDF
  1. General

Lifecycle of a Request

PreviousManage API Keys and Webhooks programmaticallyNextRequest Scan

Last updated 1 year ago

Was this helpful?

The typical lifecycle of a request is as follows:

Create a request

  • The payer or payee signs the request which contains the payee, payer, currency, amount, payment details, and arbitrary content data.

  • The request can be optionally encrypted such that only the payee, payer, and approved 3rd parties can view the request contents.

  • The request is persisted in IPFS.

  • The IPFS Content-addressable ID (CID) is stored in a smart contract on Gnosis chain

Requests are created by storing their CIDs on Gnosis, but this doesn't mean payment must occur on Gnosis. Payment can occur on any of the supported chains including 20+ EVM-compatible chains or NEAR.

Update a request

  • The payee can optionally cancel the request or increase/decrease the expected amount.

  • The payer can optionally accept the request, indicating that they intend to pay it.

  • Both payee and payer can add 3rd party stakeholders if the request is encrypted.

Pay a request

  • The payer derives a paymentReference from the request contents.

  • The payer calls a function on the payment network smart contract, passing in the token address, to address, amount, and paymentReference.

  • An event is emitted containing the token address, to address, amount, and paymentReference.

Most requests are "reference-based" meaning that a paymentReference derived from the request contents is logged on-chain via a smart contract that emits an event. Nothing gets written back to IPFS when paying a "reference-based" request.

The exception is when paying a "declarative" request, in which case, data is written back to IPFS. This includes when the payer declares that the payment was sent and the payee declares that the payment was received.

Retrieve a request / Detect a payment

  • The event is indexed by the payments subgraph

  • An app can retrieve the request contents from IPFS and calculate the balance based on events from the payments subgraph.

The request balance is calculated by adding up all the on-chain payment events with the same paymentReference. Partial payments are possible.

All of these steps are facilitated by the Request Network JavaScript SDK such that the developer needs only make a few function calls. See the to learn more.

Quickstart
Typical Lifecycle of a Request