# transmitTerminal

## Overview

The `transmitTerminal` command manually initiates the transmission of transaction or terminal data to Shva, Israel's central clearing network. This command allows merchants to control their own transmission timing instead of relying on automatic daily transmissions.

{% hint style="warning" %}
**Important**: Merchants using manual transmission typically operate with automatic transmission disabled. When using manual transmission, you take full responsibility for managing all transmissions - the system will not automatically transmit transactions. You must ensure regular transmission to avoid delays in settlement and reporting.
{% endhint %}

## Use cases

* **Manual settlement initiation**: Trigger immediate transmission to Shva instead of waiting for the automatic daily cycle
* **Same-day reconciliation**: Ensure transactions are transmitted for immediate settlement and reporting
* **End-of-day processing**: Manually close the day's transactions before the automatic transmission
* **Urgent settlement requirements**: Handle time-sensitive transactions that need immediate processing
* **Business workflow integration**: Integrate manual transmission into specific business processes or schedules
* **Pre-weekend/holiday processing**: Ensure transactions are transmitted before extended periods when automatic processing might be delayed

## Request structure

For a comprehensive overview of the API request format and authentication, see [API Request & Response General Structure](/creditguard/introduction/request-and-response-general-structure.md).

Send a standard Hyp API request to your assigned server endpoint with the `transmitTerminal` command in the `int_in` parameter.

{% hint style="success" %}
**Server Endpoints**: Use the server endpoint provided during merchant onboarding (e.g., `https://your-hyp-environment-url/xpo/Relay`).
{% endhint %}

### XML payload structure

```xml
<ashrait>
    <request>
        <version>2000</version>
        <language>Eng</language>
        <dateTime/>
        <requestId/>
        <command>transmitTerminal</command>
        <transmitTerminal>
            <terminalNumber>{terminalNumber}</terminalNumber>
            <transmitType>{transmitType}</transmitType>
            <responseType>immediate</responseType>
        </transmitTerminal>
    </request>
</ashrait>
```

{% hint style="info" %}
**Note**: The `responseType` field should be set to `immediate` within the `transmitTerminal` block. This ensures the merchant receives the response immediately after sending the request without waiting for the transmission to finish.
{% endhint %}

## Required parameters

<details>

<summary><strong>terminalNumber</strong> - Your merchant terminal identifier</summary>

**Type**: String (Numeric, 10 digits)\
**Required**: Yes\
**Description**: The unique terminal number assigned during merchant onboarding

**Example**: `0882819014`

**Usage Notes**:

* Must match your assigned terminal number
* Used for identifying which terminal's transactions to transmit
* Available in your merchant dashboard

</details>

<details>

<summary><strong>transmitType</strong> - Type of transmission to perform</summary>

**Type**: String (Enum)\
**Required**: Yes\
**Description**: Specifies the type of transmission to execute

**Valid Values**:

* `settlements` - Transmits all transactions that are ready for transmission on the specific terminal

**Example**: `settlements`

**Usage Notes**:

* `settlements` is the only available value for transmitType
* Will transmit all transactions that are ready for transmission on the specific terminal

</details>

<details>

<summary><strong>responseType</strong> - Response format specification</summary>

**Type**: String (Enum)\
**Required**: Yes\
**Description**: Must be set to `immediate` to receive the response immediately

**Valid Values**:

* `immediate` - Merchant receives the response immediately after sending the request and won't wait for the transmission to finish

**Example**: `immediate`

**Usage Notes**:

* Must be included in the transmitTerminal element
* Always set to `immediate` to receive response without waiting for transmission completion
* This is a required field for proper transmission handling

</details>

## Optional parameters

{% hint style="info" %}
**Note**: There are currently no optional parameters for the transmitTerminal command. All fields shown above are required.
{% endhint %}

## Response structure

### Successful response

A successful `transmitTerminal` response contains transmission confirmation and details:

