Update order¶
PATCH
https://api.mollie.com/v2/orders/*id*
This endpoint can be used to update the billing and/or shipping address of an order.
When updating an order that uses a Klarna payment method, Klarna may decline the requested changes, resulting in an error response from the Mollie API. The order remains intact, though the requested changes are not persisted.
Parameters¶
Replace id
in the endpoint URL by the order’s ID, for example ord_8wmqcHMN4U
.
Even though all parameters are optional, at least one of them needs to be provided in the request.
billingAddress
address objectoptionalThe billing person and address for the order.
Note that the billing address is updated in the Mollie API only. If the update operation is supported by the supplier, it will be updated there as well.
Refer to the documentation of the address object for more information on which formats are accepted.
organizationName
stringoptionaltitle
stringoptionalgivenName
stringrequiredfamilyName
stringrequiredemail
stringrequiredphone
phone numberoptional+31208202070
.streetAndNumber
stringrequiredstreetAdditional
stringoptionalpostalCode
stringconditionalcountry
has a postal code system.city
stringrequiredregion
stringoptionalcountry
stringrequiredshippingAddress
address objectoptionalThe shipping address for the order.
This field is optional, but if it is provided, then the full name and address have to be in a valid format. Refer to the documentation of the address object for more information on which formats are accepted.
organizationName
stringoptionaltitle
stringoptionalgivenName
stringrequiredfamilyName
stringrequiredemail
stringrequiredphone
phone numberoptional+31208202070
.streetAndNumber
stringrequiredstreetAdditional
stringoptionalpostalCode
stringconditionalcountry
has a postal code system.city
stringrequiredregion
stringoptionalcountry
stringrequiredorderNumber
stringoptionalThe order number. For example, 16738
.
We recommend that each order should have a unique order number.
redirectUrl
stringoptionalThe URL your customer will be redirected to after the payment process.
Updating this field is only possible when the payment is not yet finalized.
cancelUrl
stringoptionalThe URL your consumer will be redirected to when the consumer explicitly cancels the order. 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.
webhookUrl
stringoptionalSet the webhook URL, where we will send order status changes to.
The webhookUrl
must be reachable from Mollie’s point of view, so you cannot use localhost
. If you want to use
webhook during development on localhost
, you should use a tool like
ngrok to have the webhooks delivered
to your local machine.
Access token parameters¶
If you are using organization access tokens or are creating an
OAuth app, you can enable test mode through the testmode
parameter.
true
to update a test mode order.Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | curl -X PATCH https://api.mollie.com/v2/orders/ord_kEn1PlbGa \ -H "Content-Type: application/json" \ -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" \ -d '{ "billingAddress": { "organizationName": "Mollie B.V.", "streetAndNumber": "Keizersgracht 126", "city": "Amsterdam", "region": "Noord-Holland", "postalCode": "1234AB", "country": "NL", "title": "Dhr", "givenName": "Piet", "familyName": "Mondriaan", "email": "piet@mondriaan.com", "phone": "+31208202070" } }' |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <?php $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"); $orderId = "ord_kEn1PlbGa"; $order = $mollie->orders->update($orderId, [ "billingAddress" => [ "organizationName" => "Mollie B.V.", "streetAndNumber" => "Keizersgracht 126", "city" => "Amsterdam", "region" => "Noord-Holland", "postalCode" => "1234AB", "country" => "NL", "title" => "Dhr", "givenName" => "Piet", "familyName" => "Mondriaan", "email" => "piet@mondriaan.com", "phone" => "+31208202070", ], ]); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | mollie_client = Client() mollie_client.set_api_key("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM") mollie_client.order.update("ord_kEn1PlbGa", { "billingAddress": { "organizationName": "Mollie B.V.", "streetAndNumber": "Keizersgracht 126", "city": "Amsterdam", "region": "Noord-Holland", "postalCode": "1234AB", "country": "NL", "title": "Dhr", "givenName": "Piet", "familyName": "Mondriaan", "email": "piet@mondriaan.com", "phone": "+31208202070", } }) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | require 'mollie-api-ruby' Mollie::Client.configure do |config| config.api_key = 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' end order = Mollie::Order.update( 'ord_kEn1PlbGa', billing_address: { organizationName: 'Mollie B.V.', streetAndNumber: 'Keizersgracht 126', city: 'Amsterdam', region: 'Noord-Holland', postalCode: '1234AB', country: 'NL', title: 'Dhr', givenName: 'Piet', familyName: 'Mondriaan', email: 'piet@mondriaan.com', phone: '+31208202070' } ) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | const { createMollieClient } = require('@mollie/api-client'); const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' }); const order = await mollieClient.orders.update('ord_kEn1PlbGa', { billingAddress: { organizationName: 'Mollie B.V.', streetAndNumber: 'Keizersgracht 126', city: 'Amsterdam', region: 'Noord-Holland', postalCode: '1234AB', country: 'NL', title: 'Dhr', givenName: 'Piet', familyName: 'Mondriaan', email: 'piet@mondriaan.com', phone: '+31208202070' } }); |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | HTTP/1.1 200 OK Content-Type: application/hal+json { "resource": "order", "id": "ord_kEn1PlbGa", "profileId": "pfl_URR55HPMGx", "method": "ideal", "amount": { "value": "1027.99", "currency": "EUR" }, "status": "created", "isCancelable": true, "metadata": null, "createdAt": "2018-08-02T09:29:56+00:00", "expiresAt": "2018-08-30T09:29:56+00:00", "mode": "live", "locale": "nl_NL", "billingAddress": { "organizationName": "Mollie B.V.", "streetAndNumber": "Keizersgracht 126", "city": "Amsterdam", "region": "Noord-Holland", "postalCode": "1234AB", "country": "NL", "title": "Dhr", "givenName": "Piet", "familyName": "Mondriaan", "email": "piet@mondriaan.com", "phone": "+31208202070" }, "orderNumber": "18475", "shippingAddress": { "organizationName": "Mollie B.V.", "streetAndNumber": "Keizersgracht 126", "postalCode": "1015 CW", "city": "Amsterdam", "country": "nl", "givenName": "Luke", "familyName": "Skywalker", "email": "luke@skywalker.com" }, "redirectUrl": "https://example.org/redirect", "lines": [ { "resource": "orderline", "id": "odl_dgtxyl", "orderId": "ord_pbjz8x", "name": "LEGO 42083 Bugatti Chiron", "sku": "5702016116977", "type": "physical", "status": "created", "metadata": null, "isCancelable": false, "quantity": 2, "quantityShipped": 0, "amountShipped": { "value": "0.00", "currency": "EUR" }, "quantityRefunded": 0, "amountRefunded": { "value": "0.00", "currency": "EUR" }, "quantityCanceled": 0, "amountCanceled": { "value": "0.00", "currency": "EUR" }, "shippableQuantity": 0, "refundableQuantity": 0, "cancelableQuantity": 0, "unitPrice": { "value": "399.00", "currency": "EUR" }, "vatRate": "21.00", "vatAmount": { "value": "121.14", "currency": "EUR" }, "discountAmount": { "value": "100.00", "currency": "EUR" }, "totalAmount": { "value": "698.00", "currency": "EUR" }, "createdAt": "2018-08-02T09:29:56+00:00", "_links": { "productUrl": { "href": "https://shop.lego.com/nl-NL/Bugatti-Chiron-42083", "type": "text/html" }, "imageUrl": { "href": "https://sh-s7-live-s.legocdn.com/is/image//LEGO/42083_alt1?$main$", "type": "text/html" } } }, { "resource": "orderline", "id": "odl_jp31jz", "orderId": "ord_pbjz8x", "name": "LEGO 42056 Porsche 911 GT3 RS", "sku": "5702015594028", "type": "physical", "status": "created", "metadata": null, "isCancelable": false, "quantity": 1, "quantityShipped": 0, "amountShipped": { "value": "0.00", "currency": "EUR" }, "quantityRefunded": 0, "amountRefunded": { "value": "0.00", "currency": "EUR" }, "quantityCanceled": 0, "amountCanceled": { "value": "0.00", "currency": "EUR" }, "shippableQuantity": 0, "refundableQuantity": 0, "cancelableQuantity": 0, "unitPrice": { "value": "329.99", "currency": "EUR" }, "vatRate": "21.00", "vatAmount": { "value": "57.27", "currency": "EUR" }, "totalAmount": { "value": "329.99", "currency": "EUR" }, "createdAt": "2018-08-02T09:29:56+00:00", "_links": { "productUrl": { "href": "https://shop.lego.com/nl-NL/Porsche-911-GT3-RS-42056", "type": "text/html" }, "imageUrl": { "href": "https://sh-s7-live-s.legocdn.com/is/image/LEGO/42056?$PDPDefault$", "type": "text/html" } } } ], "_links": { "self": { "href": "https://api.mollie.com/v2/orders/ord_pbjz8x", "type": "application/hal+json" }, "checkout": { "href": "https://www.mollie.com/payscreen/order/checkout/pbjz8x", "type": "text/html" }, "dashboard": { "href": "https://www.mollie.com/dashboard/org_123456789/orders/ord_pbjz8x", "type": "text/html" }, "documentation": { "href": "https://docs.mollie.com/reference/v2/orders-api/get-order", "type": "text/html" } } } |