The invreq_metadata field in BOLT12 is used to provide additional information about the invoice request that can help distinguish between different invoice requests associated with the same offer or flow. This field allows nodes to attach arbitrary metadata to the invoice request, which can serve to identify, classify, or provide context for the request.
Examples of what the data in the invreq_metadata field might look like include:
User ID or Session ID: A unique identifier for a user or session that relates to the request, facilitating tracking or management of multiple requests for the same offer by a single user.
{
“user_id”: “12345”,
“session_id”: “abcde”
}
Contextual Tags: Tags that signify the purpose of the invoice request, such as “subscription”, “one-time purchase”, or “donation”.
{
“tags”: [“subscription”]
}
Timestamp or Expiration Data: A timestamp indicating when the request was created, or a flag indicating if the request is time-sensitive.
{
“created_at”: “2023-10-01T10:00:00Z”,
“expires_at”: “2023-10-02T10:00:00Z”
}
Custom Fields: Any additional fields that a node may want to include for custom processing needs.
{
“custom_field”: “some_value”
}
The invreq_metadata is indeed a useful way for a node to manage and distinguish between different open invoice requests, especially when they might have overlapping details, such as multiple requests for the same offer. Additionally, the uniqueness of invoice requests can also be supported through other features such as unique identifiers in the request itself, depending on the implementation.