# Update subscription Update an existing subscription. Canceled subscriptions cannot be updated. For an in-depth explanation of each parameter, refer to the [Create subscription](create-subscription) endpoint. > 🔑 Access with > > [API key](/reference/authentication) > > [Organization access token with **subscriptions.write**](/reference/authentication) > > [OAuth access with **subscriptions.write**](/reference/authentication) # OpenAPI definition ```json { "openapi": "3.1.0", "info": { "title": "Recurring", "version": "1.0.0", "license": { "name": "Attribution-NonCommercial-ShareAlike 4.0 International", "identifier": "CC-BY-NC-SA-4.0" } }, "servers": [ { "url": "https://api.mollie.com/v2" } ], "security": [ { "apiKey": [] }, { "organizationAccessToken": [] }, { "oAuth": [] } ], "paths": { "/customers/{customerId}/subscriptions/{subscriptionId}": { "parameters": [ { "name": "customerId", "description": "Provide the ID of the related customer.", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^cst_.+$", "example": "cst_5B8cwPMGnU" } }, { "name": "subscriptionId", "description": "Provide the ID of the related subscription.", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^sub_.+$", "example": "sub_5B8cwPMGnU" } } ], "patch": { "summary": "Update subscription", "x-speakeasy-name-override": "update", "tags": [ "Subscriptions API" ], "operationId": "update-subscription", "security": [ { "apiKey": [] }, { "organizationAccessToken": [ "subscriptions.write" ] }, { "oAuth": [ "subscriptions.write" ] } ], "description": "Update an existing subscription.\n\nCanceled subscriptions cannot be updated.\n\nFor an in-depth explanation of each parameter, refer to the [Create subscription](create-subscription) endpoint.\n\n> 🔑 Access with\n>\n> [API key](/reference/authentication)\n>\n> [Organization access token with **subscriptions.write**](/reference/authentication)\n>\n> [OAuth access with **subscriptions.write**](/reference/authentication)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "amount": { "description": "Update the amount for future payments of this subscription.", "type": "object", "required": [ "currency", "value" ], "properties": { "currency": { "type": "string", "description": "A three-character ISO 4217 currency code.", "example": "EUR" }, "value": { "type": "string", "description": "A string containing an exact monetary amount in the given currency.", "example": "10.00" } } }, "description": { "type": "string", "description": "The subscription's description will be used as the description of the resulting individual payments and so showing up on the bank statement of the consumer.\n\n**Please note:** the description needs to be unique for the Customer in case it has multiple active subscriptions.", "example": "Subscription of streaming channel" }, "interval": { "type": "string", "description": "Interval to wait between payments, for example `1 month` or `14 days`.\n\nThe maximum interval is one year (`12 months`, `52 weeks`, or `365 days`).\n\nPossible values: `... days`, `... weeks`, `... months`.", "pattern": "^\\d+ (days?|weeks?|months?)$", "example": "1 months" }, "startDate": { "type": "string", "description": "The start date of the subscription in `YYYY-MM-DD` format.", "example": "2025-01-01" }, "times": { "type": "integer", "description": "Total number of payments for the subscription. Once this number of payments is reached, the subscription is considered completed.\n\nTest mode subscriptions will get canceled automatically after 10 payments.", "example": 6 }, "metadata": { "description": "Provide any data you like, for example a string or a JSON object. We will save the data alongside the entity. Whenever you fetch the entity with our API, we will also include the metadata. You can use up to approximately 1kB.\n\nAny metadata added to the subscription will be automatically forwarded to the payments generated for it.", "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "object", "properties": {}, "additionalProperties": true }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ] }, "webhookUrl": { "type": "string", "description": "We will call this URL for any payment status changes of payments resulting from this subscription.\n\nThis webhook will receive **all** events for the subscription's payments. This may include payment failures as well. Be sure to verify the payment's subscription ID and its status.", "example": "https://example.com/webhook" }, "mandateId": { "type": "string", "description": "The mandate used for this subscription, if any.", "pattern": "^mdt_.+$", "example": "mdt_5B8cwPMGnU" }, "testmode": { "type": "boolean", "description": "Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.\n\nMost API credentials are specifically created for either live mode or test mode, in which case this parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.", "writeOnly": true, "example": false } } } } } }, "responses": { "200": { "description": "The updated subscription object.", "content": { "application/hal+json": { "schema": { "allOf": [ { "type": "object", "properties": { "resource": { "type": "string", "description": "Indicates the response contains a subscription object. Will always contain the string `subscription` for this endpoint.", "readOnly": true, "default": "subscription" }, "id": { "allOf": [ { "type": "string", "pattern": "^sub_.+$", "example": "sub_5B8cwPMGnU" } ], "description": "The identifier uniquely referring to this subscription. Example: `sub_rVKGtNd6s3`.", "readOnly": true }, "mode": { "type": "string", "description": "Whether this entity was created in live mode or in test mode.\n\nPossible values: `live` `test`", "readOnly": true, "example": "live" }, "status": { "allOf": [ { "type": "string", "description": "The subscription's current status is directly related to the status of the underlying customer or mandate that is enabling the subscription.\n\nPossible values: `pending` `active` `canceled` `suspended` `completed`", "example": "active" } ], "readOnly": true }, "amount": { "description": "The amount for each individual payment that is charged with this subscription. For example, for a monthly subscription of €10, the subscription amount should be set to €10.", "type": "object", "required": [ "currency", "value" ], "properties": { "currency": { "type": "string", "description": "A three-character ISO 4217 currency code.", "example": "EUR" }, "value": { "type": "string", "description": "A string containing an exact monetary amount in the given currency.", "example": "10.00" } } }, "times": { "type": [ "integer", "null" ], "description": "Total number of payments for the subscription. Once this number of payments is reached, the subscription is considered completed.\n\nTest mode subscriptions will get canceled automatically after 10 payments.", "example": 6 }, "timesRemaining": { "type": [ "integer", "null" ], "description": "Number of payments left for the subscription.", "example": 5, "readOnly": true }, "interval": { "type": "string", "description": "Interval to wait between payments, for example `1 month` or `14 days`.\n\nThe maximum interval is one year (`12 months`, `52 weeks`, or `365 days`).\n\nPossible values: `... days`, `... weeks`, `... months`.", "pattern": "^\\d+ (days?|weeks?|months?)$", "example": "2 days" }, "startDate": { "type": "string", "description": "The start date of the subscription in `YYYY-MM-DD` format.", "example": "2025-01-01" }, "nextPaymentDate": { "type": [ "string", "null" ], "description": "The date of the next scheduled payment in `YYYY-MM-DD` format. If the subscription has been completed or canceled, this parameter will not be returned.", "example": "2025-01-01", "readOnly": true }, "description": { "type": "string", "description": "The subscription's description will be used as the description of the resulting individual payments and so showing up on the bank statement of the consumer.\n\n**Please note:** the description needs to be unique for the Customer in case it has multiple active subscriptions.", "example": "Subscription of streaming channel" }, "method": { "type": [ "string", "null" ], "description": "The payment method used for this subscription. If omitted, any of the customer's valid mandates may be used.\n\nPossible values: `creditcard` `directdebit` `paypal` ``", "example": "paypal" }, "applicationFee": { "type": "object", "description": "With Mollie Connect you can charge fees on payments that your app is processing on behalf of other Mollie merchants.\n\nSetting an application fee on the subscription will ensure this fee is charged on each individual payment.\n\nRefer to the `applicationFee` parameter on the [Get payment endpoint](get-payment) documentation for more information.", "required": [ "amount", "description" ], "properties": { "amount": { "type": "object", "description": "In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field.", "required": [ "currency", "value" ], "properties": { "currency": { "type": "string", "description": "A three-character ISO 4217 currency code.", "example": "EUR" }, "value": { "type": "string", "description": "A string containing an exact monetary amount in the given currency.", "example": "10.00" } } }, "description": { "type": "string", "example": "Platform fee" } } }, "metadata": { "description": "Provide any data you like, for example a string or a JSON object. We will save the data alongside the entity. Whenever you fetch the entity with our API, we will also include the metadata. You can use up to approximately 1kB.\n\nAny metadata added to the subscription will be automatically forwarded to the payments generated for it.", "oneOf": [ { "type": "string" }, { "type": "number" }, { "type": "object", "properties": {}, "additionalProperties": true }, { "type": "array", "items": { "type": "string" } }, { "type": "null" } ] }, "webhookUrl": { "type": [ "string", "null" ], "description": "We will call this URL for any payment status changes of payments resulting from this subscription.\n\nThis webhook will receive **all** events for the subscription's payments. This may include payment failures as well. Be sure to verify the payment's subscription ID and its status.", "example": "https://example.com/webhook" }, "customerId": { "allOf": [ { "type": "string", "pattern": "^cst_.+$", "example": "cst_5B8cwPMGnU" } ], "description": "The customer this subscription belongs to.", "readOnly": true }, "mandateId": { "type": [ "string", "null" ], "description": "The mandate used for this subscription, if any.", "pattern": "^mdt_.+$", "example": "mdt_5B8cwPMGnU" }, "createdAt": { "type": "string", "description": "The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.", "readOnly": true, "example": "2024-03-20T09:13:37+00:00" }, "canceledAt": { "type": [ "string", "null" ], "description": "The subscription's date and time of cancellation, in ISO 8601 format. This parameter is omitted if the subscription is not canceled (yet).", "example": "2025-01-01T13:10:19+00:00", "readOnly": true }, "profileId": { "allOf": [ { "description": "The identifier referring to the [profile](get-profile) this entity belongs to.\n\nWhen using an API Key, the `profileId` must not be sent since it is linked to the key. However, for OAuth and\nOrganization tokens, the `profileId` is required.\n\nFor more information, see [Authentication](authentication).", "type": "string", "pattern": "^pfl_.+$", "example": "pfl_5B8cwPMGnU" } ], "writeOnly": true }, "testmode": { "type": [ "boolean", "null" ], "description": "Whether to create the entity in test mode or live mode.\n\nMost API credentials are specifically created for either live mode or test mode, in which case this parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.", "writeOnly": true, "example": false }, "_links": { "type": "object", "description": "An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.", "required": [ "self", "profile", "customer", "documentation" ], "properties": { "self": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "customer": { "description": "The API resource URL of the [customer](get-customer) this subscription was created for.", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "mandate": { "description": "The API resource URL of the [mandate](get-mandate) this subscription was created for.", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "profile": { "description": "The API resource URL of the [profile](get-profile) this subscription was created for.", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "payments": { "description": "The API resource URL of the [payments](list-payments) created for this subscription. Omitted if no such payments exist (yet).", "type": [ "object", "null" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "documentation": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } } }, "readOnly": true } } }, { "type": "object", "required": [ "resource", "id", "mode", "customerId", "createdAt", "status", "amount", "description", "method", "times", "timesRemaining", "interval", "startDate", "webhookUrl", "metadata", "_links" ] } ] }, "examples": { "update-subscription-200-1": { "summary": "The updated subscription object", "value": { "resource": "subscription", "id": "sub_rVKGtNd6s3", "mode": "live", "amount": { "currency": "EUR", "value": "10.00" }, "times": 10, "timesRemaining": 10, "interval": "3 months", "startDate": "2023-06-01", "nextPaymentDate": "2023-09-01", "description": "Quarterly payment", "metadata": null, "method": null, "status": "active", "webhookUrl": "https://webshop.example.org/payments/webhook", "customerId": "cst_stTC2WHAuS", "mandateId": "mdt_38HS4fsS", "createdAt": "2023-04-06T13:10:19+00:00", "_links": { "self": { "href": "...", "type": "application/hal+json" }, "customer": { "href": "https://api.mollie.com/v2/customers/cst_stTC2WHAuS", "type": "application/hal+json" }, "profile": { "href": "...", "type": "text/html" }, "documentation": { "href": "...", "type": "text/html" } } } }, "update-subscription-200-2": { "summary": "Increase subscription amount", "x-request": "./requests.yaml#/api-increase-subscription-amount", "value": { "resource": "subscription", "id": "sub_hjytgQpbzu", "customerId": "cst_tKt44u85MM", "mode": "test", "createdAt": "2022-01-04T10:04:55+00:00", "status": "active", "amount": { "value": "12.00", "currency": "EUR" }, "description": "This is a recurring payment for your subscription", "method": null, "times": 12, "timesRemaining": 11, "interval": "2 months", "startDate": "2022-01-04", "webhookUrl": "https://example.com/redirect", "metadata": { "someProperty": "someValue", "anotherProperty": "anotherValue" }, "nextPaymentDate": "2022-02-04", "mandateId": "mdt_gDSN2rx3My", "_links": { "mandate": { "href": "https://api.mollie.com/v2/customers/cst_tKt44u85MM/mandates/mdt_gDSN2rx3My", "type": "application/hal+json" }, "self": { "href": "...", "type": "application/hal+json" }, "profile": { "href": "https://api.mollie.com/v2/profiles/pfl_85dxyKqNHa", "type": "application/hal+json" }, "customer": { "href": "https://api.mollie.com/v2/customers/cst_tKt44u85MM", "type": "application/hal+json" }, "payments": { "href": "https://api.mollie.com/v2/customers/cst_tKt44u85MM/subscriptions/sub_hjytgQpbzu/payments", "type": "application/hal+json" }, "documentation": { "href": "...", "type": "text/html" } } } } } } } }, "404": { "description": "No entity with this ID exists.", "content": { "application/hal+json": { "schema": { "type": "object", "description": "An error response object.", "required": [ "status", "title", "detail", "_links" ], "properties": { "status": { "type": "integer", "description": "The status code of the error message. This is always the same code as the status code of the HTTP message itself.", "minimum": 400, "maximum": 599, "example": 404 }, "title": { "type": "string", "description": "The HTTP reason phrase of the error. For example, for a `404` error, the `title` will be `Not Found`.", "example": "Not Found" }, "detail": { "type": "string", "description": "A detailed human-readable description of the error that occurred.", "example": "The resource does not exist" }, "field": { "type": "string", "description": "If the error was caused by a value provided by you in a specific field, the `field` property will contain the name of the field that caused the issue.", "example": "description" }, "_links": { "type": "object", "required": [ "documentation" ], "properties": { "documentation": { "type": "object", "description": "The URL to the generic Mollie API error handling guide.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "example": "https://docs.mollie.com/errors" }, "type": { "type": "string", "example": "text/html" } } } } } } }, "example": { "status": 404, "title": "Not Found", "detail": "No entity exists with token 'uct_abcDEFghij123456789'", "_links": { "documentation": { "href": "...", "type": "text/html" } } } } } } }, "x-readme": { "code-samples": [ { "language": "shell", "code": "curl -X PATCH https://api.mollie.com/v2/customers/cst_stTC2WHAuS/subscriptions/sub_rVKGtNd6s3 \\\n -H \"Authorization: Bearer live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\" \\\n -d \"amount[currency]=EUR\" \\\n -d \"amount[value]=10.00\" \\\n -d \"times=10\"" }, { "language": "php", "code": "setApiKey(\"live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\");\n\n$subscription = $mollie->send(\n new UpdateSubscriptionRequest(\n customerId: \"cst_stTC2WHAuS\",\n subscriptionId: \"sub_rVKGtNd6s3\",\n amount: new Money(currency: \"EUR\", value: \"10.00\"),\n times: 10\n )\n);", "install": "composer require mollie/mollie-api-php" }, { "language": "node", "code": "const { createMollieClient } = require('@mollie/api-client');\nconst mollieClient = createMollieClient({ apiKey: 'live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });\n\nconst subscription = await mollieClient.customerSubscriptions.update('sub_rVKGtNd6s3', {\n customerId: 'cst_stTC2WHAuS',\n amount: {\n currency: 'EUR',\n value: '10.00'\n },\n times: 10\n});", "install": "npm install @mollie/api-client" }, { "language": "python", "code": "from mollie.api.client import Client\n\nmollie_client = Client()\nmollie_client.set_api_key(\"live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\")\n\ncustomer = mollie_client.customers.get(\"cst_stTC2WHAuS\")\nsubscription = customer.subscriptions.update(\n \"sub_rVKGtNd6s3\",\n {\n \"amount\": {\n \"currency\": \"EUR\",\n \"value\": \"10.00\",\n },\n \"times\": 10,\n },\n)", "install": "pip install mollie-api-python" }, { "language": "ruby", "code": "require 'mollie-api-ruby'\n\nMollie::Client.configure do |config|\n config.api_key = 'live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'\nend\n\nsubscription = Mollie::Customer::Subscription.update(\n 'sub_rVKGtNd6s3',\n customer_id: 'cst_stTC2WHAuS',\n amount: { value: '10.00', currency: 'EUR' },\n times: 10\n)", "install": "gem install mollie-api-ruby" } ] } } } }, "components": { "securitySchemes": { "apiKey": { "type": "http", "scheme": "bearer", "x-default": "live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" }, "organizationAccessToken": { "type": "http", "scheme": "bearer", "x-default": "access_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" }, "oAuth": { "type": "oauth2", "flows": { "authorizationCode": { "authorizationUrl": "https://my.mollie.com/oauth2/authorize", "tokenUrl": "https://api.mollie.com/oauth2/tokens", "scopes": {} } } } } }, "x-readme": { "explorer-enabled": false, "samples-languages": [ "shell", "php", "node", "python", "ruby" ] } } ```