---
title: Cancel - API Paylater
slug: en/nicepay-api-non-snap-cancel-api-paylater
description: Information about Non-SNAP Payment API - Cancel - Paylater API available on NICEPAY system
image: https://archbee-image-uploads.s3.amazonaws.com/ZHvSjR5ZrsoxwKbJa3xmo/9HlvQxo9Lw69DohlH_iAy_nicepay-docs-logo.png
icon: {"faIcon":"fa-solid fa-book"}
docTags: 
createdAt: 2022-12-01T07:53:04.000Z
---

# About API Paylater Cancel

***

This API uses to cancel a transaction that has been paid. If the transaction cancels before the settlement process is complete, the transaction is considered void, and the transaction funds will return to the Customer.



# API Paylater Cancel

***

The Paylater Cancel API uses for the cancel system for payments via Paylater.

| **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`) |



# Payment Methods Available for Cancel

***

**Code              PayMethod**

***

`01`               Credit Card

***

`02`               Virtual Account

***

`03`               Convenience Store&#x20;

***

`04`               Direct Debit&#x20;

***

`05`               E-Wallet&#x20;

***

`06`               <font color="#2166ae">**Paylater**</font>****

***

`08`               QRIS&#x20;

***

`09`               GPN

***



## Request Parameters for Paylater Cancel

***

The following is a list of parameters for requesting integration of the cancel payment process on the Paylater payment method. These parameters are used via the API testing platform. &#x20;

| **Parameter**                                              | **Type** | **Size** | **Description**                                                                               | **Example / Notes**                                              |
| ---------------------------------------------------------- | -------- | -------- | --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| `timeStamp`<br /><font color="#2166ae">Required</font>     | N        | 14       | API Request Timestamp <font color="#2166ae"></font>                                          | 20221213141266                                                   |
| `tXid`<br /><font color="#2166ae">Required</font>          | AN       | 30       | Transaction ID<br /><font color="#2166ae"></font>&#xD;                                       | PAYLOANTES00202212131410560896                                   |
| `iMid`<br /><font color="#2166ae">Required</font>          | AN       | 10       | Merchant ID<br /><font color="#2166ae"></font>&#xD;                                          | PAYLOANTES                                                       |
| `payMethod`<br /><font color="#2166ae">Required</font>     | N        | 2        | [Payment Method Code](docId\:NQ1y7vMa25ZtvQHN5He6W) <br /><font color="#2166ae"></font>&#xD; | 06                                                               |
| `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>                                           | 9d1835e8bf87b51b44de9b2455fa37e733a87b12644b9cd4546e2ec2de651863 |
| `amt`<br /><font color="#2166ae">Required</font>           | N        | 12       | Payment Amount <br /><font color="#2166ae"></font>&#xD;                                      | 12000                                                            |
| `cancelUserId`                                             | AN       | 30       | User ID&#xD;<br />&#xD;                                                                       | admin&#xD;                                                       |



## Response Parameter for Paylater Cancel

***

Following are the response parameters from the results of the request parameters for canceling Paylater handling:

| **Parameter** | **Type** | **Size** | **Description**                                             | **Example/Notes**              |
| ------------- | -------- | -------- | ----------------------------------------------------------- | ------------------------------ |
| `tXid`        | AN       | 30       | Transaction ID&#xD;                                         | PAYLOANTES00202212131410560896 |
| `referenceNo` | ANS      | 40       | Merchant Order Number&#xD;                                  | ord20200910170911              |
| `transDt`     | N        | 8        | Transaction Date&#xD;                                       | 20221213&#xD;                  |
| `transTm`     | N        | 6        | Transaction Time                                            | 141056&#xD;                    |
| `amt`         | N        | 12       | Amount                                                      | 12000&#xD;                     |
| `resultCd`    | N        | 4        | [Result Code](docId:9eC3yH9CQqpb6cRWauWWO)                  | 0000                           |
| `resultMsg`   | AN       | 255      | Result Message:  [Error Code](docId\:FsX1GESJKxOp0T9rvUHp_) | SUCCESS                        |



## Sample JSON for Paylater Cancel

***

:::CodeblockTabs
JSON Request

```json
{
	"timeStamp":"20221213141266",
	"tXid":"PAYLOANTES00202212131410560896",
	"iMid":"PAYLOANTES",
	"payMethod":"06",
	"cancelType":"1",
	"cancelMsg":"Request Cancel",
	"merchantToken":"9d1835e8bf87b51b44de9b2455fa37e733a87b12644b9cd4546e2ec2de651863",
	"amt":"12000",
    "cancelUserId":"admin"
}
```

JSON Response

```json
{
    "tXid": "PAYLOANTES00202212131410560896",
    "referenceNo": "ord20200910170911",
    "resultCd": "0000",
    "resultMsg": "SUCCESS",
    "transDt": "20221213",
    "transTm": "141056",
    "amt": "12000"
}
```

Java Request

```json
//Cancel Registration//
nicePay.setTimeStamp("20221213141266");
nicePay.setiMid("PAYLOANTES");
nicePay.setAmt("12000");
nicePay.setMerchantToken(nicePay.makeToken(nicePay.getMerchantToken());
nicePay.settXid("PAYLOANTES00202212131410560896");
nicePay.setPayMethod("06");
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");
```
:::

