# Checksum Validation

***

To ensure a secured request to Bayarcash API, you need to generate a checksum value using your API secret key. This checksum must be included in your request to validate its integrity and authenticity.

You can generate your API secret key from Bayarcash portal at profile page.

* Ensure the API secret key is securely stored and not exposed in your client-side code.
* Always verify the checksum in the callback data to ensure data integrity and authenticity,
* The `ksort` function sorts the payload data by key, which is essential for checksum consistency.
* The `implode` function concatenates the sorted payload values using a delimiter (in this case is |), forming the string for the checksum calculation.
* The `hash_hmac` function generates the checksum using the SHA256 algorithm and your secret key.
* **Trim the payload data** before generating the checksum to ensure no empty spaces are included in the calculation.

{% hint style="success" %}
Note: The checksum value and checksum validation are optional, but it is recommended for enhanced security.
{% endhint %}


---

# 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://api.webimpian.support/bayarcash/checksum/checksum-validation.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.
