N8N Tools - PayPal Enhanced icon

N8N Tools - PayPal Enhanced

Complete PayPal integration with 70+ operations including Orders, Subscriptions, Invoicing, Disputes, Webhooks, and Partner management

Subscriptions → Cancel Subscription

AI-generated

Overview

The "Cancel Subscription" operation in the N8N Tools - PayPal Enhanced node allows users to cancel an active PayPal subscription by specifying its ID. This is useful for automating subscription management workflows, such as stopping recurring billing when a customer cancels their service or when a subscription needs to be terminated programmatically.

Practical examples include:

  • Automatically cancelling a subscription when a user requests cancellation via a web form.
  • Integrating subscription cancellation into a larger workflow that handles customer lifecycle events.
  • Managing subscriptions in bulk by iterating over multiple subscription IDs and cancelling them as needed.

Properties

Name Meaning
ID The unique identifier of the subscription to cancel.
Additional Options Optional parameters including:
• Environment: Choose between "Sandbox" or "Live".
• Page Size: Number of items per page (used for list operations, not relevant here).
• Start Time: Filter start date (ISO 8601 format).
• End Time: Filter end date (ISO 8601 format).

Note: For the Cancel Subscription operation, only the ID and Environment option are relevant; other additional options like page size or time filters do not affect this operation.

Output

The node outputs a JSON object containing:

  • resource: The resource type, here always "subscriptions".
  • operation: The operation performed, here "cancelSubscription".
  • success: Boolean indicating if the cancellation was successful.
  • Other fields returned by the PayPal API response related to the cancellation.
  • creditsUsed and creditsRemaining: Information about API usage credits from the external validation API.
  • timestamp: ISO string timestamp of when the operation was executed.

The output does not include binary data.

Example output structure (simplified):

{
  "resource": "subscriptions",
  "operation": "cancelSubscription",
  "success": true,
  // ... PayPal API response fields ...
  "creditsUsed": 1,
  "creditsRemaining": 99,
  "timestamp": "2024-06-01T12:00:00.000Z"
}

Dependencies

  • Requires credentials for two APIs:
    • An API key credential for the external validation service ("N8N Tools API").
    • An OAuth2 access token credential for PayPal API access.
  • The node uses the PayPal environment setting (sandbox or live) to determine the base URL for API calls.
  • The node sends requests to the PayPal REST API endpoints corresponding to subscription management.

Troubleshooting

  • Invalid JSON in request body: If a custom request body is provided and contains invalid JSON, the node will throw an error. Ensure JSON syntax is correct.
  • Validation failure: If the external validation API rejects the resource-operation combination or credentials, the node throws an error with the validation message.
  • Unknown operation or resource: If an unsupported operation or resource is specified, the node throws an error indicating the unknown operation/resource.
  • API authentication errors: If PayPal OAuth2 tokens are invalid or expired, API calls will fail. Refresh or reconfigure credentials accordingly.
  • Network or connectivity issues: Failures in HTTP requests may occur due to network problems; verify connectivity and endpoint availability.
  • Continue on Fail: If enabled, the node will continue processing subsequent items even if one fails, returning error details in the output JSON.

Links and References

Discussion