Opencell icon

Opencell

Consume Opencell API

Overview

The Opencell node's "Subscription" resource with the "Update" operation allows you to update an existing subscription in the Opencell billing system. This is useful for scenarios where you need to modify subscription details such as the associated user account, offer template, renewal rules, activation status, or custom fields.

Common use cases:

  • Changing the offer or plan for a subscriber.
  • Updating renewal terms or subscription dates.
  • Modifying custom fields attached to a subscription (e.g., metadata, tags).
  • Activating a subscription after updating its details.

Practical example:
Suppose a customer upgrades their subscription plan. You can use this node to update the subscription's offer template and renewal rules, and optionally activate the subscription immediately.


Properties

Name Type Meaning
Authentication options Selects the authentication method for connecting to Opencell ("Basic Authentication" or "OAuth2").
Code string The unique code identifying the subscription to update.
User Account Name or ID options The user account associated with the subscription. Choose from a list or specify an ID/expression.
Activate Subscription boolean If true, activates the subscription immediately after updating.
Offer Template Name or ID options The offer template (plan) to associate with the subscription. Choose from a list or specify an ID/expression.
Renewal Rule collection Defines how the subscription renews, including duration, auto-renewal, end-of-term actions, etc.
Subscription Date dateTime The effective date of the subscription update. Required.
Body Content Type hidden Internal property; always set to "multipart-form-data".
Custom Fields fixedCollection Allows adding one or more custom fields to the subscription. Each field can be of various types (string, number, date, boolean, list, etc.), depending on the custom field definition in Opencell.

Renewal Rule sub-properties:

  • Initially Active For (number): Duration for which the subscription is initially active.
  • Initially Active For Unit (options): Unit for the initial active period (Month/Day).
  • Auto Renew (boolean): Whether the subscription should auto-renew.
  • Extend Agreement Period to Subscribed Till Date (boolean): Extends agreement period if enabled.
  • End Of Term Action (options): What happens at the end of the term (Suspend/Terminate).
  • Renewal Term Type (options): Type of renewal (Recurring/Calendar).
  • Renew For (number): Renewal period length.
  • Renew For Unit (options): Unit for renewal period (Day/Month).

Custom Fields sub-properties:

  • Field Name or ID (options): The custom field to set.
  • Value(s): Depending on field type, may be string, number, date, boolean, single/multiple options, etc.

Output

  • The node outputs a json object containing the response from the Opencell API after updating the subscription.
  • If "Activate Subscription" is enabled, a second output item will contain the result of the activation request.
  • The structure of the output depends on the Opencell API but typically includes updated subscription details and status information.

Example output:

[
  {
    "json": {
      // ...updated subscription data returned by Opencell...
    },
    "pairedItem": { "item": 0 }
  },
  {
    "json": {
      // ...activation result if 'Activate Subscription' was true...
    },
    "pairedItem": { "item": 0 }
  }
]

Note: The actual fields depend on your Opencell configuration.


Dependencies

  • External Service: Requires access to an Opencell instance with API enabled.
  • Authentication: Needs either Basic Auth credentials (opencellApi) or OAuth2 credentials (opencellOAuth2Api) configured in n8n.
  • Environment: No special environment variables required beyond n8n credential setup.

Troubleshooting

Common issues:

  • Invalid Credentials: If authentication fails, ensure your credentials are correct and have sufficient permissions.
  • Missing Required Fields: Omitting required properties like "Code", "User Account", "Offer Template", or "Subscription Date" will cause errors.
  • Invalid Custom Field Values: Supplying values that do not match the expected type or allowed options for custom fields may result in API errors.
  • API Connectivity Issues: Network problems or incorrect Opencell API URLs can prevent successful updates.

Error messages:

  • "Username/password error. Error code : ...": Check your authentication credentials.
  • "This resource doesn't support custom fields": Ensure you're using custom fields only with supported resources.
  • "There are no custom fields defined for this resource": Define custom fields in Opencell before referencing them here.
  • "Unable to get custom fields. Server response: ...": Check Opencell server status and field definitions.

Links and References

Discussion