> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mygigsters.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Refund credit note

> Processes a payment gateway refund against the credit note balance. The refund is disbursed directly back to the customer's original payment method, remaining balance is deducted, and a refund allocation is created for auditing.

### Headers

**X-API-Version** `string` *required* (default: 1.2)

The API version to use. Supported versions are `1.1` and `1.2`.

**Idempotency-Key** `string`

A unique key so a retried request is not processed twice.

### Path Parameters

**id** `string` *required*

Credit note number (e.g. `CN-8466`) or unique ID from which balance is refunded.

### Request Body Parameters

**amount** `number` *required*

The amount to refund to customer. Cannot exceed `remainingAmount`.

**reason** `string` *required*

Audit reason for issuing the refund (e.g. `Customer requested refund for unused service`).

### Response Body

**success** `boolean`

Status flag (`true` on success).

**message** `string`

Confirmation message (`Credit note refund processed successfully`).

**data.creditNote.status** `string`

Updated state: `PARTIALLY_REFUNDED` or `REFUNDED`.

**data.creditNote.refundedAmount** `string`

Total cumulative amount refunded to customer.

**data.creditNote.remainingAmount** `string`

Remaining credit balance available.

**data.creditNote.allocations** `array`

List of allocations including the newly recorded Airwallex refund allocation entry.

**data.refund.refundId** `string`

Payment gateway refund reference ID (e.g. `rfd_sgpvwpnw7hmk2c9sx5s_pihj7h`).

**data.refund.status** `string`

Gateway status (e.g. `RECEIVED`).

### Response Codes

| Code | Description |
| - | - |
| 200 | Credit note refund processed successfully. |
| 400 | Bad Request. Amount exceeds remaining credit balance or reason is missing. |
| 401 | Unauthorized. Missing or invalid credentials. |
| 404 | Not Found. Credit note not found. |
| 500 | Internal server error. |

```bash cURL theme={null}
curl -X POST https://qa-payments.mygigsters.com.au/api/v1/credit-notes/CN-8466/refund \
  -u "YOUR_UUID:YOUR_SECRET" \
  -H "idempotency-Key: cn-req-refund-005" \
  -H "X-API-Version: 1.2" \
  -H "Content-Type: application/json" \
  -d '{
  "amount": 20,
  "reason": "Customer requested refund for unused service"
}'
```

```javascript Node.js theme={null}
const response = await fetch("https://qa-payments.mygigsters.com.au/api/v1/credit-notes/CN-8466/refund", {
  method: "POST",
  headers: {
    Authorization: "Basic " + Buffer.from("YOUR_UUID:YOUR_SECRET").toString("base64"),
    "idempotency-Key": "cn-req-refund-005",
    "X-API-Version": "1.2",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "amount": 20,
    "reason": "Customer requested refund for unused service"
  }),
});

const data = await response.json();
console.log(data);
```

```python Python theme={null}
import requests

response = requests.post(
    "https://qa-payments.mygigsters.com.au/api/v1/credit-notes/CN-8466/refund",
    auth=("YOUR_UUID", "YOUR_SECRET"),
    headers={
        "idempotency-Key": "cn-req-refund-005",
        "X-API-Version": "1.2",
    },
    json={
        "amount": 20,
        "reason": "Customer requested refund for unused service",
    },
)

print(response.json())
```

```ruby Ruby theme={null}
require "net/http"
require "json"
require "uri"

uri = URI("https://qa-payments.mygigsters.com.au/api/v1/credit-notes/CN-8466/refund")
request = Net::HTTP::Post.new(uri)
request.basic_auth("YOUR_UUID", "YOUR_SECRET")
request["idempotency-Key"] = "cn-req-refund-005"
request["X-API-Version"] = "1.2"
request["Content-Type"] = "application/json"
request.body = <<~JSON
  {
    "amount": 20,
    "reason": "Customer requested refund for unused service"
  }
JSON

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts JSON.parse(response.body)
```

```php PHP theme={null}
<?php

$ch = curl_init("https://qa-payments.mygigsters.com.au/api/v1/credit-notes/CN-8466/refund");

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_USERPWD => "YOUR_UUID:YOUR_SECRET",
    CURLOPT_HTTPHEADER => [
        "idempotency-Key: cn-req-refund-005",
        "X-API-Version: 1.2",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => <<<'JSON'
{
  "amount": 20,
  "reason": "Customer requested refund for unused service"
}
JSON,
]);

$response = curl_exec($ch);
curl_close($ch);

print_r(json_decode($response, true));
```

