> For the complete documentation index, see [llms.txt](https://developer.posapi.zmyle.de/-M76-W8oGLXivvOpYcAe/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.posapi.zmyle.de/-M76-W8oGLXivvOpYcAe/core-resources/transactionintents/update-a-transaction-intent.md).

# Update a Transaction Intent

## Update a Transaction Intent

<mark style="color:yellow;">`POST`</mark> `/service/v1.1/transaction_intents/:intentId`

You can update a transaction intent as long as it has the  `"NEEDS_CONFIRMATION"` status. This endpoint will always consider all possible body parameters. For example: if you provided metadata when creating the gift card, and you want to keep this metadata even after this update, then you must resubmit the metadata. Omitting the metadata will delete any previously attached metadata. The values as provided in an update represent the ultimate values in the transaction intent.

#### Path Parameters

| Name     | Type   | Description                          |
| -------- | ------ | ------------------------------------ |
| intentId | string | Unique ID of the transaction intent. |

#### Request Body

| Name     | Type    | Description                                                                                                                                                           |
| -------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| amount   | integer | Updated amount that you want to redeem. You must provide this value, even if you don't actually change it.                                                            |
| metadata | object  | A set of key-value pairs that you can attach to this transaction intent. Omitting this value will delete any previously attached metadata in this transaction intent. |

{% tabs %}
{% tab title="200 The transaction intent, updated." %}

```javascript
{
    "expiresAt": "20171127T052256Z",
    "statementDescriptor": "MegaStore",
    "retailerId": "15h3k83g45anfnwibyie",
    "amount": 200,
    "giftcardId": "18jja4mf08fn08f7gp9l",
    "id": "18k78hj3e2j65686vhipw560u6sm",
    "status": "NEEDS_CONFIRMATION",
    "createdAt": "20171127T045256Z",
    "currency": "EUR",
    "metadata": {
        "store": "megastore-filiale-holzweg",
        "receiptNumber": "Bon 2017-79732"
    }
}
```

{% endtab %}
{% endtabs %}

### Example Request

{% tabs %}
{% tab title="cURL" %}

```
curl -X POST https://posapi.zmyledemo.de/service/v1.1/transaction_intents/18k78hj3e2j65686vhipw560u6sm \
  -u {api_key}:{api_secret}
  -d '{"amount": 200,"metadata": {"store": "megastore-filiale-holzweg","receiptNumber": "Bon 2017-79730"}}'

```

{% endtab %}
{% endtabs %}

### Error Response Codes

| error code                      | reason                                                                           |
| ------------------------------- | -------------------------------------------------------------------------------- |
| api:io:missingRequiredParam     | A required parameter is missing.                                                 |
| api:io:malformedId              | The transaction intent ID is not right.                                          |
| api:io:negativeNumber           | The amount is not a positive integer.                                            |
| api:io:malformedNumber          | The amount is not a positive integer.                                            |
| api:biz:noSuchTransactionIntent | The API could not find the transaction intent.                                   |
| api:biz:transactionIntentStatus | This transaction intent cannot be updated b/c its status does not allow updates. |
| api:biz:insufficientFunds       | The amount you provided exceeds the available balance of the gift card.          |
