Cancel payment

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

Some payment methods are cancellable for an amount of time, usually until the next day. Or as long as the payment status is open. Payments may be canceled manually from the Dashboard, or automatically by using this endpoint.

The isCancelable property on the Payment object will indicate if the payment can be canceled.

Parameters

Replace id in the endpoint URL by the payment’s ID, for example tr_7UhSN1zuXS.

Mollie Connect/OAuth parameters

If you’re creating an app with Mollie Connect/OAuth, the testmode parameter is also available.

testmode

boolean
optional
Set this to true to cancel a test mode payment.

Response

200 application/hal+json

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

Example

cURLPHPPythonRubyNode.js
1
2
curl -X DELETE https://api.mollie.com/v2/payments/tr_WDqYK6vllg \
   -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"
1
2
3
4
<?php
$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");
$canceled_payment = $mollie->payments->delete("tr_WDqYK6vllg");
1
2
3
4
5
from mollie.api.client import Client

mollie_client = Client()
mollie_client.set_api_key('test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM')
canceled_payment = mollie_client.payments.delete('tr_WDqYK6vllg')
1
2
3
4
5
6
7
require 'mollie-api-ruby'

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

canceled_payment = Mollie::Payment.cancel('tr_WDqYK6vllg')
1
2
3
4
5
6
const { createMollieClient } = require('@mollie/api-client');
const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });

(async () => {
  const canceledPayment = await mollieClient.payments.delete('tr_Eq8xzWUPA4');
})();

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
HTTP/1.1 200 OK
Content-Type: application/hal+json

{
    "resource": "payment",
    "id": "tr_WDqYK6vllg",
    "mode": "live",
    "createdAt": "2018-03-19T10:18:33+00:00",
    "amount": {
        "value": "35.07",
        "currency": "EUR"
    },
    "description": "Order 33",
    "method": "banktransfer",
    "metadata": null,
    "status": "canceled",
    "canceledAt": "2018-03-19T10:19:15+00:00",
    "details": {
        "bankName": "Stichting Mollie Payments",
        "bankAccount": "NL53ABNA0627535577",
        "bankBic": "ABNANL2A",
        "transferReference": "RF12-3456-7890-1234"
    },
    "profileId": "pfl_QkEhN94Ba",
    "sequenceType": "oneoff",
    "redirectUrl": "https://webshop.example.org/order/33/",
    "_links": {
        "self": {
            "href": "https://api.mollie.com/v2/payments/tr_WDqYK6vllg",
            "type": "application/hal+json"
        },
        "documentation": {
            "href": "https://docs.mollie.com/reference/v2/payments-api/cancel-payment",
            "type": "text/html"
        }
    }
}