```java Java theme={null}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;

public class Example {
    public static void main(String[] args) throws Exception {
        String credentials = Base64.getEncoder()
            .encodeToString("YOUR_UUID:YOUR_SECRET".getBytes());

        String body = String.join("\n",
            "{",
            "  \"amount\": 20,",
            "  \"reason\": \"Customer requested refund for unused service\"",
            "}"
        );

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://qa-payments.mygigsters.com.au/api/v1/credit-notes/CN-8466/refund"))
            .header("Authorization", "Basic " + credentials)
            .header("idempotency-Key", "cn-req-refund-005")
            .header("X-API-Version", "1.2")
            .header("Content-Type", "application/json")
            .method("POST", HttpRequest.BodyPublishers.ofString(body))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

```go Go theme={null}
package main

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

func main() {
	body := strings.NewReader(`{
  "amount": 20,
  "reason": "Customer requested refund for unused service"
}`)

	req, err := http.NewRequest("POST", "https://qa-payments.mygigsters.com.au/api/v1/credit-notes/CN-8466/refund", body)
	if err != nil {
		panic(err)
	}
	req.SetBasicAuth("YOUR_UUID", "YOUR_SECRET")
	req.Header.Set("idempotency-Key", "cn-req-refund-005")
	req.Header.Set("X-API-Version", "1.2")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	data, _ := io.ReadAll(res.Body)
	fmt.Println(string(data))
}
```

```csharp .NET theme={null}
using System.Net.Http.Headers;
using System.Text;

using var client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Post, "https://qa-payments.mygigsters.com.au/api/v1/credit-notes/CN-8466/refund");
request.Headers.Authorization = new AuthenticationHeaderValue(
    "Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes("YOUR_UUID:YOUR_SECRET")));
request.Headers.Add("idempotency-Key", "cn-req-refund-005");
request.Headers.Add("X-API-Version", "1.2");
request.Content = new StringContent(@"{
  ""amount"": 20,
  ""reason"": ""Customer requested refund for unused service""
}", Encoding.UTF8, "application/json");

var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

```json Response theme={null}
{
  "success": true,
  "message": "Credit note refund processed successfully",
  "data": {
    "credit_note": {
      "id": 24,
      "credit_note_number": "CN-8466",
      "client_id": "4407c3ba-10c9-4822-9f51-c2c96692f8d7",
      "customer_id": "4407c3ba-10c9-4822-9f51-c2c96692f8d7",
      "invoice_id": "669dc683-4ad1-4971-a743-90d908788f01",
      "invoice_number": "INV-4717",
      "payment_id": "int_hkdmrmxh7hcf5pihj7h",
      "total_amount": "30.00",
      "remaining_amount": "10.00",
      "applied_amount": "0.00",
      "refunded_amount": "20.00",
      "currency": "AUD",
      "status": "PARTIALLY_REFUNDED",
      "reason": "Overbilled service hours",
      "description": null,
      "date": "2026-09-23T07:57:52.000Z",
      "deleted_at": null,
      "created_at": "2026-09-21T14:34:29.000Z",
      "updated_at": "2026-09-23T09:34:18.000Z",
      "allocations": [
        {
          "id": 8,
          "credit_note_id": 24,
          "invoice_id": "669dc683-4ad1-4971-a743-90d908788f01",
          "amount": "20.00",
          "notes": "Airwallex Refund (rfd_sgpvwpnw7hmk2c9sx5s_pihj7h): Customer requested refund for unused service",
          "deleted_at": null,
          "created_at": "2026-09-23T09:34:17.000Z",
          "updated_at": "2026-09-23T09:34:17.000Z"
        }
      ]
    },
    "refund": {
      "refund_id": "rfd_sgpvwpnw7hmk2c9sx5s_pihj7h",
      "amount": "20.00",
      "currency": "AUD",
      "status": "RECEIVED",
      "payment_intent_id": "int_hkdmrmxh7hcf5pihj7h",
      "reason": "Customer requested refund for unused service"
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.