```xml
<?xml version='1.0'?>
<ashrait>
    <response>
        <command>transmitTerminal</command>
        <dateTime>2025-08-17 16:00</dateTime>
        <requestId/>
        <tranId>119513934</tranId>
        <result>000</result>
        <message>Permitted transaction</message>
        <userMessage>Permitted transaction</userMessage>
        <additionalInfo/>
        <version>2000</version>
        <language>Eng</language>
        <transmitTerminal>
            <terminalNumber>0882804010</terminalNumber>
            <transmitId>1598133</transmitId>
            <transmitType>settlements</transmitType>
            <countTransmitted/>
        </transmitTerminal>
    </response>
</ashrait>
```

**Key Response Fields**:

* `result`: `000` indicates successful transmission initiation
* `tranId`: Transaction ID for this operation
* `transmitId`: Unique identifier for this transmission batch
* `terminalNumber`: The terminal that initiated the transmission
* `transmitType`: The type of transmission performed (e.g., `settlements`)
* `countTransmitted`: Number of transactions transmitted (may be empty for immediate response)

### Error response

Error responses include specific error codes and messages:

```xml
<?xml version='1.0'?>
<ashrait>
    <response>
        <command>transmitTerminal</command>
        <dateTime>2025-08-17 16:08</dateTime>
        <requestId/>
        <tranId>119514041</tranId>
        <result>502</result>
        <message>Terminal is currently in transmit. cannot make another transmit</message>
        <userMessage>Terminal is currently in transmit. cannot make another transmit</userMessage>
        <additionalInfo/>
        <version>2000</version>
        <language>Eng</language>
        <transmitTerminal>
            <terminalNumber>0882804010</terminalNumber>
            <transmitId/>
            <transmitType>settlements</transmitType>
            <countTransmitted/>
        </transmitTerminal>
    </response>
</ashrait>
```

## Code examples

{% tabs %}
{% tab title="cURL" %}

