Kartra Documentation Technical Documentation for Kartra

Action: Cancel a recurring payment subscription

This will allow you to cancel a subscription inside Kartra. You can pass either the Kartra Transaction ID or the Kartra Subscription ID.

Type Parameters Values
POST cmd* cancel_transaction
POST transaction_id** integer
POST transaction_internal_subscription_id** integer

* Required fields
** Required either the transaction_id OR transaction_internal_subscription_id in order for a subscription to be correctly identified and canceled.

Here is an example:

'actions' => [
    '0' => [
        'cmd' => 'cancel_transaction',
        'transaction_id' => 234161
    ]
]

Success message:

{
    "cancel_transaction":{
        "status":"Success",
        "transaction_subscription_id":"I-EV375R0H61SM",
        "transaction_internal_subscription_id":"14833"
    }
}

Result parameters:

Parameters Values
transaction_subscription_id string A unique identifier for the subscription id (PayPal transactions will return PayPal subscription id).
transaction_internal_subscription_id integer A unique numeric identifier for the subscription id.

Error Cases:

Type Number Message Cause
248 Subscription doesn’t exist
  • The subscription you are trying to cancel does not exist in our database.
249 Transaction not linked to any recurring subscription
  • The transaction is not part of a payment subscription.
252 Subscription already cancelled
  • The subscription you are trying to cancel is already cancelled.
253 This type of transaction cannot be refunded or cancelled
  • The transaction is not a sale or a rebill type, or is a test transaction.
267 Cancellation has failed
  • The cancellation process encountered an unexpected issue.

An example of an error message:

{
  "status": "Error",
  "message": "Subscription already cancelled",
  "type": "252"
}

© 2024 Kartra All Rights Reserved