> This is Payabli documentation. For a complete page index, fetch https://docs.payabli.com/llms.txt — append .md to any page URL for lightweight markdown. For section-level indexes, query parameters, and other AI-optimized access methods, see https://docs.payabli.com/ai-agents.md

# Void transaction

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

<Warning>
  This endpoint is deprecated. Use it only to void transactions originally created with the legacy endpoints. New integrations should use the [Void endpoint](/developers/api-reference/moneyinV2/void-a-transaction), which only works on transactions created with [Make a transaction](/developers/api-reference/moneyinV2/make-a-transaction) or [Authorize](/developers/api-reference/moneyinV2/authorize-a-transaction).
</Warning>

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://docs.payabli.com/developers/api-reference/moneyin/void-a-transaction

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: payabliApi-oas
  version: 1.0.0
paths:
  /MoneyIn/void/{transId}:
    get:
      operationId: Void
      summary: Void a transaction
      description: >
        <Warning>
          This endpoint is deprecated. Use it only to void transactions originally created with the legacy endpoints. New integrations should use the [Void endpoint](/developers/api-reference/moneyinV2/void-a-transaction), which only works on transactions created with [Make a transaction](/developers/api-reference/moneyinV2/make-a-transaction) or [Authorize](/developers/api-reference/moneyinV2/authorize-a-transaction).
        </Warning>


        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.
      tags:
        - moneyIn
      parameters:
        - name: transId
          in: path
          description: ReferenceId for the transaction (PaymentId).
          required: true
          schema:
            type: string
        - name: requestToken
          in: header
          description: >
            Long-lived API token sent in the `requestToken` header. See [API
            token authentication](/developers/api-tokens).
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VoidResponse'
        '400':
          description: Bad request / invalid data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
        '503':
          description: Database connection error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PayabliErrorBody'
servers:
  - url: https://api-sandbox.payabli.com/api
    description: Sandbox
  - url: https://api.payabli.com/api
    description: Production
components:
  schemas:
    Responsecode:
      type: integer
      description: |
        Code for the response. Learn more in
        [API Response Codes](/developers/api-reference/api-responses).
      title: Responsecode
    PageIdentifier:
      type: string
      description: Auxiliary validation used internally by payment pages and components.
      title: PageIdentifier
    RoomIdNotInUse:
      type: integer
      format: int64
      description: Field not in use on this endpoint. It always returns `0`.
      title: RoomIdNotInUse
    IsSuccess:
      type: boolean
      description: |
        Boolean indicating whether the operation was successful. A `true` value
        indicates success. A `false` value indicates failure.
      title: IsSuccess
    ResponseText:
      type: string
      description: |
        Response text for operation: 'Success' or 'Declined'.
      title: ResponseText
    Authcode:
      type: string
      description: Authorization code for the transaction.
      title: Authcode
    Referenceidtrans:
      type: string
      description: The transaction identifier in Payabli.
      title: Referenceidtrans
    ResultCode:
      type: integer
      description: |
        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.
      title: ResultCode
    Resulttext:
      type: string
      description: |
        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.
      title: Resulttext
    AvsResponseText:
      type: string
      description: |
        Text code describing the result for address validation (applies only for
        card transactions).
      title: AvsResponseText
    CvvResponseText:
      type: string
      description: >
        Text code describing the result for CVV validation (applies only for
        card

        transactions).
      title: CvvResponseText
    Customeridtrans:
      type: integer
      format: int64
      description: >
        Payabli-generated unique ID of customer owner of transaction. Returns
        `0`

        if the transaction wasn't assigned to an existing customer or no
        customer

        was created.
      title: Customeridtrans
    MethodReferenceId:
      type: string
      description: |
        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.
      title: MethodReferenceId
    VoidResponseData:
      type: object
      properties:
        authCode:
          $ref: '#/components/schemas/Authcode'
        referenceId:
          $ref: '#/components/schemas/Referenceidtrans'
        resultCode:
          $ref: '#/components/schemas/ResultCode'
        resultText:
          $ref: '#/components/schemas/Resulttext'
        avsResponseText:
          $ref: '#/components/schemas/AvsResponseText'
        cvvResponseText:
          $ref: '#/components/schemas/CvvResponseText'
        customerId:
          $ref: '#/components/schemas/Customeridtrans'
        methodReferenceId:
          $ref: '#/components/schemas/MethodReferenceId'
      required:
        - authCode
        - referenceId
        - resultCode
        - resultText
      description: Response data for void transactions
      title: VoidResponseData
    VoidResponse:
      type: object
      properties:
        responseCode:
          $ref: '#/components/schemas/Responsecode'
        pageIdentifier:
          $ref: '#/components/schemas/PageIdentifier'
        roomId:
          $ref: '#/components/schemas/RoomIdNotInUse'
        isSuccess:
          $ref: '#/components/schemas/IsSuccess'
        responseText:
          $ref: '#/components/schemas/ResponseText'
        responseData:
          $ref: '#/components/schemas/VoidResponseData'
      required:
        - responseCode
        - roomId
        - isSuccess
        - responseText
        - responseData
      description: Response for MoneyIn/void endpoint
      title: VoidResponse
    PayabliErrorBodyResponseData:
      type: object
      properties:
        explanation:
          type: string
          description: Human-readable explanation of what happened.
        todoAction:
          type: string
          description: Suggested resolution.
      description: Object with detailed error context.
      title: PayabliErrorBodyResponseData
    PayabliErrorBody:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: Always `false` for error responses.
        responseCode:
          type: integer
          description: |
            Code for the response. Learn more in
            [API Response Codes](/developers/api-reference/api-responses).
        responseText:
          type: string
          description: Error text describing what went wrong.
        responseData:
          $ref: '#/components/schemas/PayabliErrorBodyResponseData'
          description: Object with detailed error context.
      required:
        - isSuccess
        - responseText
      description: |
        Shape returned by every Payabli API error response. The `responseData`
        object carries human-readable error context.
      title: PayabliErrorBody
  securitySchemes:
    APIKeyAuth:
      type: apiKey
      in: header
      name: requestToken
      description: >
        Long-lived API token sent in the `requestToken` header. See [API token
        authentication](/developers/api-tokens).
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        OAuth2 Bearer access token from the client-credentials flow. See [OAuth
        authentication](/developers/oauth-authentication).

