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

# Cancel a pay in transaction

How you cancel a pay-in transaction depends on the transaction status. If a transaction hasn't been settled yet, you can void it. If a transaction has been settled, or settlement is pending, you can refund the transaction. Payabli offers a convenient third method, *reversal*, which dynamically refunds or voids a transaction based on its settlement status.

This guide explains how to void, refund, and reverse transactions with the Payabli API.

## Choose a method

First, choose a transaction cancellation method. To streamline your integration with Payabli, use reverse.

![diagram explained in surrounding text](/_fern-files/beta-docs.payabli.com/f5b932dfdae172a12dfb63d586642fa44bb199291c76e51097ae75fd72231154/images/generated-diagrams/pay-in-transaction-cancel-flowchart.svg)

### Void

A void cancels an existing sale or captured authorization. Voiding non-captured authorizations prevents future captures. You can void unsettled transactions. If a transaction has been settled, refund it instead.

### Refund

A Refund sends money back to the accountholder after transaction has been settled. If a transaction hasn't been settled, void it instead.

### Reversal

A reversal allows you to either refund or void a transaction without knowing the transaction's settlement status. Send a reversal request for a transaction, and Payabli automatically determines whether it's a refund or void. Reverse lets you integrate a single function for transaction cancellations and has Payabli dynamically handle the logic.

## Path parameters

When canceling a transaction via the API, you always need the `transId`, which is the `referenceId` for the transaction. For refunds and reversals, you also need the `amount` to refund.

**`transId`** `string` — required

*Required for voids, refunds, and reversals*

The referenceId identifying the transaction (PaymentId). You can find this in the success response for the payment you want to void.

---

**`amount`** `double`

*Required for refunds and reversals*

The amount to refund from the original transaction, minus any service fee charged on the original transaction. This amount can't be greater than the original total amount of the transaction minus the service fee. For example, if a transaction was \$90 plus a \$10 service fee, you can refund up to \$90. Set the amount to 0 (zero) to refund the total amount of the transaction minus any service fee.

---

## Void a transaction

You can void transactions that haven't settled yet. See the [API reference](/api-reference/moneyin/void-a-transaction) for this endpoint.

This example voids the transaction with a `referenceId` of `10-3ffa27df-b171-44e0-b251-e95fbfc7a723`:

### Request

GET [https://api-sandbox.payabli.com/api/MoneyIn/void/\{transId}](https://api-sandbox.payabli.com/api/MoneyIn/void/\{transId})

**`Void`**

```curl Void
curl https://api-sandbox.payabli.com/api/MoneyIn/void/10-3ffa27df-b171-44e0-b251-e95fbfc7a723 \
     -H "requestToken: <apiKey>"
```

**`Void`**

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

**`Void`**

```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);
}
```

**`Void`**

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

}
```

**`Void`**

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

**`Void`**

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

**`Void`**

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

**`Void`**

```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);
```

**`Void`**

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

A successful void returns a 200 status with a JSON body. If you try to void a transaction that has already been voided, the API returns a 400 status with "Invalid TransStatus" in the response text.

#### Successful void reponse

### Response (200)

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

#### Invalid TransStatus response

**`Invalid TransStatus response`**

```json Invalid TransStatus response
{
  "responseText": "Declined: Invalid TransStatus",
}
```

## Refund a transaction

You can refund settled transactions. See the [API reference](/api-reference/moneyin/refund-a-settled-transaction) for this endpoint. If you use the Enhanced Refund Flow, see [the guide](/guides/pay-in-enhanced-refund-flow) for information about how refunds are handled in different scenarios.

#### Full refund example

This example refunds the transaction with a `referenceId` of `10-3ffa27df-b171-44e0-b251-e95fbfc7a723` for the total amount of the transaction.

### Request

GET [https://api-sandbox.payabli.com/api/MoneyIn/refund/\{transId}/\{amount}](https://api-sandbox.payabli.com/api/MoneyIn/refund/\{transId}/\{amount})

**`Initiated`**

```curl Initiated
curl https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0 \
     -H "requestToken: <apiKey>"
```

**`Initiated`**

```python Initiated
import requests

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

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

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

print(response.json())
```

**`Initiated`**

```javascript Initiated
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/refund/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);
}
```

**`Initiated`**

```go Initiated
package main

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

func main() {

	url := "https://api-sandbox.payabli.com/api/MoneyIn/refund/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))

}
```

**`Initiated`**

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

url = URI("https://api-sandbox.payabli.com/api/MoneyIn/refund/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
```

**`Initiated`**

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

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

**`Initiated`**

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

$client = new \GuzzleHttp\Client();

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

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

**`Initiated`**

```csharp Initiated
using RestSharp;

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

**`Initiated`**

```swift Initiated
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/refund/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()
```

#### Partial refund example

This example refunds a partial amount of \$100.99 of the transaction with a `referenceId` of `10-3ffa27df-b171-44e0-b251-e95fbfc7a723`.

### Request

GET [https://api-sandbox.payabli.com/api/MoneyIn/refund/\{transId}/\{amount}](https://api-sandbox.payabli.com/api/MoneyIn/refund/\{transId}/\{amount})

**`Captured`**

```curl Captured
curl https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/100.99 \
     -H "requestToken: <apiKey>"
```

**`Captured`**

```python Captured
import requests

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

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

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

print(response.json())
```

**`Captured`**

```javascript Captured
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/100.99';
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);
}
```

**`Captured`**

```go Captured
package main

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

func main() {

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

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

}
```

**`Captured`**

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

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

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

**`Captured`**

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

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

**`Captured`**

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

$client = new \GuzzleHttp\Client();

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

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

**`Captured`**

```csharp Captured
using RestSharp;

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

**`Captured`**

```swift Captured
import Foundation

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

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

A successful refund returns a 200 status with a JSON body.

#### Full refund example

This example shows a successful refund response for a full refund. The `resultText` value is "INITIATED" for refunds that have been initiated but not yet completed. This response is only returned in accounts with the Enhanced Refund Flow enabled.

### Response (200)

```json
{
  "isSuccess": true,
  "responseCode": 1,
  "responseData": {
    "authCode": "A0000",
    "expectedProcessingDateTime": "2026-02-15T10:30:00Z",
    "referenceId": "10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
    "resultCode": 10,
    "resultText": "INITIATED"
  },
  "responseText": "Success"
}
```

#### Partial refund example

This example shows a successful refund response for a partial refund. The `resultText` value is "CAPTURED".

### Response (200)

```json
{
  "isSuccess": true,
  "responseCode": 1,
  "responseData": {
    "authCode": "A0000",
    "referenceId": "10-3ffa27df-b171-44e0-b251-e95fbfc7a723",
    "resultCode": 1,
    "resultText": "CAPTURED"
  },
  "responseText": "Success"
}
```

> **Tip**
>
> Just like sale transactions, you can void a refund transaction before the batch closes. Use the `referenceId` from the refund transaction response as the `transId` in the void request.

## Reverse a transaction

You can use reversal to either refund or void a transaction without knowing the transaction's settlement status. See the [API reference](/api-reference/moneyin/reverse-a-transaction) for this endpoint.

Because reversing a transaction either voids or refunds it, keep these points in mind when creating requests:

* If a transaction isn't settled, the reversal request is treated as a void. Only full voids supported. Partial voids aren't supported.
* If a transaction is settled, the reversal request is treated as a refund. Both full and partial refunds are supported. Payabli refunds the amount passed in the request.

When using the `api/MoneyIn/reverse/` endpoint, the transaction's batch status determines how your reversal request is processed:

| Batch Status     | Reversal Type | How it's Treated            | Result                     |
| ---------------- | ------------- | --------------------------- | -------------------------- |
| Open             | Full          | Processed as Void           | ✓ Success                  |
| Open             | Partial       | Attempted as Partial Void   | ✗ Rejected (not supported) |
| Closed (Settled) | Full          | Processed as Full Refund    | ✓ Success                  |
| Closed (Settled) | Partial       | Processed as Partial Refund | ✓ Success                  |

These examples show how to reverse a transaction.

#### Full reversal

This example will refund the transaction with a `referenceId` of `10-3ffa27df-b171-44e0-b251-e95fbfc7a723` for the total amount of the transaction, if the transaction is settled. If the transaction isn't settled, it voids the transaction.

### Request

GET [https://api-sandbox.payabli.com/api/MoneyIn/reverse/\{transId}/\{amount}](https://api-sandbox.payabli.com/api/MoneyIn/reverse/\{transId}/\{amount})

**`Void`**

```curl Void
curl https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0 \
     -H "requestToken: <apiKey>"
```

**`Void`**

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

**`Void`**

```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);
}
```

**`Void`**

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

}
```

**`Void`**

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

**`Void`**

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

**`Void`**

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

**`Void`**

```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);
```

**`Void`**

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

#### Partial reversal

This example refunds \$53.76 of the transaction with a `referenceId` of `10-3ffa27df-b171-44e0-b251-e95fbfc7a723`, if the transaction is settled. If the transaction isn't settled, it reverses \$53.76 of the original authorized amount, and captures the rest.

### Request

GET [https://api-sandbox.payabli.com/api/MoneyIn/reverse/\{transId}/\{amount}](https://api-sandbox.payabli.com/api/MoneyIn/reverse/\{transId}/\{amount})

**`Refund`**

```curl Refund
curl https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76 \
     -H "requestToken: <apiKey>"
```

**`Refund`**

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

**`Refund`**

```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);
}
```

**`Refund`**

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

}
```

**`Refund`**

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

**`Refund`**

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

**`Refund`**

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

**`Refund`**

```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);
```

**`Refund`**

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

A successful reverse returns a 200 status with a JSON body. You can tell whether the operation was a refund or a void based on the `resultText` value. A "REVERSED" value means the operation was a void. A "CAPTURED" value means that the operation was a refund.

#### Void Response

### Response (200)

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

#### Refund Response

### Response (200)

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