---
title: Cancel - API Direct Debit
slug: en/nicepay-api-non-snap-cancel-api-direct-debit
description: Information about Non-SNAP Payment API - Cancel - Direct Debit API available on the NICEPAY system
image: https://archbee-image-uploads.s3.amazonaws.com/ZHvSjR5ZrsoxwKbJa3xmo/6FUD9EbygxPU0E9nuaj6j_microsoftteams-image.png
icon: {"faIcon":"fa-solid fa-book"}
docTags: 
createdAt: 2022-12-01T07:52:37.000Z
---

# About API Direct Debit Cancel

***

This API uses by Merchants to integrate the cancel system for Direct Debit payment method.



# API Direct Debit Cancel

***

The Direct Debit Cancel API is used for the cancel system for payments via Direct Debit.

| **API End Point**  | `/nicepay/direct/v2/cancel`                           |
| ------------------ | ----------------------------------------------------- |
| **Request Method** | <font color="#3b9f0f">**POST**</font>****             |
| **Header**         | `Content-Type: application/json`                      |
| **Merchant Token** | SHA256(`timeStamp`+`iMid`+`tXid`+`amt`+`merchantKey`) |
| **Request Format** | `application/json`                                    |



# Payment Methods Available for Cancel

***

**Code              PayMethod**

***

`01`               Credit Card

***

`02`               Virtual Account&#x20;

***

`03`               <font color="#2166ae">**Convenience Store**</font>****

***

`04`               Direct Debit

***

`05`               E-Wallet&#x20;

***

`06`               Paylater&#x20;

***

`08`               QRIS&#x20;

***

`09`               GPN&#x20;

***



## Request Parameters for Direct Debit Cancel

***

The following is a list of parameters to activate the cancel system for the Direct Debit payment method. These parameters are used via the API testing platform.

| **Parameter**                                               | **Type** | **Size** | **Description**                                                                            | **Notes / Example**                                              |
| ----------------------------------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| `timeStamp`<br /> <font color="#2166ae">Required</font>     | N        | 14       | API Request Timestamp <font color="#2166ae"></font>                                       | 20230515141929                                                   |
| `tXid`<br /> <font color="#2166ae">Required</font>          | AN       | 30       | Transaction ID<br /><font color="#2166ae"></font>&#xD;                                    | TNICECP04104202305151417238166                                   |
| `iMid`<br /> <font color="#2166ae">Required</font>          | AN       | 10       | Merchant ID<br /><font color="#2166ae"></font>&#xD;                                       | TNICECP041                                                       |
| `payMethod`<br /> <font color="#2166ae">Required</font>     | N        | 2        | [Payment Method Code](docId\:NQ1y7vMa25ZtvQHN5He6W) <font color="#2166ae"></font>&#xD;    | 04                                                               |
| `cancelType`<br /> <font color="#2166ae">Required</font>    | N        | 2        | [Cancel Type Code](docId\:VNHGJOXcH1WJMHnlKYVOC) <br /><font color="#2166ae"></font>&#xD; | 1                                                                |
| `cancelMsg`                                                 | AN       | 255      | Cancel Message                                                                             | Request Cancel                                                   |
| `merchantToken`<br /> <font color="#2166ae">Required</font> | AN       | 255      | Merchant Token <br /><font color="#2166ae"></font>                                        | 89fa33ec4c17f5048e69c404b42d07005f1dd6ab64354c583d04670cf9690ed8 |
| `amt`<br /> <font color="#2166ae">Required</font>           | N        | 12       | Payment Amount <br /><font color="#2166ae"></font>&#xD;                                   | 10000                                                            |
| `preauthToken`                                              | AN       | 100      | Pre-Auth Token&#xD;                                                                        |                                                                  |
| `cancelUserId`                                              | AN       | 30       | User ID&#xD;                                                                               | admin                                                            |



## Response Parameters for Direct Debit Cancel

***

Following are the response parameters from the results of the request parameters for integration of the Direct Debit to cancel:

| **Parameter**                                                           | **Type** | **Szie** | **Description**                                                                                                              | **Example / Notes**            |
| ----------------------------------------------------------------------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| `resultCd`                                                              | N        | 4        | [Result Code](docId:9eC3yH9CQqpb6cRWauWWO) [&#xD;](https://app.archbee.com/docs/36sM2OxRIwwbi9iNlqMTP/wpcEMaZro_Xvnxz-1ZAiB) | 0000                           |
| `resultMsg`                                                             | AN       | 255      | Result Message: [Error Code](docId\:FsX1GESJKxOp0T9rvUHp_)&#xD;                                                              | SUCCESS                        |
| `tXid`                                                                  | AN       | 30       | Transaction ID&#xD;                                                                                                          | TNICECP04104202305151417238166 |
| `referenceNo`                                                           | ANS      | 40       | Merchant Order Number&#xD;                                                                                                   | 20230515141702                 |
| `transDt`                                                               | N        | 8        | Transaction Date&#xD;                                                                                                        | 20230515                       |
| `transTm`                                                               | N        | 6        | Transaction Time                                                                                                             | 141723                         |
| `amt`                                                                   | N        | 12       | Amount                                                                                                                       | 2000                           |
| `cancelReferenceNo`<br /><font color="#2166ae">(Optional For CC)</font> | ANS      | 40       | Merchant Cancel Number&#xD;                                                                                                  | CancelNo20230515141702&#xD;    |



## Sample Parameter for Direct Debit Cancel

***

:::CodeblockTabs
JSON Request

```json
{
    "timeStamp":"20230515141929",
    "tXid":"TNICECP04104202305151417238166",
    "iMid":"TNICECP041",
    "payMethod":"04",
    "cancelType":"1",
    "cancelMsg":"Request Cancel",
    "merchantToken":"89fa33ec4c17f5048e69c404b42d07005f1dd6ab64354c583d04670cf9690ed8",
    "preauthToken":"",
    "amt":"10000",
    "cancalUserId":"admin"
}
```

JSON Response

```json
{
    "tXid": "TNICECP04104202305151417238166",
    "referenceNo": "20230515141702",
    "resultCd": "0000",
    "resultMsg": "SUCCESS",
    "transDt": "20230515",
    "transTm": "141723",
    "amt": "2000",
    "cancelReferenceNo": "CancelNo20230515141702"
}
```

Java Request

```java
//Cancel Registration//
nicePay.setTimeStamp("20230515141929");
nicePay.setiMid("TNICECP041");
nicePay.setAmt("2000");
nicePay.setMerchantToken(nicePay.makeToken(nicePay.getMerchantToken());
nicePay.settXid("TNICECP04104202305151417238166");
nicePay.setPayMethod("04");
nicePay.setCancelType("1");
nicePay.setCancelMsg("Request Cancel");
nicePay.setCancalUserId("admin");


// Request Cancel
nicePay.cancel();

// Response String //
System.out.println("Final Response String : " + nicePay.getResponseString());

String resultCd = nicePay.Get("resultCd");
String resultMsg = nicePay.Get("resultMsg");
String tXid = nicePay.Get("tXid");
String referenceNo = nicePay.Get("referenceNo");
String amt = nicePay.Get("amt");
String cancelReferenceNo = nicePay.Get("cancelReferenceNo");
```
:::

