Links

Quickstart

This page will introduce the four primary operations provided by Request Network’s browser-side JavaScript library, request-client.js.
You will learn:
  • How to retrieve a user’s requests
  • How to create a request
  • How to pay a request
  • How to detect a payment

Retrieve a user's requests

First, construct a RequestNetwork object and connect it to the Goerli Request Node Gateway:
import { RequestNetwork, Types } from "@requestnetwork/request-client.js";
const requestClient = new RequestNetwork({
nodeConnectionConfig: { baseURL: "https://goerli.gateway.request.network/" }
})
Then, call fromIdentity() to get an array of Request objects. This function retrieves the payment requests stored in IPFS and queries on-chain events to determine the balance paid so far.
const address = "0x7eB023BFbAeE228de6DC5B92D0BeEB1eDb1Fd567";
const requests = await requestClient.fromIdentity({
type: Types.Identity.TYPE.ETHEREUM_ADDRESS,
value: address
})
Finally, call getData() on each Request.
const requestDatas = requests.map((request) => request.getData())
Altogether it looks like this:
CodeSandBox showing how to retrieve a user's requests and display them in a table.
CodeSandBox Preview
The embedded CodeSandBox above is not broken despite the error message. It creates a development environment entirely in the browser and takes a long time to transpile the first time it is viewed. Conservatively, it may take 30 minutes. Here's a preview of what it will look like:

Next Steps

Other operation quickstarts coming soon! In the meantime check out the following guides: