This article describes how to cancel payment made by IM25 card reader (Israel) using Tranzila API.

1. Make payment

{
    "uniqueid": "testmilgam",
    "domainname": "bigmama.gotpose.com",
    "pos_id": "5650221101",
    "currency": "376",
    "cred_type": "1",
    "supplier": "testmilgam", (1)
    "tranmode": "A",
    "sum": "0.50",
    "company": "bigmama"
}
1 It is important that supplier is testmilgam. Otherwise information required for cancel operation would not be available.

Response look like this.

{
    "index": "9250", (1)
    "original_request": {
        "uniqueid": "testmilgam",
        "domainname": "bigmama.gotpose.com",
        "pos_id": "5650221101",
        "currency": "376",
        "cred_type": "1",
        "supplier": "testmilgam",
        "tranmode": "A",
        "sum": "0.50",
        "company": "bigmama",
        "index": "9250"
    },
    "token": "rf11111111111111111", (2)
    "transaction_result": {
        "amount": 50,
        "end_software_version": "a.00.236",
        "is_prepaid": false,
        "rrn": "041611001001",
        "cardNumber": "111111******11111",
        "cardNumberOriginalLength": "111111******11111",
        "statusCode": 0,
        "currency": "376",
        "expDate": "2912", (3)
        "statusMessage": "Approved",
        "vuid": "testmilgam_1776327145675145_1L5yJB7_As4EVcDm5dLPyU5Pe2M=",
        "customerReceipt": [
            {
                "fieldName": "POS Name",
                "fieldValue": "אינטרספייס בע\"מ"
            },
            {
                "fieldName": "POS Number",
                "fieldValue": "5650221"
            },
            {
                "fieldName": "Software Version",
                "fieldValue": "ADY000245"
            },
            {
                "fieldName": "Merchant ID",
                "fieldValue": "60905"
            },
            {
                "fieldName": "Tran Date and Time",
                "fieldValue": "11:12 16.04.2026"
            },
            {
                "fieldName": "Card Name",
                "fieldValue": "ויזה תייר"
            },
            {
                "fieldName": "Card Number",
                "fieldValue": "0872"
            },
            {
                "fieldName": "POS Tran ID",
                "fieldValue": "01001001"
            },
            {
                "fieldName": "UID",
                "fieldValue": "26041611122556502215449"
            },
            {
                "fieldName": "RRN",
                "fieldValue": "041611001001"
            },
            {
                "fieldName": "Tran Type",
                "fieldValue": "REGULAR CHARGE"
            },
            {
                "fieldName": "Issuer Auth Num",
                "fieldValue": " 848609"
            },
            {
                "fieldName": "Authorized by",
                "fieldValue": "Issuer"
            },
            {
                "fieldName": "Entry Mode",
                "fieldValue": "Digital Wallet"
            },
            {
                "fieldName": "Credit Terms",
                "fieldValue": "Regular"
            },
            {
                "fieldName": "Amount",
                "fieldValue": "0.50 ILS"
            },
            {
                "fieldName": "AID",
                "fieldValue": "A0000000031010"
            },
            {
                "fieldName": "App Name",
                "fieldValue": "VISA CREDIT"
            },
            {
                "fieldName": "ATC",
                "fieldValue": "0001"
            },
            {
                "fieldName": "PSN",
                "fieldValue": "00"
            }
        ],
        "retailerId": 5650221015,
        "mutag": 2,
        "mutagName": "Visa",
        "solek": 5,
        "manpik": 0,
        "cardName": "ויזה תייר",
        "isClub": false,
        "creditTerms": 1,
        "authorizationCommStat": "",
        "ecrNo": "101",
        "mutav": 5650221,
        "authCodeManpik": 1,
        "issuerAuthNum": " 848609", (4)
        "uid": "26041611122556502215449",
        "posEntryMode": 7,
        "tokenizedCardNumber": "",
        "tranCode": 1,
        "tranType": 1,
        "appVersion": "12",
        "sysTraceNumber": "0"
    },
    "status": 0,
    "error": null
}

Here is the mapping of fields for the cancel request.

1 Use index as `reference_txn_id `.
2 Use token as card_number.
3 Use expDate in format 'YYMM' as value for
4 Use issuerAuthNum as authorization_number.

2. Cancel payment

Here is the documentation.

To cancel payment call

https://api.tranzila.com/v1/transaction/credit_card/create
X-tranzila-api-access-token: access_token
X-tranzila-api-app-key: app_key
X-tranzila-api-nonce: guid
X-tranzila-api-request-time: timestamp  \
Content-Type: application/json'
{
    "terminal_name": "testmilgam",
    "txn_type": "credit",
    "reference_txn_id": 9250,
    "authorization_number": "848609",
    "expire_month": 12,
    "expire_year": 2029,
    "card_number": "rf11111111111111111",
    "items": [
        {
            "name": "Pen",
            "type": "I",
            "unit_price": 0.5,
            "units_number": 1
        }
    ]
}

Before send it is necessary to set headers. The example code below shows how to calculate them. The script can be used in Postman as 'Pre-request' to calculate required values. It expect that tranzila-api-key and tranzila-secret variables are defined.

// 1. Pull variables from your Collection
const app_key = pm.collectionVariables.get("tranzila-api-key");
const secret = pm.collectionVariables.get("tranzila-secret");

// 2. Calculate Timestamp (Unix format - seconds)
const timestamp = Math.floor(Date.now() / 1000).toString();

// 3. Generate a Nonce (Tranzila typically expects a 40-byte/char random string)
// We'll generate a random hex string of 40 characters
const nonce = CryptoJS.lib.WordArray.random(20).toString(CryptoJS.enc.Hex);

// 4. Calculate the HMAC-SHA256 Access Token
const access_key = CryptoJS.HmacSHA256(app_key, secret + timestamp + nonce).toString(CryptoJS.enc.Hex);

// 5. Store results in local variables for use in Headers
pm.variables.set("x-tranzila-api-access-token", access_key);
pm.variables.set("x-tranzila-api-request-time", timestamp);
pm.variables.set("x-tranzila-api-nonce", nonce);


console.log("🦖 ==== Headers ====");
console.log("🦖 x-tranzila-api-access-token: ", pm.variables.get("x-tranzila-api-access-token"));
console.log("🦖 x-tranzila-api-app-key: ", app_key);
console.log("🦖 x-tranzila-api-nonce: ",  pm.variables.get("x-tranzila-api-nonce"));
console.log("🦖 x-tranzila-api-request-time: ",  pm.variables.get("x-tranzila-api-request-time"));

Successful response look like this:

{
    "error_code": 0,
    "message": "Success",
    "transaction_result": {
        "processor_response_code": "424",
        "transaction_id": "9261",
        "transaction_resource": 0,
        "Responsecvv": "0",
        "Responseid": "0",
        "ConfirmationCode": "0000000",
        "Tempref": "01005020",
        "amount": 0.5,
        "DBFIsForeign": "0",
        "auth_number": "0000000",
        "card_type": "0",
        "card_type_name": "",
        "currency_code": "1",
        "expiry_month": "12",
        "expiry_year": "29",
        "payment_plan": "1",
        "credit_card_owner_id": "testmilgam",
        "card_issuer": "0",
        "cardaquirer": "0",
        "token": "rf11111111111111111",
        "last_4": "0872",
        "card_mask": "482095******0872",
        "card_locality": "domestic",
        "txn_type": "credit",
        "tranmode": "C"
    },
    "original_request": {
        "terminal_name": "testmilgam",
        "txn_type": "credit",
        "reference_txn_id": 9250,
        "authorization_number": "848609",
        "expire_month": 12,
        "expire_year": 2029,
        "card_number": "rf11111111111111111",
        "items": [
            {
                "name": "Pen",
                "type": "I",
                "unit_price": 0.5,
                "units_number": 1
            }
        ]
    }
}