This is an example of creating a request using an erc20 payment network
The request will be stored in memory and cleared as soon as the script is finished running.
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.
// Here we declare the payee identity, with the payee identity ethereum address
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.
// The signature info requires the request creator private key.
// For this demo purposes, we hard-coded the private key. Please be careful with how you store and handle your private key since it's a very sensitive piece of data.
Request creation with the proxy contract payment network#
To create a request using erc20 proxy contract payment network, we need to provide the payment network parameters to the request creation parameters.
Proxy contract payment network parameters are the same as the address-based payment network: the payment and eventually the refund address.
console.log(`Request created with erc20 proxy contract payment network: ${request.requestId}`);
})();
Request creation with address-based payment network#
To create a request using the erc20 address-based payment network, we need to provide the payment network parameters to the request creation parameters.