This page explains, step by step, how to generate the signedRequest token used when sending requests to Tami Virtual POS APIs (pre-authorization, sales, etc.).
Requests sent to Tami are not sent as plain JSON. Instead, the request body is first signed (HS512 → JWS), and then encrypted (dir + A256GCM → JWE). The resulting token is delivered to the API as follows:
Because the token is encrypted, it cannot be opened on jwt.io. This is not an error, it is expected behavior.
The table below uses Test (Sandbox) Environment credentials as an example. When performing transactions in the production (prod) environment, you must use your own merchant’s Merchant and Terminal numbers.
| Information | Example |
|---|---|
| Merchant number | 77006950 |
| Terminal number | 84006953 |
| JWK JSON (merchant-specific key file) | Below |
json
If you do not have a JWK, it should be requested from your merchant representative. The k value must not be shared with any person or system, and must not be committed to a source code repository (git).
A ready-made code example for your preferred language is available in the Code Samples section below. The steps below show the logic; the same flow can be built with any JOSE/JWT library (Java, Node, Python, etc.).
The JWK JSON is given to the library as is. Your signing key is the decoded form of the k value.
The SHA-256 digest of the signing key is the encryption key (32 bytes → A256GCM):
| Claim | Value |
|---|---|
| iss | “77006950:84006953” (merchant:terminal) |
| aud | “tami” (fixed) |
| jti | a new UUID generated for each token |
| iat / nbf | the moment of generation |
| exp | 10 minutes after the moment of generation |
| tami:body | the request body (the JSON defined in the service contract) |
| tami:apiVersion | “v4” (fixed) |
The claims are signed with HS512. The header must include kid and typ: JWT:
The signed JWT is encrypted with the following header and serialized:
Result: a compact token made up of 5 parts separated by dots is obtained. This is your signedRequest value.
Below are links to dedicated code samples written in various programming languages. Through the link for your preferred programming language, you can examine in detail code written with pre-defined example values.
These samples contain code covering the 5 steps of the signedRequest token generation flow, and since they are written in different languages, it is also possible to observe various approaches and practices. This gives you the opportunity to work with clearer and more authentic examples suited to your preferred programming language.
Please note that these samples are written with pre-defined values, and the necessary adaptation and security measures may need to be taken for their use in real projects.
The k and kid values are unique values specific to each merchant. In the production (prod) environment, merchants can view them on the Merchant Settings > POS Management page of the Merchant Portal. Updating this information at regular intervals for transaction security is the merchant's responsibility.
When testing transactions in the Test (Sandbox) environment, the k and kid values can be viewed in the same way through the test portal. If you need any support, you can reach our support team at TeknikDestek@tami.com.tr.