cancelDeal

Overview

The cancelDeal command cancels a payment transaction that has not yet been transmitted to Shva (Israel's payment processor). This operation can only be performed on transactions that remain in "Approved, pending transmission" status.

Unlike refunds, cancellations must be for the full transaction amount and can only be performed before the daily transmission to Shva (typically occurring around 11:00 PM). Once transmitted, you must use refundDeal instead.

Best Practice: In most cases, use refundDeal instead of cancelDeal. The refundDeal command automatically determines whether to cancel or refund based on transmission status.

Use cases

  • Cancel pre-transmission transactions: Cancel transactions before Shva transmission (typically before 11:00 PM daily cutoff)

  • Two-phase commit cancellations: Cancel approval (J5) requests in two-phase commits

  • Full-amount reversals: Only full transaction amounts can be cancelled (partial cancellations not supported)

  • Payment page cancellations: Handle cancellations from payment page integration

Request structure

For a comprehensive overview of the API request format and authentication, see API Request & Response General Structure.

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

XML payload structure

Required parameters

At least one of the following three parameters must be provided:

tranId - Transaction ID

Type: String Required: At least one lookup parameter required Description: Unique transaction request ID for a specific transaction step

Example: 118374610

Usage Notes:

  • When provided, other lookup elements are ignored

  • Most specific identifier for a transaction step

  • Returned in response from the original transaction

cgUid - CG Identifier

Type: String Required: At least one lookup parameter required Description: CG identifier shared across related transactions (e.g., original charge and refunds)

Example: 118374610

Usage Notes:

  • Links related transactions together

  • Useful for tracking transaction chains

  • Returned in response from the original transaction

orgUid - Original UID

Type: String Required: At least one lookup parameter required Description: Shva-assigned transaction ID

Example:

Usage Notes:

  • Must be wrapped in ashraitEmvData element

  • Unique identifier from Shva payment processor

  • Used for direct transaction reference

Optional parameters

terminalNumber - Your merchant terminal identifier

Type: String Required: No Description: The unique terminal number assigned during merchant onboarding

Example: 0882819014

Usage Notes:

  • Must match your assigned terminal number

  • Used for transaction lookup and authorization

  • Available in your merchant dashboard

authNumber - Authorization Number

Type: String Required: No Description: Authorization number from credit card company

Example: 7823673

Usage Notes:

  • Can be included for additional validation

  • Helps ensure correct transaction matching

  • From the original transaction response

user - User Field

Type: String Required: No Description: Custom user identifier from original transaction

Example: customer123

Usage Notes:

  • Must match the value from the original transaction

  • Useful for merchant-specific tracking

  • Free-text field for merchant use

cardId - Card ID

Type: String Required: No Description: Card identifier (requires cardExpiration)

Example: 1092880571131111

Usage Notes:

  • Must be used together with cardExpiration

  • Provides additional transaction validation

  • From tokenization or original transaction

cardExpiration - Card Expiration

Type: String (MMYY format) Required: No (required when using cardId) Description: Card expiration date

Example: 0629

Usage Notes:

  • Required when cardId is provided

  • Format must be MMYY

  • Must match card's actual expiration

shiftId1, shiftId2, shiftId3 - Shift identifiers for transaction grouping

Type: String Required: No Description: Optional shift identifiers for transaction organization and reporting

Usage Notes:

  • Used for internal transaction grouping

  • Helpful for reconciliation and reporting

  • Must match the original transaction if provided

shiftTxnDate - Shift transaction date

Type: String Required: No Description: Date associated with shift for transaction grouping

Usage Notes:

  • Used alongside shift ID parameters

  • Helps locate transactions within specific time periods

transactionCode - Transaction processing code

Type: String Required: No Description: Specific transaction code for processing context

Usage Notes:

  • Usually inherits from the original transaction

  • Used for specialized transaction handling

Response structure

Successful response

A successful cancelDeal response contains transaction details and confirmation of cancellation:

Key Response Fields:

  • result: 000 indicates successful cancellation

  • tranId: New transaction ID for the cancellation

  • transactionType: Shows Cancel (code 52)

  • total: Amount that was cancelled

  • cgUid: Links to original transaction

Error response

Error responses include specific error codes and messages. The response contains many fields, most of which will be empty for error cases. The key fields to focus on are result, message, userMessage, status, and statusText:

Note: Error responses include the full structure with many empty fields. Focus on the result, status, and message fields for error handling.

Code examples

Error codes

Error Code
Description
Resolution

310

No debit deal matches the credit deal

Verify lookup parameters match an existing transaction

312

No transaction found for canceling

Check transaction ID and lookup criteria

313

Transaction has already been transmitted

Use refundDeal instead for transmitted transactions

314

Transaction has already been canceled

Transaction was previously cancelled successfully

317

Missing required parameters

Ensure at least one lookup element is provided

319

Terminal not permitted to cancel

Contact support to enable cancellation permissions

320

Credit transaction already performed

Cannot cancel transactions that already have credits

332

Multiple transactions found

Use more specific lookup criteria or enable "Block multiple matches" terminal setting

Last updated

Was this helpful?