Creating a request using the Declarative payment network
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.
Basics
Before creating a request, the Request Client must be initialized.
Imports
First we import the 2 packages we will need to create the request:
Identity
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.
Signature Provider
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.
Request Information
In the next section of code we declare the request information.
Request creation with the declarative payment network
To create a request using a declarative payment network, we need to provide the payment network parameters to the request creation parameters. The parameters are paymentInfo and optionally refundInfo This value can be any Javascript object. This object should allow the payer to know how to pay the request. For example, for a European transfer, we could provide the IBAN and the BIC of the receiving bank account
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