> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://beta-docs.payabli.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://beta-docs.payabli.com/_mcp/server.

# Void transaction

GET https://api-sandbox.payabli.com/api/MoneyIn/void/{transId}

Cancel a transaction that hasn't been settled yet. Voiding non-captured authorizations prevents future captures. If a transaction has been settled, refund it instead.

Reference: https://beta-docs.payabli.com/api-reference/moneyin/void-a-transaction

## Authentication

- `requestToken` header (required) — API Key authentication via header

## Servers

- `https://api-sandbox.payabli.com/api` (Sandbox, default)
- `https://api.payabli.com/api` (Production)

## Request

### Path parameters

- `transId` (string, required) — ReferenceId for the transaction (PaymentId).

## Response

### 200

Ok

- `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.
- `pageIdentifier` (string, optional) — Auxiliary validation used internally by payment pages and components.
- `responseData` (PayabliApiResponse0ResponseData, optional)
- `responseText` (string, optional) — Response text for operation: 'Success' or 'Declined'.

## Errors

### 400 Bad Request Error

Bad request/ invalid data

- `any`

### 401 Unauthorized Error

Unauthorized request.

- `any`

### 500 Internal Server Error

Internal API Error

- `any`

### 503 Service Unavailable Error

Database connection error

- `isSuccess` (boolean, optional) — Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure.
- `responseData` (map from string to any, optional) — The object containing the response data.
- `responseText` (string, optional) — Response text for operation: 'Success' or 'Declined'.

## Types

### PayabliApiResponse0ResponseData

- `AuthCode` (string, optional) — Authorization code for the transaction.
- `avsResponseText` (string, optional) — Text code describing the result for address validation (applies only for card transactions).
- `CustomerId` (long, optional) — Payabli-generated unique ID of customer owner of transaction. Returns `0`` if the transaction was not assigned to an existing customer or no customer was created.
- `cvvResponseText` (string, optional) — Text code describing the result for CVV validation (applies only for card transactions).
- `methodReferenceId` (string, optional) — The stored method's identifier (sometimes referred to as 'token') in Payabli. When `null`, the method wasn't created, or doesn't exist, depending on the operation performed.
- `ReferenceId` (string, optional) — The transaction identifier in Payabli.
- `ResultCode` (integer, optional) — Result code for the operation. Value 1 indicates a successful operation, values 2 and 3 indicate errors. A value of 10 indicates that an operation has been initiated and is pending.
- `ResultText` (string, optional) — Text describing the result. If `ResultCode` = 1, will return 'Approved' or a general success message. If `ResultCode`` = 2 or 3, will contain the cause of the error or decline.

## Examples

**Response**

```json
{
  "isSuccess": true,
  "responseData": {
    "AuthCode": "AuthCode",
    "CustomerId": 4440,
    "ReferenceId": "10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
    "ResultCode": 1,
    "ResultText": "Cancelled"
  },
  "responseText": "Success"
}
```

**SDK Code**

```python Void
import requests

url = "https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723"

headers = {"requestToken": "<apiKey>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Void
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723';
const options = {method: 'GET', headers: {requestToken: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Void
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("requestToken", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Void
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["requestToken"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Void
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723")
  .header("requestToken", "<apiKey>")
  .asString();
```

```php Void
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723', [
  'headers' => [
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Void
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723");
var request = new RestRequest(Method.GET);
request.AddHeader("requestToken", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Void
import Foundation

let headers = ["requestToken": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```