This is an example of creating a request using the Declarative payment network The request will be stored in memory and cleared as soon as the script is finished running.
Before creating a request, the Request Client must be initialized.
First we import the 2 packages we will need to create the request:
To create a request we need to declare the identities of the parties involved. Identities are the unique identifier of a request user. They are generally different from payment addresses but can be the same. They identify an entity like a person or business.
The Ethereum private key signature provider allows a user to pass in their private Ethereum key to sign a request. The signer is either the payee or the payer. The signature is proof of who created the request and of its integrity (that no data changed after it was signed). This process is similar to the signature of an Ethereum transaction.
In the next section of code we declare the request information.
Request creation with the declarative payment network
Declaring sent and received payments and checking balance
The Declarative payment network doesn't provide payment detection method to determine the balance of the request The balance of the request is defined by the declared payments by the payee and the declared refunds by the payer