```

## Examples



**Response**

```json
{
  "responseCode": 1,
  "roomId": 0,
  "isSuccess": true,
  "responseText": "Success",
  "responseData": {
    "authCode": "123456",
    "referenceId": "129-219",
    "resultCode": 1,
    "resultText": "Transaction Void Successful",
    "avsResponseText": null,
    "cvvResponseText": null,
    "customerId": null,
    "methodReferenceId": null
  },
  "pageIdentifier": null
}
```

**SDK Code**

```typescript
import { PayabliClient } from "@payabli/sdk-node";

async function main() {
    const client = new PayabliClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.moneyIn.void("10-3ffa27df-b171-44e0-b251-e95fbfc7a723");
}
main();

```

```python
from payabli import payabli

client = payabli(
    api_key="YOUR_API_KEY_HERE",
)

client.money_in.void(
    trans_id="10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
)

```

```java
package com.example.usage;

import io.github.payabli.api.PayabliPayabliApiOasClient;

public class Example {
    public static void main(String[] args) {
        PayabliPayabliApiOasClient client = PayabliPayabliApiOasClient
            .builder()
            .apiKey("YOUR_API_KEY_HERE")
            .build();

        client.moneyIn().void_("10-3ffa27df-b171-44e0-b251-e95fbfc7a723");
    }
}
```

```ruby
require "payabli"

client = Payabli::Client.new(api_key: "YOUR_API_KEY_HERE")

client.money_in.void(trans_id: "10-3ffa27df-b171-44e0-b251-e95fbfc7a723")

```

```csharp
using PayabliPayabliApiOas;
using System.Threading.Tasks;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayabliPayabliApiOasClient(
            apiKey: "YOUR_API_KEY_HERE"
        );

        await client.MoneyIn.VoidAsync(
            "10-3ffa27df-b171-44e0-b251-e95fbfc7a723"
        );
    }

}

```

```go
package example

import (
    context "context"

    client "github.com/payabli/sdk-go/client"
    option "github.com/payabli/sdk-go/option"
)

func do() {
    client := client.NewClient(
        option.WithApiKey(
            "YOUR_API_KEY_HERE",
        ),
    )
    client.MoneyIn.Void(
        context.TODO(),
        "10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
    )
}

```

```php
<?php

namespace Example;

use Payabli\PayabliClient;

$client = new PayabliClient(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->moneyIn->void(
    '10-3ffa27df-b171-44e0-b251-e95fbfc7a723',
);

```

```swift
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()
```