# 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.
Consider migrating to the [v2 Void endpoint](/developers/api-reference/moneyinV2/void-a-transaction) to take advantage of unified response codes and improved response consistency.
Reference: https://docs.payabli.com/developers/api-reference/moneyin/void-a-transaction
## OpenAPI Specification
```yaml
openapi: 3.1.1
info:
title: Void a transaction
version: endpoint_moneyIn.Void
paths:
/MoneyIn/void/{transId}:
get:
operationId: void
summary: Void a transaction
description: >-
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.
Consider migrating to the [v2 Void endpoint](/developers/api-reference/moneyinV2/void-a-transaction) to take advantage of unified response codes and improved response consistency.
tags:
- - subpackage_moneyIn
parameters:
- name: transId
in: path
description: ReferenceId for the transaction (PaymentId).
required: true
schema:
type: string
- name: requestToken
in: header
required: true
schema:
type: string
responses:
'200':
description: Ok
content:
application/json:
schema:
$ref: '#/components/schemas/type_moneyIn:VoidResponse'
'400':
description: Bad request/ invalid data
content: {}
'401':
description: Unauthorized request.
content: {}
'500':
description: Internal API Error
content: {}
'503':
description: Database connection error
content: {}
components:
schemas:
type_:Responsecode:
type: integer
type_:PageIdentifier:
type: string
type_:RoomIdNotInUse:
type: integer
format: int64
type_:IsSuccess:
type: boolean
type_:ResponseText:
type: string
type_:Authcode:
type: string
type_:Referenceidtrans:
type: string
type_:ResultCode:
type: integer
type_:Resulttext:
type: string
type_:AvsResponseText:
type: string
type_:CvvResponseText:
type: string
type_:Customeridtrans:
type: integer
format: int64
type_:MethodReferenceId:
type: string
type_moneyIn:VoidResponseData:
type: object
properties:
authCode:
$ref: '#/components/schemas/type_:Authcode'
referenceId:
$ref: '#/components/schemas/type_:Referenceidtrans'
resultCode:
$ref: '#/components/schemas/type_:ResultCode'
resultText:
$ref: '#/components/schemas/type_:Resulttext'
avsResponseText:
$ref: '#/components/schemas/type_:AvsResponseText'
cvvResponseText:
$ref: '#/components/schemas/type_:CvvResponseText'
customerId:
$ref: '#/components/schemas/type_:Customeridtrans'
methodReferenceId:
$ref: '#/components/schemas/type_:MethodReferenceId'
required:
- authCode
- referenceId
- resultCode
- resultText
type_moneyIn:VoidResponse:
type: object
properties:
responseCode:
$ref: '#/components/schemas/type_:Responsecode'
pageIdentifier:
$ref: '#/components/schemas/type_:PageIdentifier'
roomId:
$ref: '#/components/schemas/type_:RoomIdNotInUse'
isSuccess:
$ref: '#/components/schemas/type_:IsSuccess'
responseText:
$ref: '#/components/schemas/type_:ResponseText'
responseData:
$ref: '#/components/schemas/type_moneyIn:VoidResponseData'
required:
- responseCode
- roomId
- isSuccess
- responseText
- responseData
```
## SDK Code Examples
```python Void
from payabli import payabli
client = payabli(
api_key="YOUR_API_KEY",
)
client.money_in.void(
trans_id="10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
)
```
```typescript Void
import { PayabliClient } from "@payabli/sdk-node";
const client = new PayabliClient({ apiKey: "YOUR_API_KEY" });
await client.moneyIn.void("10-3ffa27df-b171-44e0-b251-e95fbfc7a723");
```
```go Void
import (
context "context"
option "github.com/payabli/sdk-go/option"
sdkgoclient "github.com/payabli/sdk-go/client"
)
client := sdkgoclient.NewClient(
option.WithApiKey(
"",
),
)
response, err := client.MoneyIn.Void(
context.TODO(),
"10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
)
```
```csharp Void
using PayabliApi;
var client = new PayabliApiClient("API_KEY");
await client.MoneyIn.VoidAsync("10-3ffa27df-b171-44e0-b251-e95fbfc7a723");
```
```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"] = ''
response = http.request(request)
puts response.read_body
```
```java Void
HttpResponse response = Unirest.get("https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723")
.header("requestToken", "")
.asString();
```
```php Void
request('GET', 'https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723', [
'headers' => [
'requestToken' => '',
],
]);
echo $response->getBody();
```
```swift Void
import Foundation
let headers = ["requestToken": ""]
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()
```