Kartra API: Inbound > Actions. This article is for developers.

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

TypeParametersValues
POSTcmd*cancel_transaction
POSTtransaction_id**integer
POSTtransaction_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.

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

ParametersValues
transaction_subscription_idstring A unique identifier for the subscription id (PayPal transactions will return PayPal subscription id).
transaction_internal_subscription_idinteger A unique numeric identifier for the subscription id.
Error cases

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