Get a Receipt
Retrieve a receipt for any completed, failed, or cancelled transaction.
Get a Receipt
GET /v1/transactions/:reference/receipt
Returns a receipt for a transaction that has reached a terminal state (completed, failed, or cancelled). Unlike Verify, this endpoint works for all terminal statuses — not just completed ones.
Use Verify when you need strict confirmation before fulfilling an order. Use this endpoint for record-keeping, displaying receipts to customers, or auditing past transactions.
Connect
Platforms can call this on behalf of a connected business with the
ePay-Account header. Requires the read_only scope. You only see payments
your app created through that connection. See Act on
behalf.
Request
npm install @e-pay/nodenpm install @e-pay/nestjspip install epaypip install epaypip install epaypip install epaycomposer require epay-et/php-sdkcomposer require epay-et/php-sdkimplementation("com.epayethiopia:epay-java:0.1.0")implementation("com.epayethiopia:epay-spring-boot-starter:0.1.0")go get github.com/epay-et/go-sdkNothing 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/transactions/A3BX72KP/receipt \
-H "Authorization: Bearer sk_live_your_key_here"import { Epay, EpayBadRequestError } from '@e-pay/node';
const epay = new Epay({ apiKey: process.env.EPAY_SECRET_KEY });
try {
const receipt = await epay.payments.receipt(reference);
// receipt.status is 'completed', 'failed', or 'cancelled'
renderReceipt(receipt);
} catch (error) {
// The API rejects a transaction that is still pending or processing.
if (error instanceof EpayBadRequestError) return 'not finished yet';
throw error;
}const res = await fetch(
'https://api.e-pay.et/v1/transactions/A3BX72KP/receipt',
{
headers: { Authorization: `Bearer ${process.env.EPAY_SECRET_KEY}` },
},
);
if (!res.ok) throw new Error(`ePay ${res.status}: ${await res.text()}`);
const receipt = (await res.json()).data;from epay import Epay, EpayBadRequestError
epay = Epay() # reads EPAY_SECRET_KEY
try:
receipt = epay.payments.receipt(reference)
# receipt["status"] is "completed", "failed", or "cancelled"
render_receipt(receipt)
except EpayBadRequestError:
# The API rejects a transaction that is still pending or processing.
return "not finished yet"import os
import requests
res = requests.get(
"https://api.e-pay.et/v1/transactions/A3BX72KP/receipt",
headers={"Authorization": f"Bearer {os.environ['EPAY_SECRET_KEY']}"},
timeout=30,
)
res.raise_for_status()
receipt = res.json()["data"]use Epay\Epay;
use Epay\Exception\EpayBadRequestException;
$epay = new Epay(); // reads EPAY_SECRET_KEY
try {
$receipt = $epay->payments->receipt($reference);
// $receipt['status'] is 'completed', 'failed', or 'cancelled'
renderReceipt($receipt);
} catch (EpayBadRequestException) {
// The API rejects a transaction that is still pending or processing.
return 'not finished yet';
}$ch = curl_init('https://api.e-pay.et/v1/transactions/A3BX72KP/receipt');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('EPAY_SECRET_KEY')],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("ePay {$status}: {$body}");
}
$receipt = json_decode($body, true)['data'];receipt, err := client.Payments.Receipt(ctx, reference)
switch {
case errors.Is(err, epay.ErrBadRequest):
// The API rejects a transaction that is still pending or processing.
return errNotFinishedYet
case err != nil:
return err
}
// receipt.Status is StatusCompleted, StatusFailed, or StatusCancelled
return renderReceipt(receipt)req, _ := http.NewRequestWithContext(ctx, http.MethodGet,
"https://api.e-pay.et/v1/transactions/A3BX72KP/receipt", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("EPAY_SECRET_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode >= 400 {
return fmt.Errorf("ePay %d", res.StatusCode)
}
var envelope struct {
Data struct {
Reference string `json:"reference"`
MerchantReference *string `json:"merchantReference"`
Status string `json:"status"`
Amount string `json:"amount"`
FeeAmount *string `json:"feeAmount"`
CurrencyCode *string `json:"currencyCode"`
PaymentMethod *string `json:"paymentMethod"`
PaidAt *string `json:"paidAt"`
CreatedAt string `json:"createdAt"`
} `json:"data"`
}
if err := json.NewDecoder(res.Body).Decode(&envelope); err != nil {
return err
}
receipt := envelope.Data // every response is {"status": "success", "data": …}Epay epay = Epay.fromEnvironment(); // reads EPAY_SECRET_KEY
try {
Receipt receipt = epay.payments().receipt(reference);
// receipt.status() is COMPLETED, FAILED, or CANCELLED
renderReceipt(receipt);
} catch (EpayBadRequestException e) {
// The API rejects a transaction that is still pending or processing.
return NOT_FINISHED_YET;
}HttpClient http = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder(
URI.create("https://api.e-pay.et/v1/transactions/A3BX72KP/receipt"))
.header("Authorization", "Bearer " + System.getenv("EPAY_SECRET_KEY"))
.GET()
.build();
HttpResponse<String> response = http.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) {
throw new IllegalStateException("ePay " + response.statusCode() + ": " + response.body());
}
// Parse with Jackson, Gson, or your JSON library of choice;
// the fields are under "data": {"status":"success","data":{…}}.
String receipt = response.body();import { ConflictException, Controller, Get, Param } from '@nestjs/common';
import { EpayBadRequestError, EpayService } from '@e-pay/nestjs';
@Controller('payments')
export class ReceiptController {
constructor(private readonly epay: EpayService) {}
@Get(':reference/receipt')
async receipt(@Param('reference') reference: string) {
try {
return await this.epay.payments.receipt(reference);
} catch (error) {
// The API rejects a transaction that is still pending or processing.
if (error instanceof EpayBadRequestError) {
throw new ConflictException('Payment has not finished yet');
}
throw error;
}
}
}from django.http import JsonResponse
from django.views.decorators.http import require_GET
from epay import EpayBadRequestError
from .clients import epay # Epay(api_key=settings.EPAY_SECRET_KEY)
@require_GET
def receipt(request, reference):
try:
receipt = epay.payments.receipt(reference)
except EpayBadRequestError:
# The API rejects a transaction that is still pending or processing.
return JsonResponse({"detail": "Payment has not finished yet"}, status=409)
return JsonResponse(receipt)from flask import abort, jsonify
from epay import EpayBadRequestError
from app import app, epay # epay = Epay(), one per process
@app.get("/payments/<reference>/receipt")
def receipt(reference):
try:
return jsonify(epay.payments.receipt(reference))
except EpayBadRequestError:
# The API rejects a transaction that is still pending or processing.
abort(409, "Payment has not finished yet")from fastapi import HTTPException
from epay import EpayBadRequestError
from app.main import app, epay # epay = AsyncEpay(), closed in lifespan
@app.get("/payments/{reference}/receipt")
async def receipt(reference: str):
try:
return await epay.payments.receipt(reference)
except EpayBadRequestError:
# The API rejects a transaction that is still pending or processing.
raise HTTPException(409, "Payment has not finished yet")use Epay\Epay;
use Epay\Exception\EpayBadRequestException;
use Illuminate\Http\JsonResponse;
final class ReceiptController
{
public function __construct(private readonly Epay $epay) {}
public function show(string $reference): JsonResponse
{
try {
return response()->json($this->epay->payments->receipt($reference));
} catch (EpayBadRequestException) {
// The API rejects a transaction that is still pending or processing.
abort(409, 'Payment has not finished yet');
}
}
}
// routes/web.php
// Route::get('/payments/{reference}/receipt', [ReceiptController::class, 'show']);@RestController
@RequestMapping("/payments")
class ReceiptController {
private final Epay epay;
ReceiptController(Epay epay) {
this.epay = epay;
}
@GetMapping("/{reference}/receipt")
Receipt receipt(@PathVariable String reference) {
try {
return epay.payments().receipt(reference);
} catch (EpayBadRequestException e) {
// The API rejects a transaction that is still pending or processing.
throw new ResponseStatusException(HttpStatus.CONFLICT, "Payment has not finished yet");
}
}
}Response
{
"status": "success",
"data": {
"reference": "A3BX72KP",
"merchantReference": "order_456",
"status": "completed",
"amount": "250.00",
"chargeAmount": "250.00",
"feeAmount": "5.00",
"tipAmount": null,
"currencyCode": "ETB",
"paymentMethod": "TELEBIRR",
"customer": {
"name": "Abebe Bikila",
"email": null,
"phone": "+251911234567"
},
"paidAt": "2026-10-12T09:15:00.000Z",
"createdAt": "2026-10-12T09:10:00.000Z"
}
}Path Parameters
Prop
Type
Response
Returns 200 OK. Every response is wrapped as { "status": "success", "data": … }; the fields below are inside data.
Prop
Type
Verify vs Receipt
| Verify | Receipt | |
|---|---|---|
| Statuses | completed only | completed, failed, cancelled |
| Use case | Confirm before fulfilling an order | Record-keeping, auditing, displaying to customer |
Returns 400 on pending? | Yes | Yes |
Receipt UX Guidelines
When displaying a receipt to a customer or in your dashboard, follow these guidelines:
- Always show the reference —
A3BX72KPis the canonical identifier. Include it prominently so customers can quote it in support requests. - Show status clearly — use colour or iconography to distinguish
completed(green),failed(red), andcancelled(grey). - Display both amount and fee — show the original
amountandfeeAmountseparately so the customer understands exactly what was charged. - Format timestamps in local time —
paidAtandcreatedAtare UTC. Convert to the user's timezone before rendering. - Mask sensitive data — if showing the customer's phone number, consider displaying only the last 4 digits (e.g.
+251 9•• ••• 4567).
Handling Refunds on Receipts
A receipt represents the original payment record and should never be mutated when a refund occurs. Refunds are separate events with their own lifecycle.
Recommended Approach
1. Store records separately
payments table refunds table
───────────────── ─────────────────────────────
reference id
amount payment_reference (FK → payments)
status amount
paidAt status
... createdAt
resolvedAtKeep the original payment row unchanged. Append refund records to a separate refunds table or collection, linked by payment_reference.
2. Compute refund summary at read time
When fetching a receipt, join or aggregate the refund records for that payment:
const refundSummary = refunds
.filter((r) => r.paymentReference === reference)
.reduce(
(acc, r) => ({
refundedAmount: (
parseFloat(acc.refundedAmount) + parseFloat(r.amount)
).toFixed(2),
latestRefundAt:
r.resolvedAt > acc.latestRefundAt ? r.resolvedAt : acc.latestRefundAt,
status: r.status, // last refund status wins, or derive from all
}),
{ refundedAmount: '0.00', latestRefundAt: null, status: null },
);3. Display on the receipt UI
Once a refund exists, show the following alongside the original payment fields:
┌─────────────────────────────────────────┐
│ Receipt — A3BX72KP │
│ │
│ Amount paid ETB 250.00 │
│ Fee ETB 5.00 │
│ Payment method TeleBirr │
│ Paid at 12 Oct 2026, 09:15 │
│ │
│ ── Refund ─────────────────────────── │
│ Refunded amount ETB 250.00 │
│ Refund status Completed │
│ Refunded at 12 Oct 2026, 11:30 │
└─────────────────────────────────────────┘Show the refund section only when at least one refund record exists for the payment. Do not show null or empty refund fields on receipts for payments that have never been refunded.
ePay sends a refund.completed or refund.failed webhook when a refund
reaches a terminal state. Listen for these events to update your refund
records in real time rather than polling.
Errors
| Status | Description |
|---|---|
400 | Transaction is still pending or processing — not yet in a terminal state. |
401 | Missing or invalid API key. |
404 | No transaction found for the given reference under your account. |