Cancel order¶
Orders API v2
DELETE
https://api.mollie.com/v2/orders/*id*
Authentication:API keysOrganization access tokensApp access tokens
The order can only be canceled while:
- the order doesn’t have any open payments except for the methods
banktransfer
,directdebit
,klarnapaylater
,klarnapaynow
, andklarnasliceit
. - the order’s
status
field is eithercreated
,authorized
orshipping
[1].
- In case of
created
, all order lines will be canceled and the new order status will becanceled
. - In case of
authorized
, the authorization will be released, all order lines will be canceled and the new order status will becanceled
. - In case of
shipping
, any order lines that are stillauthorized
will be canceled and order lines that areshipping
will be completed. The new order status will becompleted
.
For more information about the status transitions, check our order status changes guide.
[1] | If the order status is shipping , some order lines can have the status paid if the order was paid using
a payment method that does not support authorizations (such as iDEAL) and the order lines are not shipped yet.
In this case, the order cannot be canceled. You should create refunds for these order lines instead. |
Parameters¶
Replace id
in the endpoint URL by the order’s ID, for example ord_8wmqcHMN4U
.
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.
Set this to
true
to cancel a test mode order.Example¶
cURLPHPPythonRubyNode.js
1 2 | curl -X DELETE https://api.mollie.com/v2/orders/ord_8wmqcHMN4U \ -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" |
1 2 3 4 | <?php $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"); $order = $mollie->orders->cancel("ord_8wmqcHMN4U"); |
1 2 3 4 | mollie_client = Client() mollie_client.set_api_key("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM") order = mollie_client.orders.delete("ord_8wmqcHMN4U") |
1 2 3 4 5 6 7 | require 'mollie-api-ruby' Mollie::Client.configure do |config| config.api_key = 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' end Mollie::Order.cancel('ord_8wmqcHMN4U') |
1 2 3 4 | const { createMollieClient } = require('@mollie/api-client'); const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' }); const canceledOrder = await mollieClient.orders.cancel('ord_8wmqcHMN4U'); |
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 | HTTP/1.1 200 OK Content-Type: application/hal+json { "resource": "order", "id": "ord_8wmqcHMN4U", "profileId": "pfl_URR55HPMGx", "amount": { "value": "1027.99", "currency": "EUR" }, "status": "canceled", "isCancelable": false, "metadata": null, "createdAt": "2018-08-02T09:29:56+00:00", "mode": "live", "locale": "nl_NL", "billingAddress": { "organizationName": "Mollie B.V.", "streetAndNumber": "Keizersgracht 126", "postalCode": "1015 CW", "city": "Amsterdam", "country": "nl", "givenName": "Luke", "familyName": "Skywalker", "email": "luke@skywalker.com" }, "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" }, "canceledAt": "2018-08-03T09:29:56+00:00", "redirectUrl": "https://example.org/redirect", "lines": [ { "resource": "orderline", "id": "odl_dgtxyl", "orderId": "ord_pbjz8x", "name": "LEGO 42083 Bugatti Chiron", "sku": "5702016116977", "type": "physical", "status": "canceled", "metadata": null, "isCancelable": false, "quantity": 2, "quantityShipped": 0, "amountShipped": { "value": "0.00", "currency": "EUR" }, "quantityRefunded": 0, "amountRefunded": { "value": "0.00", "currency": "EUR" }, "quantityCanceled": 2, "amountCanceled": { "value": "698.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": "canceled", "metadata": null, "isCancelable": false, "quantity": 1, "quantityShipped": 0, "amountShipped": { "value": "0.00", "currency": "EUR" }, "quantityRefunded": 0, "amountRefunded": { "value": "0.00", "currency": "EUR" }, "quantityCanceled": 1, "amountCanceled": { "value": "329.99", "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" } } } |