# Helper functions

### getMapping

Returns the mapping data of a specific payment reference.

```solidity
function getMapping(bytes memory _paymentReference) public view returns(PaymentERC20 memory) {
        return paymentMapping[_paymentReference];
    }
```

The [paymentMapping](https://github.com/paytr-protocol/contracts/blob/ddf86598e12e641fcb305a3262ebc44f7d623c26/src/Paytr.sol#L98) keeps track of the payment data in the form of a Struct [PaymentERC20](https://github.com/paytr-protocol/contracts/blob/ddf86598e12e641fcb305a3262ebc44f7d623c26/src/Paytr.sol#L68):

```solidity
struct PaymentERC20 {
        uint256 amount;
        uint256 feeAmount;
        uint256 wrapperSharesReceived;
        uint40 dueDate;
        address payer;
        address payee;
        address feeAddress;
        bool shouldPayoutViaRequestNetwork;
}
```

### **Interact with the** getMapping functio&#x6E;**:**

{% tabs %}
{% tab title="ethers.js" %}

```javascript
const paytrContract = new ethers.Contract(paytrContractAddress, PaytrABI, signer);

await paytrContract.getMapping(_paymentReference); //pass in bytes

//example
await paytrContract.getMapping("0x494e56332d32343034");
)
```

{% endtab %}

{% tab title="solidity" %}

<pre class="language-solidity"><code class="lang-solidity">interface IPaytr{
function getMapping(bytes memory _paymentReference) external view returns(PaymentERC20 memory) {
}

<strong>IPaytr(deployedPaytrAddress).getMapping(_paymentReference);
</strong>
//example
bytes paymentReference1 = "0x494e56332d32343001";

IPaytr(deployedPaytrAddress).getMapping(paymentReference1);
</code></pre>

{% endtab %}
{% endtabs %}


---

# 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://paytr.gitbook.io/product-docs/developers/developer-docs/helper-functions.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.
