Cancel subscription

PATCH/subscriptions/{subscriptionId}/cancel

Cancels a subscription of the business now. There is no request body.

  • The API key must have write access to subscriptions, and its user must be a collaborator of the business sent in business-id. Only the business that owns the subscription can cancel it.
  • The cancellation takes effect immediately. Nothing is refunded.
  • Easyflow sends the subscription.canceled webhook once. Canceling again returns canceled and sends nothing.
  • Pending and charged recurrences are canceled with it (a charge in progress is canceled, a paid recurrence is not touched), and Easyflow sends one subscriptionRecurrence.canceled webhook for each of them.
  • A subscription that is already expired is not changed, and the response brings expired.
  • Up to 30 requests per minute for each user (all API keys of the same user share the limit). Above that, the API returns 429 with the Retry-After header.

Headers

  • x-api-keystringrequired

    Api key provided on integrations tab in Easyflow platform.

  • x-api-secretstringrequired

    Api Secret provided on integrations tab in Easyflow platform.

  • business-idstringrequired

    Identifier of the business the request refers to. The user of your API key must be linked to this business, as explained in The business identifier. A value that is not a business identifier returns 400 with Invalid param: [businessId], and a business that the user is not linked to returns 403.

Path parameters

  • subscriptionIdstring · uuidrequired

    ID of the subscription.

Responses

200The subscription is canceled, or it was already canceled or expired.

The subscription is canceled, or it was already canceled or expired.

Content typeapplication/jsonobject

  • statusCodeinteger

    Example:200

  • dataobject
    Show child attributesHide child attributes
    • subscriptionIdstring · uuid

      ID of the subscription.

    • statusstring

      canceled, also when the subscription was already canceled, or expired when the subscription had already finished.

      Possible values:canceledexpired

400The subscription does not exist, is not a valid ID or belongs to another business (message Invalid param: [subscriptionId] in all cases).

The subscription does not exist, is not a valid ID or belongs to another business (message Invalid param: [subscriptionId] in all cases).

Content typeapplication/jsonobject

  • messagestring

    Invalid param: []

    Example:Invalid param: []

  • errorstring

    Bad Request

    Example:Bad Request

  • statusCodeinteger

    400

    Example:400

  • errorCodestring

    Code that identifies the error. Present only on some errors.

401The credential is missing or invalid, or the business-id header is missing (message BusinessId is required).

The credential is missing or invalid, or the business-id header is missing (message BusinessId is required).

Content typeapplication/jsonobject

  • messagestring

    Invalid field

    Example:Unauthorized

  • errorstring

    Unauthorized

    Example:Unauthorized

  • statusCodeinteger

    401

    Example:401

403The API key has no write access to subscriptions, or its user is not a collaborator of the business sent in business-id.

The API key has no write access to subscriptions, or its user is not a collaborator of the business sent in business-id.

Content typeapplication/jsonobject

  • messagestring

    Forbidden resource

    Example:Forbidden resource

  • errorstring

    Forbidden

    Example:Forbidden

  • statusCodeinteger

    403

    Example:403

429More than 30 requests in a minute for the user (all API keys of the same user share the limit). The message is Too many requests, retry after the Retry-After seconds. Wait the number of seconds in the Retry-After header before sending a new request.

More than 30 requests in a minute for the user (all API keys of the same user share the limit). The message is Too many requests, retry after the Retry-After seconds. Wait the number of seconds in the Retry-After header before sending a new request.

Content typeapplication/jsonobject

  • statusCodeinteger

    HTTP status code.

    Example:429

  • messagestring

    Explanation of the error.

    Example:Too many requests, retry after the Retry-After seconds

500If an unexpected condition occurs and the server cannot process the request, the API will return the following error response. This response has no error field.

If an unexpected condition occurs and the server cannot process the request, the API will return the following error response. This response has no error field.

Content typeapplication/jsonobject

  • statusCodeinteger

    HTTP status code.

    Example:500

  • messagestring

    Explanation of the error.

    Example:Internal Server Error