Update payment

Payments API v2
PATCHhttps://api.mollie.com/v2/payments/*id*

This endpoint can be used to update some details of a created payment.

Parameters

For a more in-depth explanation of each parameter, see the Create payment. There are also payment method-specific parameters available, see below.

descriptionstringoptional
The description of the payment. The maximum length of the description field differs per payment method, with the absolute maximum being 255 characters. The API will not reject strings longer than the maximum length but it will truncate them to fit.
redirectUrlstringoptional

The URL your customer will be redirected to after the payment process.

Updating this field is only possible when the payment is not yet finalized.

cancelUrlstringoptional

The URL your consumer will be redirected to when the consumer explicitly cancels the payment. If this URL is not provided, the consumer will be redirected to the redirectUrl instead — see above.

Updating this field is only possible when the payment is not yet finalized.

webhookUrlstringoptional
Set the webhook URL, where we will send payment status updates to.
metadatamixedoptional
Provide any data you like, for example a string or a JSON object. We will save the data alongside the payment. Whenever you fetch the payment with our API, we will also include the metadata. You can use up to approximately 1kB.
methodstringoptional

Change the payment to a different payment method.

Updating this field is only possible when the payment was created without a payment method and is not yet finalized.

localestringoptional
Allows you to update the language to be used in the hosted payment pages shown to the consumer. Can be any xx_XX format ISO 15897 locale.
restrictPaymentMethodsToCountrystringoptional

Payment method-specific parameters

If you specify the method parameter, optional parameters may be available for the payment method. If no method is specified, you can still send the optional parameters and we will apply them when the consumer selects the relevant payment method.

Bank transfer

billingEmailstringoptional
Consumer’s email address.
dueDatestringoptional

The date the payment should expire, in YYYY-MM-DD format.

Updating this field is only possible when the payment is not yet finalized.

Gift cards

issuerstringoptional

See Payments API.

Updating this field is only possible when the payment is not yet finalized.

iDEAL

issuerstringoptional

See Payments API.

Updating this field is only possible when the payment is not yet finalized.

KBC/CBC Payment Button

issuerstringoptional

See Payments API.

Updating this field is only possible when the payment is not yet finalized.

Przelewy24

billingEmailstringoptional
Consumer’s email address.

Response

200 application/hal+json

A payment object is returned, as described in Get payment.

Example

cURLPHPPythonRubyNode.js
1
2
3
4
5
6
curl -X PATCH https://api.mollie.com/v2/payments/tr_7UhSN1zuXS \
   -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" \
   -d "description=Order #98765" \
   -d "redirectUrl=https://example.org/webshop/order/98765/" \
   -d "webhookUrl=https://example.org/webshop/payments/webhook/" \
   -d "metadata={\"order_id\": \"98765\"}"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<?php
$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");

$paymentId = "tr_7UhSN1zuXS";
$mollie->payments->update($paymentId, [
  "description" => "Order #98765",
  "redirectUrl" => "https://example.org/webshop/order/98765/",
  "webhookUrl" => "https://example.org/webshop/payments/webhook/",
  "metadata" => ["order_id" => "98765"],
]);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from mollie.api.client import Client

mollie_client = Client()
mollie_client.set_api_key("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM")

payment = mollie_client.payments.update("tr_7UhSN1zuXS", {
    "description": "Order #98765",
    "webhookUrl": "https://webshop.example.org/order/98765/",
    "redirectUrl": "https://webshop.example.org/payments/webhook/",
    "metadata": {
        "order_id": "98765",
    }
})
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
require 'mollie-api-ruby'

Mollie::Client.configure do |config|
  config.api_key = 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
end

payment = Mollie::Payment.update(
  'tr_7UhSN1zuXS',
  description: 'Order #98765',
  redirect_url: 'https://example.org/webshop/order/98765/',
  webhook_url: 'https://example.org/webshop/payments/webhook/',
  metadata: {
    order_id: '98765'
  }
)
1
2
3
4
We don't have a Node.js code example for this API call yet.

If you have some time to spare, feel free to share suggestions on our Discord:
https://discord.gg/VaTVkXB4aQ

Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
HTTP/1.1 200 OK
Content-Type: application/hal+json

{
    "resource": "payment",
    "id": "tr_7UhSN1zuXS",
    "mode": "test",
    "createdAt": "2018-03-20T09:13:37+00:00",
    "amount": {
        "value": "10.00",
        "currency": "EUR"
    },
    "description": "Order #98765",
    "method": null,
    "metadata": {
        "order_id": "98765"
    },
    "status": "open",
    "isCancelable": false,
    "expiresAt": "2018-03-20T09:28:37+00:00",
    "details": null,
    "profileId": "pfl_QkEhN94Ba",
    "sequenceType": "oneoff",
    "redirectUrl": "https://example.org/webshop/order/98765/",
    "webhookUrl": "https://example.org/webshop/payments/webhook/",
    "_links": {
        "self": {
            "href": "https://api.mollie.com/v2/payments/tr_7UhSN1zuXS",
            "type": "application/json"
        },
        "checkout": {
            "href": "https://www.mollie.com/payscreen/select-method/7UhSN1zuXS",
            "type": "text/html"
        },
        "dashboard": {
            "href": "https://www.mollie.com/dashboard/org_12345678/payments/tr_7UhSN1zuXS",
            "type": "text/html"
        },
        "documentation": {
            "href": "https://docs.mollie.com/reference/v2/payments-api/update-payment",
            "type": "text/html"
        }
    }
}