> For the complete documentation index, see [llms.txt](https://blufin360-api-documentation.gitbook.io/blufin360_api_documentation-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blufin360-api-documentation.gitbook.io/blufin360_api_documentation-docs/banking/refunds.md).

# Refunds

Initiate a full or partial refund against a successful collection transaction. The refund is credited back to the original payer's account.

The API includes:

* Full & partial refund support
* Credited to original source
* UTR & original UTR tracking
* Reason field for audit trail

**Endpoints**

**Staging :** <mark style="color:$primary;">`https://apidev.blufin360.com`</mark>

**Prod :** <mark style="color:$primary;">`https://api.blufin360.com`</mark>

**Path**

<mark style="color:$primary;">`POST`</mark> <mark style="color:$primary;">`/api/v1/banking/collections/refunds`</mark>

**Authentication**

Use a JWT access token in the `Authorization` header.

Generate the token using [<mark style="color:$primary;">Generate JWT Access Token (Merchant Login API)</mark>](/blufin360_api_documentation-docs/getting-started/authentication.md). Generate the token using [<mark style="color:$primary;">Authentication</mark>](/blufin360_api_documentation-docs/getting-started/authentication.md).

### Example request

{% tabs %}
{% tab title="Shell" %}

```bash
curl --location 'https://api.blufin360.com/api/v1/banking/fund-transfer' \
  --header 'Authorization: Bearer <accessToken>' \
  --header 'Content-Type: application/json' \
  --data
{
  "api_request_id": "API_REQ_123",
  "merchant_ref_id": "REF_123",
  "refund_amount": "5",
  "original_merchant_ref_id": "ORG_MER_REF_123",
  "reason": "Partial service delivered",
  "account_id": "550e8400-e29b-41d4-a716-446655440000"
}
```

{% endtab %}

{% tab title="Node" %}

```javascript
const res = await fetch("https://api.blufin360.com/api/v1/banking/fund-transfer", {
  method: "POST",
  headers: { Authorization: "Bearer <accessToken>", "Content-Type": "application/json" },
  body: JSON.stringify({
    api_request_id: "API_REQ_123", merchant_ref_id: "REF_123",
    refund_amount: "5", original_merchant_ref_id: "ORG_MER_REF_123",
    reason: "Partial service delivered",
    account_id: "550e8400-e29b-41d4-a716-446655440000"
  }),
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def fund_transfer():
    url = "https://api.blufin360.com/api/v1/banking/fund-transfer"

    headers = {
        'Authorization': 'Bearer <accessToken>',
        'Content-Type': 'application/json'
    }
    payload = {
        "api_request_id": "API_REQ_123",
        "merchant_ref_id": "REF_123",
        "refund_amount": "5",
        "original_merchant_ref_id": "ORG_MER_REF_123",
        "reason": "Partial service delivered",
        "account_id": "550e8400-e29b-41d4-a716-446655440000"
    }

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

    return response

if __name__ == "__main__":
    response = fund_transfer()
    print(f"Status Code: {response.status_code}")
    print(f"Response Body: {response.text}")
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	type FundTransferRequest struct {
		ApiRequestId          string `json:"api_request_id"`
		MerchantRefId         string `json:"merchant_ref_id"`
		RefundAmount          string `json:"refund_amount"`
		OriginalMerchantRefId string `json:"original_merchant_ref_id"`
		Reason                string `json:"reason"`
		AccountId             string `json:"account_id"`
	}

	data := FundTransferRequest{
		ApiRequestId:          "API_REQ_123",
		MerchantRefId:         "REF_123",
		RefundAmount:          "5",
		OriginalMerchantRefId: "ORG_MER_REF_123",
		Reason:                "Partial service delivered",
		AccountId:             "550e8400-e29b-41d4-a716-446655440000",
	}

	jsonData, err := json.Marshal(data)
	if err != nil {
		fmt.Printf("Error marshaling JSON: %v\n", err)
		return
	}

	url := "https://api.blufin360.com/api/v1/banking/fund-transfer"
	req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
	if err != nil {
		fmt.Printf("Error creating request: %v\n", err)
		return
	}

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

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Printf("Error sending request: %v\n", err)
		return
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("Error reading response: %v\n", err)
		return
	}

	fmt.Println("Response Status:", resp.Status)
	fmt.Println("Response Body:", string(body))
}
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class FundTransfer {

    public static void main(String[] args) {
        String accessToken = "<accessToken>";
        String url = "https://api.blufin360.com/api/v1/banking/fund-transfer";

        String jsonPayload = "{\n" +
                "  \"api_request_id\": \"API_REQ_123\",\n" +
                "  \"merchant_ref_id\": \"REF_123\",\n" +
                "  \"refund_amount\": \"5\",\n" +
                "  \"original_merchant_ref_id\": \"ORG_MER_REF_123\",\n" +
                "  \"reason\": \"Partial service delivered\",\n" +
                "  \"account_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n" +
                "}";

        HttpClient client = HttpClient.newHttpClient();

        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Authorization", "Bearer " + accessToken)
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
                .build();

        try {
            HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

            System.out.println("Status Code: " + response.statusCode());
            System.out.println("Response Body: " + response.body());
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
        }
    }
}
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$url = 'https://api.blufin360.com/api/v1/banking/fund-transfer';
$accessToken = '<accessToken>';
$data = [
    "api_request_id" => "API_REQ_123",
    "merchant_ref_id" => "REF_123",
    "refund_amount" => "5",
    "original_merchant_ref_id" => "ORG_MER_REF_123",
    "reason" => "Partial service delivered",
    "account_id" => "550e8400-e29b-41d4-a716-446655440000"
];

$jsonData = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $accessToken,
    'Content-Type: application/json',
    'Content-Length: ' . strlen($jsonData)
]);
$response = curl_exec($ch);

if (curl_errno($ch)) {
    $error_msg = curl_error($ch);
    echo "cURL Error: " . $error_msg;
} else {

    echo $response;
}
curl_close($ch);
```

{% endtab %}
{% endtabs %}

### Headers

| Header        | Type     | Required | Description                   | Format                                 |
| ------------- | -------- | -------- | ----------------------------- | -------------------------------------- |
| Authorization | `string` | ✅        | Access token for auth         | Authorization: Bearer `<access_token>` |
| Content-Type  | `string` | ✅        | Specifies request body format | application/json                       |

### Request Payload

```json
{
  "api_request_id": "API_REQ_123",
  "merchant_ref_id": "REF_123",
  "refund_amount": "5",
  "original_merchant_ref_id": "ORG_MER_REF_123",
  "reason": "Partial service delivered",
  "account_id": "550e8400-e29b-41d4-a716-446655440000"
}
```

### Body

| Field                       | Type      | Required | Description                                                                              |
| --------------------------- | --------- | -------- | ---------------------------------------------------------------------------------------- |
| api\_request\_id            | `string`  | ✅        | Unique request ID (6–50 chars)                                                           |
| merchant\_ref\_id           | `string`  | ✅        | Unique reference ID for this refund transaction (6–50 chars)                             |
| refund\_amount              | `decimal` | ✅        | Amount to refund (up to 2 decimal places, must be > 0). Can be partial.                  |
| original\_merchant\_ref\_id | `string`  | ✅        | The `merchant_ref_id` of the original collection transaction being refunded (6–50 chars) |
| account                     | `string`  | ✅        | Reason for the refund (6–50 chars)                                                       |
| account\_id                 | `UUID`    | ✅        | Merchant account identifier                                                              |

### Success Response — <mark style="color:$primary;">200</mark> (example)

```json
{
    "status": "success",
    "status_code": 200,
    "message": "Refund initiated successfully",
    "data": {
        "service_type": "REFUND",
        "service_subtype": "REFUND",
        "response_code": "TXN-2000",
        "response_message": "Transaction Initiated",
        "transaction_details": {
            "transaction_ref_id": "BLF202606250709083252a678",
            "merchant_ref_id": "REF_123",
            "transaction_status": "SUCCESS",
            "amount": 5,
            "currency": "INR",
            "transaction_mode": "REFUND",
            "description": "Partial service delivered",
            "utr": "110083631189",
            "remarks": null,
            "transfer_type": null,
            "created_at": "2026-06-25T07:09:06.731429+00:00",
            "original_merchant_ref_id": "ORG_MER_REF_123",
            "original_utr": "617660077400"
        }
    },
    "detail": null
}
```

### Response Metadata

| Field               | Type      | Description                                                        |
| ------------------- | --------- | ------------------------------------------------------------------ |
| status              | `string`  | Indicates the overall result of the API call.                      |
| code / status\_code | `integer` | HTTP status code                                                   |
| message             | `string`  | A summary of the outcome (e.g. `"Refund initiated successfully"`). |
| data                | `object`  | Verification response payload                                      |

### Failure Response — <mark style="color:$danger;">400 / 422 / 500</mark>

| Field  | Type      | Description                                                                  |
| ------ | --------- | ---------------------------------------------------------------------------- |
| status | `string`  | Indicates the overall result of the API call. Returns an `error` on failure. |
| code   | `integer` | Error status code                                                            |
| error  | `object`  | Error details                                                                |

**Common Error**

{% hint style="warning" %}
Please rely on the **response\_code** field to determine the final outcome of the transaction. While the **transaction\_status** and **response\_message** provide a general indication.
{% endhint %}
