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

# Refund

POST https://pos.fuel.greenlane.ai/gfp/refund
Content-Type: application/json

Transactions may be refunded fully by passing in the original transaction id and payment code.

For verification purposes, you'll also need to pass in the expected transaction amount from the original transaction.

Reference: https://docs.greenlane.ai/greenlane-fuel-platform/refund

## Authentication

- `Authorization` header (bearer token, required)

## Request

### Body (application/json)

- `merchant_id` (string, required)
- `transaction_id` (string, required)
- `transaction_time_ms` (integer, required)
- `transaction_amt` (double, required)
- `payment_code` (string, required)

## Response

### 200

OK

- `merchant_id` (string, required)
- `transaction_id` (string, required)
- `transaction_amt` (double, required)
- `authorized_flag` (boolean, required)
- `authorization_code` (string, required)

## Examples

### Refund approved

**Request**

```json
undefined
```

**Response**

```json
{
  "merchant_id": "merchant-123",
  "transaction_id": "123abcd",
  "transaction_amt": 144.32,
  "authorized_flag": true,
  "authorization_code": "QWE4412VF"
}
```

**SDK Code**

```python Refund approved
import requests

url = "https://pos.fuel.greenlane.ai/gfp/refund"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript Refund approved
const url = 'https://pos.fuel.greenlane.ai/gfp/refund';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go Refund approved
package main

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

func main() {

	url := "https://pos.fuel.greenlane.ai/gfp/refund"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby Refund approved
require 'uri'
require 'net/http'

url = URI("https://pos.fuel.greenlane.ai/gfp/refund")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java Refund approved
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://pos.fuel.greenlane.ai/gfp/refund")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://pos.fuel.greenlane.ai/gfp/refund', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Refund approved
using RestSharp;

var client = new RestClient("https://pos.fuel.greenlane.ai/gfp/refund");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Refund approved
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://pos.fuel.greenlane.ai/gfp/refund")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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 decline, invalid amount

**Request**

```json
undefined
```

**Response**

```json
{
  "merchant_id": "LOCATION_ID",
  "transaction_id": "123abcd",
  "transaction_amt": 1.1,
  "authorized_flag": false,
  "authorization_code": "string",
  "denied_reason": "Invalid transaction amount for this transaction."
}
```

**SDK Code**

```python Refund decline, invalid amount
import requests

url = "https://pos.fuel.greenlane.ai/gfp/refund"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript Refund decline, invalid amount
const url = 'https://pos.fuel.greenlane.ai/gfp/refund';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go Refund decline, invalid amount
package main

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

func main() {

	url := "https://pos.fuel.greenlane.ai/gfp/refund"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby Refund decline, invalid amount
require 'uri'
require 'net/http'

url = URI("https://pos.fuel.greenlane.ai/gfp/refund")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java Refund decline, invalid amount
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://pos.fuel.greenlane.ai/gfp/refund")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Refund decline, invalid amount
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://pos.fuel.greenlane.ai/gfp/refund', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Refund decline, invalid amount
using RestSharp;

var client = new RestClient("https://pos.fuel.greenlane.ai/gfp/refund");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Refund decline, invalid amount
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://pos.fuel.greenlane.ai/gfp/refund")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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_example

**Request**

```json
{
  "merchant_id": "merchant-123",
  "transaction_id": "123abcd",
  "transaction_time_ms": 1787636532000,
  "transaction_amt": 144.32,
  "payment_code": "75123456"
}
```

**Response**

```json
{
  "merchant_id": "merchant-123",
  "transaction_id": "123abcd",
  "transaction_amt": 144.32,
  "authorized_flag": true,
  "authorization_code": "QWE4412VF"
}
```

**SDK Code**

```python Refund_example
import requests

url = "https://pos.fuel.greenlane.ai/gfp/refund"

payload = {
    "merchant_id": "merchant-123",
    "transaction_id": "123abcd",
    "transaction_time_ms": 1787636532000,
    "transaction_amt": 144.32,
    "payment_code": "75123456"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Refund_example
const url = 'https://pos.fuel.greenlane.ai/gfp/refund';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"merchant_id":"merchant-123","transaction_id":"123abcd","transaction_time_ms":1787636532000,"transaction_amt":144.32,"payment_code":"75123456"}'
};

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

```go Refund_example
package main

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

func main() {

	url := "https://pos.fuel.greenlane.ai/gfp/refund"

	payload := strings.NewReader("{\n  \"merchant_id\": \"merchant-123\",\n  \"transaction_id\": \"123abcd\",\n  \"transaction_time_ms\": 1787636532000,\n  \"transaction_amt\": 144.32,\n  \"payment_code\": \"75123456\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://pos.fuel.greenlane.ai/gfp/refund")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"merchant_id\": \"merchant-123\",\n  \"transaction_id\": \"123abcd\",\n  \"transaction_time_ms\": 1787636532000,\n  \"transaction_amt\": 144.32,\n  \"payment_code\": \"75123456\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://pos.fuel.greenlane.ai/gfp/refund")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"merchant_id\": \"merchant-123\",\n  \"transaction_id\": \"123abcd\",\n  \"transaction_time_ms\": 1787636532000,\n  \"transaction_amt\": 144.32,\n  \"payment_code\": \"75123456\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://pos.fuel.greenlane.ai/gfp/refund', [
  'body' => '{
  "merchant_id": "merchant-123",
  "transaction_id": "123abcd",
  "transaction_time_ms": 1787636532000,
  "transaction_amt": 144.32,
  "payment_code": "75123456"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Refund_example
using RestSharp;

var client = new RestClient("https://pos.fuel.greenlane.ai/gfp/refund");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"merchant_id\": \"merchant-123\",\n  \"transaction_id\": \"123abcd\",\n  \"transaction_time_ms\": 1787636532000,\n  \"transaction_amt\": 144.32,\n  \"payment_code\": \"75123456\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Refund_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "merchant_id": "merchant-123",
  "transaction_id": "123abcd",
  "transaction_time_ms": 1787636532000,
  "transaction_amt": 144.32,
  "payment_code": "75123456"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://pos.fuel.greenlane.ai/gfp/refund")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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