createRequest()

Description

Create an unencrypted request

Parameters

Name
Type
Required?
Description

parameters

Parameters to create a request

options

Options to create a request

Returns

Promise<Request>

Types and Interfaces

ICreateRequestParameters

Name
Type
Required?
Description

requestInfo

Core request contents

signer

Identity of the creator and signer of the request. Must be either the payee or payer.

paymentNetwork

Payment method

topics

string[]

List of hashes, usually one for each of the request stakeholders

contentData

Object

Additional arbitrary request contents

disablePaymentDetection

boolean

Disable payment detection

disableEvents

boolean

Diable event callbacks

ICreateRequestOptions

Name
Type
Requried
Description

skipRefresh

boolean

Disable the request refresh after creation. Warning: the balance will be null.

IRequestInfo

Name
Type
Required?
Description

currency

The currency in which the request is denominated. Not necessarily the currency in which the payment will occur.

expectedAmount

number | string

The requested amount in machine-readable integer units.

payee

Identity of the payee. Required if payer not set

payer

Identity of the payer. Required if payee not set

extensionsData

any[]

Raw extensionsData. Not recommended. Prefer contentData and paymentNetwork instead.

timestamp

number (Unix timestamp)

Timestamp when request is created. User provided, so this is an agreement between payee and payer.

nonce

number

Optional nonce to differentiate identical requests created at the same timestamp.

PaymentNetworkCreateParameters

Name
Type
Required
Description

id

Payment network ID

parameters

Payment network parameters. Contents depend on id

ICurrency

Name
Type
Required?
Description

type

Currency type

value

string

Depends on type.

  • ERC20 contract address '0x123'

  • Fiat symbol 'USD'

  • Native symbol 'ETH'

network

ChainName

The chain on which the currency exists

Types.RequestLogic.CURRENCY

Name
Value

ETH

'ETH'

Native (ETH, XDAI, etc.)

BTC

'BTC'

Bitcoin

ISO4217

'ISO4217'

Fiat (USD, EUR, etc.)

ERC20

'ERC20'

Non-native fungible currency (USDC, REQ, etc.)

ERC777

'ERC777'

Streamable fungible currency (USDCx, REQx, etc.)

Types.Extension.PAYMENT_NETWORK_ID

Name
Value
Description

ANY_DECLARATIVE

'pn-any-declarative'

Payer declares payment sent. Payee declares payment received.

ANY_TO_ERC20_PROXY

'pn-any-to-erc20-proxy'

Swap to ERC20 before sending to payee

ANY_TO_ETH_PROXY

'pn-any-to-eth-proxy'

Swap to native token before sending to payee. Only works on EVM-compatible chains.

ANY_TO_NATIVE_TOKEN

'pn-any-to-native-token'

Swap to native token before sending to payee. Only works on NEAR.

BITCOIN_ADDRESS_BASED

'pn-bitcoin-address-based'

Payee generates a new Bitcoin address. Use block explorer to detect all payments to that address.

ERC20_ADDRESS_BASED

'pn-erc20-address-based'

Payee generates a new Ethereum address. Use block explorer to detect all payments to that address.

ERC20_FEE_PROXY_CONTRACT

'pn-erc20-fee-proxy-contract'

Send ERC20 via smart contract with an optional fee.

ERC20_PROXY_CONTRACT

'pn-erc20-proxy-contract'

Send ERC20 via smart contract

ERC20_TRANSFERABLE_RECEIVABLE

'pn-erc20-transferable-receivable'

Mint a Request as an NFT. The holder receives the payment.

ERC777_STREAM

'pn-erc777-stream'

Superfluid stream

ETH_FEE_PROXY_CONTRACT

'pn-eth-fee-proxy-contract'

Send native token via smart contract with an optional fee.

ETH_INPUT_DATA

'pn-eth-input-data'

Send native token with paymentReference in the call data.

NATIVE_TOKEN

'pn-native-token'

Send native token via smart contract with an optional fee on NEAR.

TESTNET_BITCOIN_ADDRESS_BASED

'pn-testnet-bitcoin-address-based'

Payee generates a new Bitcoin testnet address. Use block explorer to detect all payments to that address.

Escrow payments use the ERC20_FEE_PROXY_CONTRACT payment network.

ICreationParameters

PnAnyDeclarative.ICreationParameters

Name
Type
Required
Description

paymentInfo

any

refundInfo

any

payeeDelegate

Identity that can update the request on behalf of the payee

payerDelegate

Identity that can update the request on behalf of the payer

salt

string

A random number with at least 8 bytes of randomness. It must be unique to each request

PnAddressBased.ICreationParameters

Name
Type
Required
Description

paymentAddress

string

The payment recipient address

refundAddress

string

The refund recipient address

PnReferenceBased.ICreationParameters

Name
Type
Required
Description

salt

string

paymentNetworkName

ChainName

The chain name on which the payment will occur

PnFeeReferenceBased.ICreationParameters

Name
Type
Required
Description

feeAddress

string

The address to which fees will be sent

feeAmount

string

The fee amount in machine-readable integer units

PnAnyToAnyConversion.ICreationParameters

Name
Type
Required
Description

maxRateTimespan

number

The maximum acceptable time span between the payment and the conversion rate timestamp

network

ChainName

The network of the tokens accepted for payments

PnAnyToErc20.ICreationParameters

Name
Type
Required
Description

acceptedTokens

string[]

A list of token addresses accepted for payments and refunds

network

EvmChainName

the network of the tokens accepted for payments

PnAnyToEth.ICreationParameters

Identical to PnAnyToAnyConversion.ICreationParameters

PnStreamReferenceBased.ICreationParameters

Equal to IOriginalRequestCreationParameters OR ISubsequentRequestCreationParameters

IOriginalRequestCreationParameters

Name
Type
Required
Description

expectedFlowRate

string

expectedStartDate

string

ISubsequentRequestCreationParameters

Name
Type
Required
Description

previousRequestId

string

originalRequestId

string

recurrenceNumber

string

Last updated