# notifyVaulting

APO uses this API to send the vaulting result to the merchant when the vaulting processing reaches a final state of success or failure. Merchants promote merchant-side transactions based on the vaulting result.

# 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 vaulting result, such as vaulting status, result code, and result message.

##### resultCode (String, REQUIRED)

The result code. The possible result codes are listed in the **Result/Error codes** table on this page.

More information:

- Maximum length: 64 characters

##### resultStatus (String, REQUIRED)

The vaulting status. Valid values are:

-   `S`: indicates the vaulting is successful.
-   `F`: indicates the vaulting failed.

##### resultMessage (String, REQUIRED)

The result message that explains the result code.

More information:

- Maximum length: 256 characters

#### vaultingRequestId (String, REQUIRED)

The unique ID that is assigned by a merchant to identify a card vaulting request.

More information:

- Maximum length: 64 characters

#### vaultingStatus (String)

Indicates the payment method's vaulting status. Valid values are:

-   `SUCCESS`: indicates that the vaulting is successful. 
-   `FAIL`: indicates that the vaulting failed.
-   `PROCESSING`: indicates that the vaulting is under process.

> **Note**: This parameter is returned when the value of _result.resultStatus_ is `S`.

More information:

- Maximum length: 10 characters

#### paymentMethodDetail (PaymentMethodDetail, REQUIRED)

The details about the card payment method.

More information:

- Maximum length: 64 characters

##### paymentMethodType (String, REQUIRED)

The payment method type that is included in payment method options. The value of this parameter is fixed as `CARD`.

More information:

- Maximum length: 64 characters

##### card (Card)

The card information.

> **Note**: This parameter is returned when the value of _paymentMethodType_ is `CARD` and the value of _result.resultStatus_ is `S`.

###### cardToken (String)

The token of the card. The value of this parameter is used by _paymentMethodId_ in the [**pay**](https://docs.antom.com/ac/apo/pay.md) API in subsequent payments.

More information:

- Maximum length: 2048 characters

###### brand (String, REQUIRED)

The name of the card brand. See the [Card brands](https://docs.antom.com/ac/apo/payment_methods.md#ZfyuE) to check the valid values.

More information:

- Maximum length: 32 characters

###### maskedCardNo (String, REQUIRED)

The masked card number, showing only a few digits and hiding the rest.

More information:

- Maximum length: 32 characters

###### networkTransactionId (String)

The unique ID assigned by the card scheme to identify a transaction.

> **Note**: This parameter is returned when the value of _paymentMethodType_ is `CARD` and non-3D Secure authentication is successful.

More information:

- Maximum length: 256 characters

###### supportedBrands (String)

Supported card brands.

More information:

- Maximum length: 32 characters

#### acquirerInfo (AcquirerInfo)

The information of the acquirer that processes the payment.

##### acquirerName (String)

The name of the acquirer.

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)

The value is fixed as `SUCCESS`.

More information:

- Maximum length: 64 characters

##### resultStatus (String, REQUIRED)

The value is fixed as `S`.

##### resultMessage (String, REQUIRED)

The value is fixed as `success`.

More information:

- Maximum length: 256 characters

## Result process logic

Send the following message with fixed values to APO after receiving the notification, to acknowledge that the notification from APO is received:

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

If no such message is returned to APO due to operation issues or network issues, APO will intermittently send the notification until the required message is returned by the merchant. Resending of the notification will be performed within 24 hours after the first notification is sent. The notification will be resent up to eight times, with an interval of 0s, 2min, 10min, 10min, 1h, 2h, 6h, and 15h.

> **Note**: In the sandbox environment, if you do not return information in the specified format, APO will not resend asynchronous notifications to you.

## Request

```json
{
  "acquirerInfo": {
    "acquirerName": "ADYEN"
  },
  "paymentMethodDetail": {
    "card": {
      "brand": "VISA",
      "supportedBrands": [
        "VISA",
        "MASTERCARD"
      ],
      "cardToken": "ALIPAY9CGwsAeMBug+G2dSKDV6AIsNKTxAFNkOMoj8Gxvt8h0eDUbd6nO5CwMFIjEFERWxCAo/b1OjVTvtl1zspyMGcg==",
      "maskedCardNo": "************8764",
      "networkTransactionId": "xxxxx"
    },
    "paymentMethodType": "CARD"
  },
  "vaultingRequestId": "123487889889",
  "vaultingStatus": "SUCCESS",
  "result": {
    "resultCode": "SUCCESS",
    "resultMessage": "success.",
    "resultStatus": "S"
  }
}
```

## Response

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