refundCgInvoice
Overview
The refundCgInvoice command processes refunds for invoices generated through the EZcount system. This command creates a credit note that cancels or partially refunds the original invoice while maintaining proper tax compliance and audit trails.
Use cases
Use refundCgInvoice when you need to:
Process full refunds for customer returns or cancellations
Handle partial refunds for damaged or incomplete orders
Generate credit notes for tax compliance purposes
Maintain proper documentation for financial reconciliation
Reverse invoice charges while preserving audit trails
Request structure
The refundCgInvoice command uses the following endpoint:
POST https://your-hyp-environment-url/xpo/Relay
HTTP request format
The request must be sent as a POST request with application/x-www-form-urlencoded content type, containing three required body parameters:
user
string
Your merchant username for API authentication
password
string
Your merchant password for API authentication
int_in
string
XML payload containing the command and parameters (see structure below)
XML request structure
Required parameters
Response structure
Success response
Key Response Fields:
result:000indicates successful API callinvoiceCreationCode:000indicates successful credit note creationinvoiceResponseCode:100indicates proper invoice requestinvoiceDocNumber: The generated credit note numberinvoiceDocUrl: Direct link to view/download the credit note
Error responses
Example 1: No invoice found for source transaction
Example 2: Transaction type mismatch
Code examples
Error codes
CG Gateway invoice error codes
668
Cannot Create Invoice
Check invoice parameters and retry
669
Currency not supported for invoice creation
Verify currency is supported for invoicing
670
Invoice Validation Failed
Check that invoice values are valid
671
Invoice not found
Verify the invoice identifier is correct
Invoice vendor response codes
100
Success
Invoice operation completed successfully
101
UsernameInvalid
Check username for invoice system
102
CompanyCodeAlreadyExists
Company code already exists in system
103
CompanyCodeDoesNotExist
Verify company code exists
104
CompanyCodeInvalidFormat
Company code must be numeric
105
DocumentInvalidSubject
Subject line is invalid
106
DocumentDoesNotExist
Document number was not found
107
SendEmailAborted
E-mailing document failed
108
EmailInvalid
Check email format
109
CultureInvalid
Invalid culture setting
110
KeyInvalid
Invalid key provided
111
AccountExpired
Account has expired
112
DocumentInvalidItemNumber
Multiple items in wrong format
113
DocumentInvalidQuantity
Quantity must be numeric
114
DocumentInvalidPrice
Price must be numeric
116
DocumentDoesNotExistForSpecifiedCompany
Document doesn't exist for company
117
CurrencyConversionServiceNotAvailable
Currency service unavailable
118
InvalidItemCode
Unacceptable item code
119
CurrencyInWrongFormat
Currency must be integer
120
DocumentMissingItem
Quantity, price, description and code must match
121
DocumentInvalidDateFormatDDMMYY
Date format must be DDMMYY
122
PaymentAmountDoesntMatchInvoice
Total receivables must be positive
123
DocumentAmountInvalid
Amount must be double
124
CashInvalidAmount
Cash amount must be double
125
CheckInvalidAmount
Check amount must be double
126
CCInvalidAmount
Credit card amount must be double
127
TransInvalidAmount
Transaction amount must be double
128
CheckInvalidDateFormatDDMMYY
Check date format must be DDMMYY
129
CCInvalidDateFormatDDMMYY
CC date format must be DDMMYY
130
TransInvalidDateFormatDDMMYY
Transaction date format must be DDMMYY
131
PaymentTotalMustBeEqualToInvoiceTotal
Payment must equal invoice total
132
TaxRateInTheDocsIsNotEqual
Tax rate mismatch in documents
133
ClientCompanyNameAlreadyExists
Company name already exists
134
ClientTicketAlreadyExists
Client ticket already exists
Invoice vendor response messages are always returned in English.
Related commands
addCgInvoice- Create new invoicesinquireInvoice- Query invoice informationrefundDeal- Process transaction refundsdoDeal- Process payments with automatic invoice generation
Best practices
Use invoiceAtranId - This is the most reliable identifier for refund processing
Always create credit notes - Set createInvoice to 1 to generate proper documentation
Support partial refunds - Allow customers to refund partial amounts for damaged or incomplete orders
Validate refund amounts - Ensure refund amounts don't exceed the original invoice total
Store credit note information - Keep track of credit note numbers and URLs for customer service
Handle tax implications - Credit notes properly handle VAT and tax reversals for compliance
Last updated
Was this helpful?