Kartra Documentation TECHNICAL DOCUMENTATION

Action: Refund a payment transaction

This will allow you to refund an individual payment transaction within the refund period.

Type Parameters Values
POST cmd* refund_transaction
POST transaction_id* integer
POST refund_amount** float

* Required field
** If refund_amount is left empty, the entire transaction amount will be refunded. No need to state the currency, as it will be executed in whatever currency the original transaction was processed in.

Here is an example:

'actions' => [
    '0' => [
        'cmd' => 'refund_transaction',
        'transaction_id' => 738474,
        'refund_amount' => 19.95
    ]
]

Success message:

{
    "refund_transaction":{
        "status":"Success",
        "transaction_refunded":"792354"
    }
}

Result parameters:

Parameters Values
transaction_refunded integer The unique identifier that is the transaction id.

 
Error Cases:

Type Number Message Cause
247 Transaction doesn’t exist
  • The transaction you are trying to refund does not exist in our database.
250 Transaction outside refund period
  • The transaction refund period has expired.
251 Transaction already refunded
  • The transaction you are trying to refund is already refunded.
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.
266 Refund has failed
  • The refund process encountered an unexpected issue.
268 Invalid amount
  • If refund_amount is present, but the format is not float.

An example of an error message:

{
  "status": "Error",
  "message": "Transaction already refunded",
  "type": "251"
}

© 2021 Kartra All Rights Reserved