---
title: "Payment Method Data"
description: "Add, obtain, and remove additional payment method specific data."
canonical: "https://docs.cm.com/payments/online-payments-legacy/guides/api-reference/resources/payment-method-data"
---

# Payment Method Data

> Add, obtain, and remove additional payment method specific data.

Source: https://docs.cm.com/payments/online-payments-legacy/guides/api-reference/resources/payment-method-data

Add, obtain, and remove additional payment method specific data.

This additional data is only relevant for some payment methods and in specific use cases:

- KLARNA: For more details see [Klarna](https://docs.cm.com/payments/online-payments-legacy/guides/api-reference/payment-method-details/klarna).

## Add Additional Payment Method Data

Adds additional payment method specific data to an Order. Additional data cannot be added after a payment has been started.

```
POST /ps/api/public/v1/merchants/{merchant_key}/orders/{order_key}/additional_data
```

**Identifiers**

| Name | Type | Description |
| - | - | - |
| merchant\_key | MerchantKey | The key of the merchant. |
| order\_key | OrderKey | The key of the order. |

**Parameters**

_Not applicable._

**Request**

| Field | Type | M | Description |
| - | - | :-: | - |
| method | PaymentMethod | M | The name of a payment method, e.g. KLARNA. |
| data | String(1, 4000) | M | The additional data as a JSON-object as string with double quotes escaped. |

An example of the encoded data is

```
"{ \"field_one\": \"value\", \"field_two\" : { \"sub_field\" : \"subValue\"}"
```

**Supported payment methods**

```
KLARNA
```

**Response**

_Not response._

**HTTP Status**

| Status | Meaning |
| - | - |
| 201 (Created | The data is successfully added. |
| 400 (Bad Request) | The request was not valid. The JSON-data is incorrect, an invalid payment method given, order key not found or the payment was already done for the order. |
| 401 (Unauthorized) | Authorization header missing or invalid. |
| 403 (Forbidden) | The merchant account is not allowed to perform this operation. |
| 404 (Not Found) | The order was not found. |

**Add Additional Data example**

Command line:

```bash
> curl \
    -X POST \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/orders/F1499C097FFA533D46FB05D52680AB9A/additional_data \
    -d '{
          "method": "KLARNA",
          "data": "{\"some_info\": \"Some text information\"}"
        }'
 
< Http 201 Created
```

## Returns Additional Payment Method Data

Returns the additional payment method specific data associated with an Order. The result is an array of additional data per payment method for the given Order key.

```
GET /ps/api/public/v1/merchants/{merchant_key}/orders/{order_key}/additional_data
```

**Identifiers**

| Name | Type | Description |
| - | - | - |
| merchant\_key | MerchantKey | The key of the merchant. |
| order\_key | OrderKey | The key of the order. |

**Parameters**

_Not applicable._

**Request**

_Not applicable._

**Response**

Array of:

| Field | Type | M | Description |
| - | - | :-: | - |
| method | PaymentMethod | M | The name of a payment method, e.g. KLARNA. |
| data | String(1, 4000) | M | The additional data as a JSON-object as string with double quotes escaped. |

**HTTP Status**

| Status | Meaning |
| - | - |
| 200 (OK) | Success. |
| 400 (Bad Request) | In valid request. If the order key not found. |
| 401 (Unauthorized) | Authorization header missing or invalid. |
| 403 (Forbidden) | The merchant account is not allowed to perform this operation. |
| 404 (not found) | The order was not found. |

**Get Additional Data example**

Command line:

```bash
> curl \
    -X GET \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/orders/F1499C097FFA533D46FB05D52680AB9A/additional_data
 
< Http 200 Ok
<   '[
        {
            "method": "KLARNA",
            "data": "{\"some_info\": \"Some text information\"}"
        }
    ]'
```

## Deletes Additional Payment Method Data

Deletes the additional payment method specific data from an Order. The additional data cannot be deleted after payments are started.

The deletion can be done either by specifying payment method or not. If the payment method is not specified then the additional data for all payment methods is deleted from the Order.

```
DELETE /ps/api/public/v1/merchants/{merchant_key}/orders/{order_key}/additional_data
DELETE /ps/api/public/v1/merchants/{merchant_key}/orders/{order_key}/additional_data/{method}
```

**Identifiers**

| Name | Type | Description |
| - | - | - |
| merchant\_key | MerchantKey | The key of the merchant. |
| order\_key | OrderKey | The key of the order. |
| method | PaymentMethod | The name of a payment method, e.g. KLARNA. (Optional) |

**Parameters**

_Not applicable._

**Request**

_Not applicable._

**Response**

_Not response._

**HTTP Status**

| Status | Meaning |
| - | - |
| 200 (OK) | Success. |
| 400 (Bad Request) | In valid request, an invalid payment method given, order key not found or the payment was already done for the order. |
| 401 (Unauthorized) | Authorization header missing or invalid. |
| 403 (Forbidden) | The merchant account is not allowed to perform this operation. |
| 404 (not found) | The order was not found. |

**Delete Additional Data for payment method example**

Command line:

```bash
> curl \
    -X DELETE \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/orders/F1499C097FFA533D46FB05D52680AB9A/additional_data/KLARNA
 
< Http 200 Ok
```

**Delete All Additional Data example**

Command line:

```bash
> curl \
    -X DELETE \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://testsecure.docdatapayments.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/orders/F1499C097FFA533D46FB05D52680AB9A/additional_data
 
< Http 200 Ok
```
