> For the complete documentation index, see [llms.txt](https://docs.commercelayer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.commercelayer.io/how-tos/placing-orders/payments/axerve/updating-the-payment-intent.md).

# Updating the payment intent

## Problem

You have created a payment source for Axerve, but you're not sure if the order changed in the meanwhile. You want to update the payment intent with the latest order amount.

## Solution

If you want to update the payment intent amount of the Axerve payment, send a `PATCH` request to the `/api/axerve_payments/:id` endpoint, setting the `_update` attribute to `true`.

### Example

{% tabs %}
{% tab title="Request" %}
The following request updates the Axerve payment source identified by the "ZaDVpIqzeq " ID to refresh its payment intent amount:

<pre class="language-javascript"><code class="lang-javascript">curl -g -X PATCH \
  'http://yourdomain.commercelayer.io/api/axerve_payments/ZaDVpIqzeq' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "axerve_payments",
    "id": "ZaDVpIqzeq",
    "attributes": {
<strong>      "_update": true
</strong>    }
  }
}'
</code></pre>

{% endtab %}

{% tab title="Response" %}
On success, the API responds with a `200 OK` status code, returning the updated Axerve payment object:

<pre class="language-javascript"><code class="lang-javascript">{
  "data": {
    "id": "ZaDVpIqzeq",
    "type": "axerve_payments",
    "links": {
      "self": "https://yourdomain.commercelayer.io/api/axerve_payments/ZaDVpIqzeq"
    },
    "attributes": {
      "return_url": "https://checkout.yourdomain.com/jNbQLhMeqo/axerve",
      "payment_request_data": {
        "paymentID": "1223321",
        "paymentToken": "Asjdlfad5543AA33a",
        "userRedirect":{"href":""},
        "intent_amount_cents":2000
      },
      "mismatched_amounts": false,
<strong>      "intent_amount_cents": 2500,
</strong><strong>      "intent_amount_float" :25.0,
</strong><strong>      "formatted_intent_amount": "€25,00",
</strong>      "payment_instrument":{...},
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": null,
      "reference_origin": null,
      "metadata": {}
    },
    "relationships": {
      "order": {
        "links": {
          "self": "https://yourdomain.commercelayer.io/api/axerve_payments/ZaDVpIqzeq/relationships/order",
          "related": "https://yourdomain.commercelayer.io/api/axerve_payments/ZaDVpIqzeq/order"
        }
      }
    },
    "meta": {
      "mode": "test",
      "organization_id": "Pq4rStUvWx",
      "trace_id": "6d9e2f5a8b1c4d7e0f3a6b9c2d5e8f1a4b7c0d3e6f9a2b5c8d1e4f7a0b3c6d9e2"
    }
  },
  "meta": {
    "mode": "test",
    "organization_id": "Pq4rStUvWx",
    "trace_id": "6d9e2f5a8b1c4d7e0f3a6b9c2d5e8f1a4b7c0d3e6f9a2b5c8d1e4f7a0b3c6d9e2"
  }
}
</code></pre>

{% endtab %}
{% endtabs %}

## More to read

See our documentation if you need more information on how to [update an Axerve payment](broken://spaces/RWJeylueWkzLadK710XZ/pages/ZQdRuM7tqSuciI8nS4BU).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.commercelayer.io/how-tos/placing-orders/payments/axerve/updating-the-payment-intent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
