Refunds

Initiate a Refund

Request a full refund for a completed transaction.

Initiate a Refund

POST /v1/refunds

Creates a refund for a completed transaction. Only full refunds are supported. The original transaction must be in completed status.

Refunds are not instant. After initiation the refund enters pending status and is processed asynchronously. You will receive payment.refunding and payment.refunded (or payment.refund_failed) webhooks as the status changes.

Connect

Platforms can call this on behalf of a connected business with the ePay-Account header. Requires the read_write scope. See Act on behalf.


Request

raw HTTP
npm install @e-pay/node
npm install @e-pay/nestjs
pip install epay
pip install epay
pip install epay
pip install epay
composer require epay-et/php-sdk
composer require epay-et/php-sdk
implementation("com.epayethiopia:epay-java:0.1.0")
implementation("com.epayethiopia:epay-spring-boot-starter:0.1.0")
go get github.com/epay-et/go-sdk

Nothing NestJS-specific here — this is the same Node.js client call.

Nothing Django-specific here — this is the same Python client call.

Nothing Flask-specific here — this is the same Python client call.

Nothing FastAPI-specific here — this is the same Python client call.

Nothing Laravel-specific here — this is the same PHP client call.

Nothing Spring Boot-specific here — this is the same Java client call.

curl https://api.e-pay.et/v1/refunds \
  -X POST \
  -H "Authorization: Bearer sk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -H "x-idempotency-key: refund_order_123" \
  -d '{
    "reference": "PAB12CD3420260813",
    "reason": "Customer requested cancellation",
    "merchantReference": "refund_order_123"
  }'
import { Epay } from '@e-pay/node';

const epay = new Epay({ apiKey: process.env.EPAY_SECRET_KEY });

const result = await epay.refunds.initiate(
  {
    reference: 'PAB12CD3420260813',
    reason: 'Customer requested cancellation',
    merchantReference: 'refund_order_123',
  },
  { idempotencyKey: 'refund_order_123' },
);

console.log(result.refund.epayReference); // RF3A4B5C6D20261021
console.log(result.refund.status); // refund_status_pending
const res = await fetch('https://api.e-pay.et/v1/refunds', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.EPAY_SECRET_KEY}`,
    'Content-Type': 'application/json',
    'x-idempotency-key': 'refund_order_123',
  },
  body: JSON.stringify({
    reference: 'PAB12CD3420260813',
    reason: 'Customer requested cancellation',
    merchantReference: 'refund_order_123',
  }),
});

if (!res.ok) throw new Error(`ePay ${res.status}: ${await res.text()}`);
const { refund } = (await res.json()).data;
from epay import Epay

epay = Epay()  # reads EPAY_SECRET_KEY

result = epay.refunds.initiate(
    reference="PAB12CD3420260813",
    reason="Customer requested cancellation",
    merchant_reference="refund_order_123",
    idempotency_key="refund_order_123",
)

print(result.refund.epay_reference)  # RF3A4B5C6D20261021
print(result.refund.status)  # refund_status_pending
import os
import requests

res = requests.post(
    "https://api.e-pay.et/v1/refunds",
    headers={
        "Authorization": f"Bearer {os.environ['EPAY_SECRET_KEY']}",
        "Content-Type": "application/json",
        "x-idempotency-key": "refund_order_123",
    },
    json={
        "reference": "PAB12CD3420260813",
        "reason": "Customer requested cancellation",
        "merchantReference": "refund_order_123",
    },
    timeout=30,
)

res.raise_for_status()
refund = res.json()["data"]["refund"]
use Epay\Epay;

$epay = new Epay(); // reads EPAY_SECRET_KEY

$result = $epay->refunds->initiate(
    [
        'reference' => 'PAB12CD3420260813',
        'reason' => 'Customer requested cancellation',
        'merchantReference' => 'refund_order_123',
    ],
    idempotencyKey: 'refund_order_123',
);

echo $result->refund->epayReference; // RF3A4B5C6D20261021
echo $result->refund->status; // refund_status_pending
$payload = json_encode([
    'reference'         => 'PAB12CD3420260813',
    'reason'            => 'Customer requested cancellation',
    'merchantReference' => 'refund_order_123',
]);

$ch = curl_init('https://api.e-pay.et/v1/refunds');

curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS     => $payload,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('EPAY_SECRET_KEY'),
        'Content-Type: application/json',
        'x-idempotency-key: refund_order_123',
    ],
]);

$body   = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

if ($status !== 200) {
    throw new RuntimeException("ePay {$status}: {$body}");
}

$refund = json_decode($body, true)['data']['refund'];
result, err := client.Refunds.Initiate(ctx, &epay.InitiateRefundParams{
	Reference:         "PAB12CD3420260813",
	Reason:            "Customer requested cancellation",
	MerchantReference: "refund_order_123",
}, epay.WithIdempotencyKey("refund_order_123"))
if err != nil {
	return err
}

fmt.Println(result.Refund.EpayReference) // RF3A4B5C6D20261021
body := strings.NewReader(`{
	"reference": "PAB12CD3420260813",
	"reason": "Customer requested cancellation",
	"merchantReference": "refund_order_123"
}`)

req, _ := http.NewRequestWithContext(ctx, http.MethodPost, "https://api.e-pay.et/v1/refunds", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("EPAY_SECRET_KEY"))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-idempotency-key", "refund_order_123")

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

if res.StatusCode != http.StatusCreated {
	return fmt.Errorf("ePay %d", res.StatusCode)
}
Epay epay = Epay.fromEnvironment(); // reads EPAY_SECRET_KEY

InitiateRefundResult result = epay.refunds().initiate(
        InitiateRefundParams.builder()
                .reference("PAB12CD3420260813")
                .reason("Customer requested cancellation")
                .merchantReference("refund_order_123")
                .build(),
        RequestOptions.builder().idempotencyKey("refund_order_123").build());

System.out.println(result.getRefund().getEpayReference()); // RF3A4B5C6D20261021
String payload = """
    {
      "reference": "PAB12CD3420260813",
      "reason": "Customer requested cancellation",
      "merchantReference": "refund_order_123"
    }
    """;

HttpClient http = HttpClient.newHttpClient();

HttpRequest request = HttpRequest.newBuilder(URI.create("https://api.e-pay.et/v1/refunds"))
    .header("Authorization", "Bearer " + System.getenv("EPAY_SECRET_KEY"))
    .header("Content-Type", "application/json")
    .header("x-idempotency-key", "refund_order_123")
    .POST(HttpRequest.BodyPublishers.ofString(payload))
    .build();

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

if (response.statusCode() != 201) {
    throw new IllegalStateException("ePay " + response.statusCode() + ": " + response.body());
}

Headers

Prop

Type


Body Parameters

Prop

Type


Response

Returns 201 Created with the created refund in data.refund.

{
  "status": "success",
  "data": {
    "refund": {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "epayReference": "RF3A4B5C6D20261021",
      "type": "refund_type_full",
      "status": "refund_status_pending",
      "amount": "250.00",
      "refundFeeAmount": "0.00",
      "merchantDebitAmount": "250.00",
      "reason": "Customer requested cancellation",
      "merchantReference": "refund_order_123",
      "createdAt": "2026-10-21T10:00:00.000Z"
    }
  }
}

Prop

Type


Errors

StatusDescription
400Transaction is not completed, already has an active refund, or insufficient wallet balance.
401Missing or invalid API key.
404No transaction found for the given reference under your account.
409Connect only: refundProductFee is true and your platform balance can't cover the app fee (platform_balance_insufficient).

Next: List Refunds — retrieve all refunds for your account.

On this page