# Hash Generation

🔑 **Private key** is a value accessible from your Paywall panel. This value is supported to be different for all possible scenarios. For example, the keys for 3D payments and APM payments are different. You should generate a separate key for each scenario and securely store these keys on your side.

The relevant keys will be included within the string value set used to generate the hash.

**Hash Examples:**

{% tabs %}
{% tab title="3D Hash" %}
You can obtain the hashKey information from the panel

<pre class="language-csharp"><code class="lang-csharp"><strong>var hashFormat = $"{hashKey}###{paymentId}###{merchantUniqueCode}###{amount}###{installment}"
</strong>
// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
</code></pre>

{% endtab %}

{% tab title="Payment" %}
You can obtain the hashKey information from the panel

```csharp
var hashFormat = $"{hashKey}###{paymentId}###{merchantUniqueCode}###{amount}###{installment}"

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% endtab %}

{% tab title="Bulk Payment" %}
You can obtain the hashKey information from the panel

```csharp
var hashFormat = $"{hashKey}###{bulkPaymentId}###{merchantUniqueCode}"

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% endtab %}

{% tab title="Split Payment" %}
You can obtain the hashKey information from the panel

```csharp
var hashFormat = $"{hashKey}###{splitPaymentId}###{merchantUniqueCode}"

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% endtab %}

{% tab title="PayOut" %}
You can obtain the hashKey information from the panel

```csharp
var hashFormat = $"{hashKey}###{payoutId}###{merchantGroupCode}###{merchantUniqueCode}###{amount}"

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Common Payment Page" %}
You can obtain the hashKey information from the panel

```csharp
var hashFormat = $"{hashKey}###{checkoutId}###{paymentId}###{uniqueCode}###{amount}"

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% endtab %}

{% tab title="Link/Qr" %}
You can obtain the hashKey information from the panel

```csharp
var hashFormat = $"{hashKey}###{linkQrId}###{paymentId}###{trackId}###{orderId}###{amount}"

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% endtab %}

{% tab title="APM" %}
You can obtain the hashKey information from the panel

```csharp
var hashFormat = $"{hashKey}###{apmId}###{merchantUniqueCode}###{amount}"

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% endtab %}

{% tab title="Physical Pos" %}
You can obtain the **hashKey** information from the panel.

```csharp
var hashFormat = $"{key}###{paymentRequestId}###{merchantUniqueCode}###{amount}";

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% endtab %}

{% tab title="General System" %}
You can obtain the hashKey information from the panel

```csharp
var hashFormat = $"{hashKey}###{paymentId}###{merchantUniqueCode}###{amount.ToString()}###{installment}"

// Create a SHA256
using var sha256Hash = SHA256.Create();
// ComputeHash - returns byte array  
var bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(hashFormat));

// Convert byte array to a string   
var builder = new StringBuilder();
foreach (var t in bytes)
{
    builder.Append(t.ToString("x2"));
}
return builder.ToString();
```

{% 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://developer.paywall.one/payment-orchestration-integration-document/hash-generation.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.
