> 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.

# Reverse transaction

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

A reversal either refunds or voids a transaction independent of the transaction's settlement status. Send a reversal request for a transaction, and Payabli automatically determines whether it's a refund or void. You don't need to know whether the transaction is settled or not.

Reference: https://beta-docs.payabli.com/api-reference/moneyin/reverse-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

- `amount` (double, required) — Amount to reverse from original transaction, minus any service fees charged on the original transaction. The amount provided cannot be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was $90 plus a $10 service fee, you can reverse up to $90. An amount equal to zero will refunds the total amount authorized minus any service fee.
- `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.
- `responseCode` (integer, optional) — Code for the response. Learn more in [API Response Codes](/api-reference/api-responses).
- `responseData` (ResponseDataRefunds, 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

### ResponseDataRefunds

- `authCode` (string, optional) — Authorization code for the transaction.
- `avsResponseText` (string, optional) — This field is not applicable to refund operations.
- `customerId` (long, optional) — The Payabli-generated unique ID for the customer.
- `cvvResponseText` (string, optional) — This field is not applicable to refund operations.
- `expectedProcessingDateTime` (datetime, optional) — The expected time that the refund will be processed. This value only appears when the `resultCode` is `10`, which means that the refund has been initiated and is queued for processing. See [Enhanced Refund Flow](/guides/pay-in-enhanced-refund-flow) for more information about refund processing.
- `methodReferenceId` (string, optional) — This field is not applicable to refund operations.
- `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 description of the transaction result

## Examples

### Void

**Response**

```json
{
  "isSuccess": true,
  "responseCode": 1,
  "responseData": {
    "authCode": "A0000",
    "expectedProcessingDateTime": "2024-01-15T09:30:00Z",
    "referenceId": "255-fb61db4171334aa79224b019f090e4c5",
    "resultCode": 1,
    "resultText": "REVERSED"
  },
  "responseText": "Success"
}
```

**SDK Code**

```python Void
import requests

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

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

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

print(response.json())
```

```javascript Void
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0';
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/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0"

	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/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0")

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/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0")
  .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/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0', [
  'headers' => [
    'requestToken' => '<apiKey>',
  ],
]);

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

```csharp Void
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0");
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/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0")! 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()
```

### Refund

**Response**

```json
{
  "isSuccess": true,
  "responseCode": 1,
  "responseData": {
    "authCode": "A0000",
    "expectedProcessingDateTime": "2024-01-15T09:30:00Z",
    "referenceId": "255-fb61db4171334aa79224b019f090e4c5",
    "resultCode": 10,
    "resultText": "INITIATED"
  },
  "responseText": "Success"
}
```

**SDK Code**

```python Refund
import requests

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

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

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

print(response.json())
```

```javascript Refund
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76';
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 Refund
package main

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

func main() {

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

	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 Refund
require 'uri'
require 'net/http'

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

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 Refund
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Refund
using RestSharp;

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

```swift Refund
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76")! 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()
```