# Payment Reference

In the Reference-based Payment Networks, Payments are linked to Requests via a `paymentReference` which is derived from the `requestId` and payment recipient address.

This `paymentReference` consists of the last 8 bytes of a salted hash of the `requestId` and payment recipient address, concatenated :

```typescript
last8Bytes(hash(lowercase(requestId + salt + address)))
```

* `requestId` is the id of the request
* `salt` is a random number with at least 8 bytes of randomness. It must be unique to each request
* `address` is the payment address for payments, the refund address for refunds
* `lowercase()` transforms all characters to lowercase
* `hash()` is a keccak256 hash function
* `last8Bytes()` take the last 8 bytes

Use the [paymentreferencecalculator](https://docs.request.network/advanced/request-network-sdk/sdk-api-reference/request-client.js/paymentreferencecalculator "mention") to calculate the payment reference.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.request.network/advanced/request-network-sdk/sdk-guides/request-client/payment-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