```bash
#!/bin/bash

# Manual terminal transmission
curl -X POST https://your-hyp-environment-url/xpo/Relay \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "user=your_username" \
  -d "password=your_password" \
  -d "int_in=$(cat <<'EOF'
<ashrait>
    <request>
        <version>2000</version>
        <language>Eng</language>
        <dateTime/>
        <requestId/>
        <command>transmitTerminal</command>
        <transmitTerminal>
            <terminalNumber>0882819014</terminalNumber>
            <transmitType>settlements</transmitType>
            <responseType>immediate</responseType>
        </transmitTerminal>
    </request>
</ashrait>
EOF
)"
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.*;
import java.net.*;
import java.nio.charset.StandardCharsets;

public class TransmitTerminalExample {
    
    public static class TransmissionResult {
        public boolean success;
        public String transmitId;
        public int transactionCount;
        public String transmissionDate;
        public String transmissionTime;
        public String error;
    }
    
    public static TransmissionResult transmitTerminal(String terminalNumber, String transmitType, String responseType) throws IOException {
        String serverUrl = "https://your-hyp-environment-url/xpo/Relay";
        String username = "your_username";
        String password = "your_password";
        
        TransmissionResult result = new TransmissionResult();
        
        // Build XML payload
        StringBuilder xmlPayload = new StringBuilder();
        xmlPayload.append("<ashrait>")
                  .append("<request>")
                  .append("<version>2000</version>")
                  .append("<language>Eng</language>")
                  .append("<dateTime/>")
                  .append("<requestId/>")
                  .append("<command>transmitTerminal</command>")
                  .append("<transmitTerminal>")
                  .append("<terminalNumber>").append(terminalNumber).append("</terminalNumber>")
                  .append("<transmitType>").append(transmitType).append("</transmitType>");
        
        if (responseType != null && !responseType.isEmpty()) {
            xmlPayload.append("<responseType>").append(responseType).append("</responseType>");
        }
        
        xmlPayload.append("</transmitTerminal>")
                  .append("</request>")
                  .append("</ashrait>");
        
        // Build POST data
        String postData = "user=" + URLEncoder.encode(username, StandardCharsets.UTF_8) +
                         "&password=" + URLEncoder.encode(password, StandardCharsets.UTF_8) +
                         "&int_in=" + URLEncoder.encode(xmlPayload.toString(), StandardCharsets.UTF_8);
        
        // Send request
        URL url = new URL(serverUrl);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("POST");
        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
        connection.setDoOutput(true);
        
        try (OutputStream os = connection.getOutputStream()) {
            os.write(postData.getBytes(StandardCharsets.UTF_8));
        }
        
        // Read response
        try (BufferedReader reader = new BufferedReader(
                new InputStreamReader(connection.getInputStream()))) {
            String line;
            StringBuilder response = new StringBuilder();
            while ((line = reader.readLine()) != null) {
                response.append(line);
            }
            
            // Parse response (simplified - use proper XML parser in production)
            String responseText = response.toString();
            if (responseText.contains("<result>000</result>")) {
                result.success = true;
                result.transmitId = extractValue(responseText, "transmitId");
                result.transactionCount = Integer.parseInt(extractValue(responseText, "transactionCount"));
                result.transmissionDate = extractValue(responseText, "transmissionDate");
                result.transmissionTime = extractValue(responseText, "transmissionTime");
            } else {
                result.success = false;
                result.error = extractValue(responseText, "userMessage");
            }
        }
        
        return result;
    }
    
    private static String extractValue(String xml, String tagName) {
        String startTag = "<" + tagName + ">";
        String endTag = "</" + tagName + ">";
        int start = xml.indexOf(startTag);
        if (start != -1) {
            start += startTag.length();
            int end = xml.indexOf(endTag, start);
            if (end != -1) {
                return xml.substring(start, end);
            }
        }
        return "";
    }
    
    public static void main(String[] args) throws IOException {
        // Manual transmission example
        TransmissionResult result = transmitTerminal("0882819014", "settlements", "immediate");
        
        if (result.success) {
            System.out.println("Transmission successful!");
            System.out.println("Transmission ID: " + result.transmitId);
            System.out.println("Transactions transmitted: " + result.transactionCount);
            System.out.println("Transmission completed: " + result.transmissionDate + " " + result.transmissionTime);
        } else {
            System.out.println("Transmission failed: " + result.error);
        }
    }
}
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from urllib.parse import urlencode
from xml.etree import ElementTree as ET

def transmit_terminal(terminal_number, transmit_type, response_type=None):
    """Manually transmit terminal data to Shva"""
    
    server_url = "https://your-hyp-environment-url/xpo/Relay"
    username = "your_username"
    password = "your_password"
    
    # Build XML payload
    xml_payload = f"""
    <ashrait>
        <request>
            <version>2000</version>
            <language>Eng</language>
            <dateTime/>
            <requestId/>
            <command>transmitTerminal</command>
            <transmitTerminal>
                <terminalNumber>{terminal_number}</terminalNumber>
                <transmitType>{transmit_type}</transmitType>
                {f'<responseType>{response_type}</responseType>' if response_type else ''}
            </transmitTerminal>
        </request>
    </ashrait>
    """
    
    # Prepare POST data
    post_data = {
        'user': username,
        'password': password,
        'int_in': xml_payload.strip()
    }
    
    try:
        # Send request
        response = requests.post(
            server_url,
            data=post_data,
            headers={'Content-Type': 'application/x-www-form-urlencoded'},
            timeout=30
        )
        
        response.raise_for_status()
        
        # Parse XML response
        root = ET.fromstring(response.text)
        result_code = root.find('.//result').text
        
        if result_code == '000':
            transmission_data = root.find('.//transmitTerminal')
            
            return {
                'success': True,
                'transmit_id': transmission_data.find('transmitId').text if transmission_data.find('transmitId') is not None else '',
                'transaction_count': int(transmission_data.find('transactionCount').text) if transmission_data.find('transactionCount') is not None else 0,
                'transmission_date': transmission_data.find('transmissionDate').text if transmission_data.find('transmissionDate') is not None else '',
                'transmission_time': transmission_data.find('transmissionTime').text if transmission_data.find('transmissionTime') is not None else '',
                'message': root.find('.//userMessage').text
            }
        else:
            return {
                'success': False,
                'error_code': result_code,
                'error': root.find('.//userMessage').text
            }
            
    except requests.exceptions.RequestException as e:
        return {
            'success': False,
            'error': f"Request failed: {e}"
        }
    except ET.ParseError as e:
        return {
            'success': False,
            'error': f"XML parsing failed: {e}"
        }

# Example usage
if __name__ == "__main__":
    # Manual transmission
    result = transmit_terminal("0882819014", "settlements", "immediate")
    
    if result['success']:
        print("Transmission successful!")
        print(f"Transmission ID: {result['transmit_id']}")
        print(f"Transactions transmitted: {result['transaction_count']}")
        print(f"Completed: {result['transmission_date']} {result['transmission_time']}")
    else:
        print(f"Transmission failed: {result['error']}")
    
    # Basic transmission without detailed response
    basic_result = transmit_terminal("0882819014", "settlements")
    
    if basic_result['success']:
        print("Basic transmission completed successfully")
    else:
        print(f"Basic transmission failed: {basic_result['error']}")
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require('https');
const querystring = require('querystring');
const { parseStringPromise } = require('xml2js');

function transmitTerminal(terminalNumber, transmitType, responseType = null) {
    return new Promise((resolve, reject) => {
        const serverUrl = 'https://your-hyp-environment-url/xpo/Relay';
        const username = 'your_username';
        const password = 'your_password';
        
        // Build XML payload
        let xmlPayload = `
        <ashrait>
            <request>
                <version>2000</version>
                <language>Eng</language>
                <dateTime/>
                <requestId/>
                <command>transmitTerminal</command>
                <transmitTerminal>
                    <terminalNumber>${terminalNumber}</terminalNumber>
                    <transmitType>${transmitType}</transmitType>`;
        
        if (responseType) {
            xmlPayload += `<responseType>${responseType}</responseType>`;
        }
        
        xmlPayload += `
                </transmitTerminal>
            </request>
        </ashrait>
        `;
        
        // Prepare POST data
        const postData = querystring.stringify({
            user: username,
            password: password,
            int_in: xmlPayload.trim()
        });
        
        const options = {
            method: 'POST',
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded',
                'Content-Length': Buffer.byteLength(postData)
            }
        };
        
        const req = https.request(serverUrl, options, async (res) => {
            let responseData = '';
            
            res.on('data', (chunk) => {
                responseData += chunk;
            });
            
            res.on('end', async () => {
                try {
                    if (res.statusCode === 200) {
                        // Parse XML response
                        const result = await parseStringPromise(responseData);
                        const response = result.ashrait.response[0];
                        const resultCode = response.result[0];
                        
                        if (resultCode === '000') {
                            const transmissionData = response.transmitTerminal ? response.transmitTerminal[0] : {};
                            
                            resolve({
                                success: true,
                                transmitId: transmissionData.transmitId ? transmissionData.transmitId[0] : '',
                                transactionCount: transmissionData.transactionCount ? parseInt(transmissionData.transactionCount[0]) : 0,
                                transmissionDate: transmissionData.transmissionDate ? transmissionData.transmissionDate[0] : '',
                                transmissionTime: transmissionData.transmissionTime ? transmissionData.transmissionTime[0] : '',
                                message: response.userMessage[0]
                            });
                        } else {
                            resolve({
                                success: false,
                                errorCode: resultCode,
                                error: response.userMessage[0]
                            });
                        }
                    } else {
                        reject(new Error(`HTTP ${res.statusCode}: ${responseData}`));
                    }
                } catch (parseError) {
                    reject(new Error(`XML parsing failed: ${parseError.message}`));
                }
            });
        });
        
        req.on('error', (error) => {
            reject(error);
        });
        
        req.write(postData);
        req.end();
    });
}

// Example usage
async function example() {
    try {
        // Manual transmission with immediate response
        const result = await transmitTerminal('0882819014', 'settlements', 'immediate');
        
        if (result.success) {
            console.log('Transmission successful!');
            console.log(`Transmission ID: ${result.transmitId}`);
            console.log(`Transactions transmitted: ${result.transactionCount}`);
            console.log(`Completed: ${result.transmissionDate} ${result.transmissionTime}`);
        } else {
            console.log(`Transmission failed: ${result.error}`);
        }
        
        // Basic transmission
        const basicResult = await transmitTerminal('0882819014', 'settlements');
        
        if (basicResult.success) {
            console.log('Basic transmission completed successfully');
        } else {
            console.log(`Basic transmission failed: ${basicResult.error}`);
        }
        
    } catch (error) {
        console.error('Operation failed:', error.message);
    }
}

example();
```

