# notifyCapture

`POST /undefined`

This API is used by APO to send the capture result to the merchant when the capture processing reaches a final state of success or failure.  

# Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see： 

-   [Request header](https://docs.antom.com/ac/ams/api_fund.md#ML5ur)
-   [Response header](https://docs.antom.com/ac/ams/api_fund.md#WWH90)

> **Note**: Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:
>
> -   If the data type of a field is Integer and its value is `20`, set it as "`20`". 
> -   If the data type of a field is Boolean and its value is `true`, set it as "`true`".

## Request parameters

#### result (Result, REQUIRED)

Details about the payment capture result, such as capture status, result code, and result message.

##### resultCode (String, REQUIRED)

The result code that indicates the detailed processing result.

More information:

- Maximum length: 64 characters

##### resultStatus (String, REQUIRED)

The capture status. Valid values are:

-   `S`: Indicates that the capture status is successful.
-   `F`: Indicates that the capture status is failed.

##### resultMessage (String)

The result message that describes the result code in detail.

More information:

- Maximum length: 256 characters

#### notifyType (String, REQUIRED)

The type of notification. The notification type of this API is `CAPTURE_RESULT`.

#### captureRequestId (String, REQUIRED)

The unique ID that is assigned by the merchant to identify a capture request.

More information:

- Maximum length: 64 characters

#### paymentId (String, REQUIRED)

The unique ID that is assigned by APO to identify a payment.

More information:

- Maximum length: 64 characters

#### captureId (String, REQUIRED)

The unique ID assigned by APO to identify a capture.

More information:

- Maximum length: 64 characters

#### captureAmount (Amount, REQUIRED)

The capture amount that the merchant requests to receive in the transaction currency.

##### currency (String, REQUIRED)

The 3-letter currency code that follows the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard.

More information:

- Maximum length: 3 characters

##### value (Integer, REQUIRED)

The amount to charge as a positive integer in the smallest currency unit. (That is, 100 cents to charge $1.00, or 100 to charge JPY 100, a 0-decimal currency).

For details about the smallest currency unit, see [Smallest unit of the currency](https://docs.antom.com/ac/ref/cc.md#ONkIe).

More information:

- Value range: 1 - unlimited

#### captureTime (Datetime)

The time when APO captures the payment.

#### acquirerInfo (AcquirerInfo)

The information of the acquirer that processes the payment.

##### acquirerName (String)

The name of the acquirer.

More information:

- Maximum length: 64 characters

##### referenceRequestId (String)

The unique ID that is assigned by APO to identify a payment request sent to the acquirer.

More information:

- Maximum length: 64 characters

##### acquirerMerchantId (String)

The unique ID that is assigned by the acquirer to identify a merchant.

More information:

- Maximum length: 64 characters

##### acquirerTransactionId (String)

The unique ID that is assigned by the acquirer to identify a transaction.

More information:

- Maximum length: 64 characters

##### acquirerResultCode (String)

The acquirer's result code that indicates the transaction process result.

More information:

- Maximum length: 64 characters

##### acquirerResultMessage (String)

The result message that describes _acquirerResultCode_ in detail.

More information:

- Maximum length: 64 characters

## Response parameters

#### result (Result, REQUIRED)

A fixed value, which is sent to APO to acknowledge that the notification is received.

##### resultCode (String, REQUIRED)

Result code. The value is fixed as `SUCCESS`.

More information:

- Maximum length: 64 characters

##### resultStatus (String, REQUIRED)

Result status. The value is fixed as `S`, which means the notification is received successfully.

##### resultMessage (String, REQUIRED)

Result message that explains the result code. The value is fixed as `success`.

More information:

- Maximum length: 256 characters

## Result/Error codes

| Code | Value | Message | Further action |
| --- | --- | --- | --- |
| SUCCESS | S | Success | The capture is successful, no further action is needed. |
| ACCESS_DENIED | F | The access is denied.  | Contact APO Technical Support for detailed reasons. |
| AUTH_CANCELLED | F | The payment authorization is canceled.  | Use a new paymentRequestId to initiate a payment. |
| AUTH_EXPIRED | F | The payment authorization is expired.  | Use a new paymentRequestId to initiate a payment. |
| AUTH_NOT_FOUND | F | The payment authorization is not found.  | Contact APO Technical Support for detailed reasons. |
| CAPTURE_AMOUNT_EXCEED_AUTH_LIMIT | F | The total capture amount exceeds the limit of the authorized payment amount. | Create a new capture request by using an amount less than or equal to the authorized payment amount, or contact APO Technical Support. |
| CAPTURE_IN_PROCESS | U | The capture is processing.  | Wait for the notification from APO or inquiry about the capture result. |
| CURRENCY_NOT_SUPPORT | F | The currency is not supported. | Check the currency used in the request, such as the capture currency. If the issue persists, contact APO Technical Support for detailed reasons. |
| INVALID_CONTRACT | F | The parameter values in the contract do not match those in the current transaction.  | Check whether the parameter values in the contract match those in the current transaction. If the values match, contact APO Technical Support to troubleshoot the issue. |
| MULTI_CAPTURE_NOT_SUPPORTED | F | The transaction does not support multiple captures.  | Contact APO Technical Support for detailed reasons. |
| NO_PAY_OPTIONS | F | No payment methods are available. | Contact APO Technical Support for detailed reasons. |
| ORDER_IS_CANCELED | F | The transaction is canceled. | Use a new paymentRequestId to initiate a payment. |
| ORDER_STATUS_INVALID | F | The transaction status is abnormal. The payment cannot be captured.  | Check the transaction status.  If the values match, contact APO Technical Support to troubleshoot the issue. |
| PARAM_ILLEGAL | F | The required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong. | Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid. |
| PAYMENT_COUNT_EXCEED_LIMIT | F | The number of captures exceeds the limit that is specified by the payment method. | Contact APO Technical Support to know the specific limit. |
| PROCESS_FAIL | F | The capture failed. | Do not retry. Human intervention is usually needed. It is recommended that you contact APO Technical Support to troubleshoot the issue. |
| REPEAT_REQ_INCONSISTENT | F | The submitted request exists, and the parameter values of this request are not consistent with those of the existing request.  | Ensure all the fields in the requests are the same or use a new paymentRequestId to initiate a payment. |
| RISK_REJECT | F | The request is rejected because of risk control. | Prompt the user that the request is rejected because of failed risk control. |
| USER_AMOUNT_EXCEED_LIMIT | F | The capture amount exceeds the user payment limit.  | Create a new capture by using an amount less than or equal to the buyer payment limit, or contact the user or the issuing bank. |
| USER_BALANCE_NOT_ENOUGH | F | The user's balance is insufficient for the capture. | Contact APO Technical Support for detailed reasons. |
| USER_NOT_EXIST | F | The user's account does not exist on the payment method side.  | Contact the user or the issuing bank. |
| USER_STATUS_ABNORMAL | F | The user's account status is abnormal on the payment method side.  | Contact APO Technical Support to know the specific reasons. |
| UNKNOWN_EXCEPTION | U | The API call has failed, which is caused by unknown reasons. | Call the API again to resolve the issue. If the problem persists, contact APO Technical Support. |

## Request

### CAPTURE_SUCCESSFUL

```json
{
  "captureAmount": {
    "currency": "BRL",
    "value": "50000"
  },
  "notifyType": "CAPTURE_RESULT",
  "captureId": "2022XXXXXXX",
  "captureRequestId": "Merchant_Request_ID_XXXXXX",
  "captureTime": "2022-11-10T00:34:52-08:00",
  "paymentId": "2022XXXXXXX",
  "result": {
    "resultCode": "SUCCESS",
    "resultMessage": "success.",
    "resultStatus": "S"
  }
}
```

### CAPTURE_FAILED

```json
{
  "captureAmount": {
    "currency": "BRL",
    "value": "50000"
  },
  "notifyType": "CAPTURE_RESULT",
  "captureId": "2022XXXXXXX",
  "captureRequestId": "Merchant_Request_ID_XXXXXX",
  "captureTime": "2022-11-10T00:34:52-08:00",
  "paymentId": "2022XXXXXXX",
  "result": {
    "resultCode": "PROCESS_FAIL",
    "resultMessage": "General bussinsee failure. No retry.",
    "resultStatus": "F"
  }
}
```

## Response

```json
{
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "Success"
  }
}
```