Cancel subscription

Subscriptions API v2
DELETEhttps://api.mollie.com/v2/customers/*customerId*/subscriptions/*id*

A subscription can be canceled any time by calling DELETE on the resource endpoint.

Parameters

Replace customerId in the endpoint URL by the customer’s ID, and replace id by the subscription’s ID. For example: /v2/customers/cst_stTC2WHAuS/subscriptions/sub_rVKGtNd6s3.

Response

200 Ok

Example

Request (curl)

1
2
curl -X DELETE https://api.mollie.com/v2/customers/cst_stTC2WHAuS/subscriptions/sub_rVKGtNd6s3 \
    -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM"

Request (PHP)

1
2
3
4
5
6
 <?php
 $mollie = new \Mollie\Api\MollieApiClient();
 $mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");

 $customer = $mollie->customers->get("cst_stTC2WHAuS");
 $subscription = $customer->cancelSubscription("sub_rVKGtNd6s3");

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

{
    "resource": "subscription",
    "id": "sub_rVKGtNd6s3",
    "mode": "live",
    "createdAt": "2018-06-01T12:23:34+00:00",
    "status": "canceled",
    "amount": {
        "value": "25.00",
        "currency": "EUR"
    },
    "times": 4,
    "interval": "3 months",
    "description": "Quarterly payment",
    "method": null,
    "webhookUrl": "https://webshop.example.org/payments/webhook",
    "canceledAt": "2018-08-01T11:04:21+00:00",
    "_links": {
        "self": {
            "href": "https://api.mollie.com/v2/customers/cst_stTC2WHAuS/subscriptions/sub_rVKGtNd6s3",
            "type": "application/hal+json"
        },
        "customer": {
            "href": "https://api.mollie.com/v2/customers/cst_stTC2WHAuS",
            "type": "application/hal+json"
        },
        "documentation": {
            "href": "https://docs.mollie.com/reference/v2/subscriptions-api/cancel-subscription",
            "type": "text/html"
        }
    }
}