Cancel Document – (Cancel Document and Refund Credit Card)
When should this function be used?
This function can be used to cancel an issued document and cancel the transaction associated with it.
Unlike other functions that can issue a credit, such as Create a new Iframe Redirect page, Do Transaction, and Refund By Transaction Id, this function allows you to cancel a specific transaction and create an associated document for it.
This function is similar to Refund By Transaction Id, but in this case it creates the appropriate document and allows only the full transaction amount to be canceled.
The following is a link to the JSON function.
Request method – POST.
Create a document associated to a deal
https://secure.cardcom.solutions/api/v11/Documents/CancelDoc
The following parameters must be passed to the Cancel document and refund credit card function.
Legend:
Red parameter – Required
Bold parameter – Recommended
Parameter that is neither red nor bold – Optional
| Number | Parameter | Example values | Description |
|---|---|---|---|
| 1 | ApiName | test2025 | Interface username. This parameter must be obtained from the business. |
| 2 | ApiPassword | "kzFKfohEvL6AOF8aMEJz" | API password, intended for issuing credits and canceling transactions. |
| 3 | DocumentNumber | 2489 | Document number. |
| 4 | DocumentType | 1 – Tax invoice/receipt 2 – Credit invoice and refund 50 – Price quote 100 – Order (without payment) 101 – Order confirmation – from the website (internal document, not for bookkeeping) – Paid order 200 – Delivery note 300 – Transaction account 301 – Payment demand 302 – Payment demand cancellation 305 – Tax invoice 330 – Credit invoice 410 – Customer refund (credit receipt) 405 – Donation receipt 406 – Donation receipt credit (refund) 303 – Receipt account (similar to an invoice for a VAT-exempt business; rarely used) | Document type number. |
| 5 | IsCancelEmailSend | boolean – true / false. In other words, if true is passed here, the document will not be sent. | Whether not to send the credit document by email. |
| 6 | IsSendSMS | boolean – true / false | Whether to send an SMS about the issued document. |
| 7 | IsCreditCardCancelOnly | boolean – true / false | Whether to skip document cancellation when a credit-card payment method is present. |
Response from Cancel document and refund credit card.
| Number | Parameter | Example values | Description |
|---|---|---|---|
| 1 | ResponseCode | 0 | 0 – The operation was successful Any other value – Invalid; a development error. |
| 2 | Description | "The transaction was completed successfully" | Description of the response. If a different response is received, the transaction was not completed successfully. |
| 3 | NewDocumentNumber | 5198 | Number of the newly issued document. |
| 4 | NewDocumentType | 1 – Tax invoice/receipt 2 – Credit invoice and refund 50 – Price quote 100 – Order (without payment) 101 – Order confirmation – from the website (internal document, not for bookkeeping) – Paid order 200 – Delivery note 300 – Transaction account 301 – Payment demand 302 – Payment demand cancellation 305 – Tax invoice 330 – Credit invoice 410 – Customer refund (credit receipt) 405 – Donation receipt 406 – Donation receipt credit (refund) 303 – Receipt account (similar to an invoice for a VAT-exempt business; rarely used) | Type number of the newly issued credit document. |
| 5 | AccountID | "5154" | Customer account number. |
The following is an example of the function together with its response.
Request to cancel the document:
{
"ApiName": "test2025",
"ApiPassword": "test5000$",
"DocumentNumber": "586188",
"DocumentType": "1",
"IsCancelEmailSend": true
}Received response:
{
"ResponseCode": 0,
"Description": "The cancellation document issued was 2491,2 – customer no. 0 – against original document 586188,1",
"NewDocumentNumber": 2491,
"NewDocumentType": 2,
"AccountID": 0
}