{% endtab %}
{% endtabs %}

## Error codes

| Error Code | Description                                                             | Resolution                                                                                            |
| ---------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **000**    | Permitted transaction (Success)                                         | Transmission initiated successfully                                                                   |
| **308**    | An error occurred while executing a query in the database               | [Contact support](mailto:cg-support@hyp.co.il) if the issue persists                                  |
| **444**    | Application Error                                                       | [Contact support](mailto:cg-support@hyp.co.il) for assistance                                         |
| **500**    | TransmitId was not found                                                | Verify the transmit ID and retry                                                                      |
| **501**    | Terminal cannot be retransmitted. Please call support                   | [Contact support](mailto:cg-support@hyp.co.il) for manual intervention                                |
| **502**    | Terminal is currently in transmit. Cannot make another transmit         | Wait for current transmission to complete before retrying                                             |
| **503**    | Terminal cannot be retransmitted. There was no transmit failure         | No retransmission needed - previous transmission was successful                                       |
| **504**    | Cannot transmit. There was a transmit failure. Please try to retransmit | Retry the transmission                                                                                |
| **534**    | Transmit exceeds allowed batches per transmit                           | Reduce the number of transactions or [contact support](mailto:cg-support@hyp.co.il) to increase limit |
| **550**    | Transmit service, error parsing GW request                              | Check request format and retry                                                                        |
| **552**    | Transmit service, transmit\_log not in status 0                         | [Contact support](mailto:cg-support@hyp.co.il) - internal status issue                                |
| **553**    | Transmit service, error getting transactions from DB                    | Database issue - [contact support](mailto:cg-support@hyp.co.il) if persists                           |
| **554**    | Transmit service, error creating transactionData                        | Internal processing error - [contact support](mailto:cg-support@hyp.co.il)                            |
| **555**    | Transmit service, error creating 1402 messages                          | Message formatting error - [contact support](mailto:cg-support@hyp.co.il)                             |
| **556**    | Transmit service, error sending or creating request to BP               | Communication error with processor - retry or [contact support](mailto:cg-support@hyp.co.il)          |
| **557**    | Transmit service, error updating transmit log                           | Internal logging error - [contact support](mailto:cg-support@hyp.co.il)                               |
| **558**    | Acquirer error - terminal does not exist                                | Contact System Administration - terminal configuration issue                                          |

## Related commands

* [**`transmitInquire`**](/creditguard/api-reference/transmitinquire.md) - Query transmission status and batch information after using transmitTerminal
* [**`doDeal`**](/creditguard/api-reference/dodeal.md) - Process transactions that will later be transmitted
* [**Request Structure**](/creditguard/introduction/request-and-response-general-structure.md) - General API request format

{% hint style="info" %}
**Transmission Timing**: Manual transmission typically processes all pending transactions for the specified terminal. Use `transmitInquire` to verify the results and get detailed information about what was transmitted.
{% endhint %}

{% hint style="warning" %}
**Important**: Manual transmission should be used judiciously as it affects the settlement cycle. Coordinate with your business processes to ensure proper timing and avoid conflicts with the automatic daily transmission.
{% 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://developers.hyp.co.il/creditguard/api-reference/transmitterminal.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.
