A customer wants their money back, and support has to ask for their sort code and account number before arranging a transfer. That creates another email exchange just when the customer wants the problem sorted.
You can handle the refund with a manual transfer to details the customer sends, or use a refund API that returns money to the source account. The API route avoids collecting bank details and gives your application a refund status to track.
This guide is for developers building checkouts for UK businesses that take Pay by Bank.
How a Pay by Bank Refund Works
The source account is the account the original payment came from. A refund API uses the original payment reference to send money back there by bank transfer, without support asking the customer for account details.
Before connecting a refund API, build its account, amount and timing rules into your support flow (Refund API documentation, checked 2026):
- Enable refunds first. Refunds need enabling through support. Otherwise, the API returns HTTP 405 with "Refunds are not available for this account".
- Check the original payment. Only completed payments can be refunded.
- Allow full and partial refunds. The documented minimum is £1, and the maximum is the original payment amount. Your application must also track how much previous refunds have used.
- Check the available balance. The documented timing is within 30 minutes, provided you have enough balance.
Treat an accepted request as the start of the refund. Support should be able to see its progress before telling the customer it has arrived.
Step by Step: Refund a Pay by Bank Payment
The examples use Node.js 18 or later with built-in fetch. The HTTP path and request fields follow the linked reference; database methods, response adapters and notification storage are application code you must implement.
1. Confirm Refunds Are Enabled
Check both sandbox and production accounts before exposing the refund button. Handle the account availability error with a message support can act on, rather than showing a technical error.
Also decide who can approve refunds and where staff will see failures. Before submission, show the original payment reference, the amount already refunded and the amount about to be returned.
2. Calculate the Amount Left to Refund
Store money as whole pence internally. Convert to pounds only where the provider requires it, so calculations don't depend on decimal arithmetic.
Reserve amounts for local REQUESTED records and refunds marked INITIATED, PENDING or COMPLETED. Release the reservation when a refund is confirmed FAILED or CANCELLED; an unknown outcome must keep its reservation.
Lock the payment row while checking and reserving the amount. Commit that transaction before making the HTTP request, so a slow provider call doesn't leave a database lock open.
3. Create a Refund Request and Handle Retries
An idempotent operation can be repeated without creating another refund. Your application needs a unique refund request ID and a durable record of the first attempt.
The linked REST API doesn't document or honour an Idempotency-Key header. After a timeout, check your own record and the provider's list-refunds endpoint for the paymentRequestId before considering another submission.
const API_BASE = process.env.PAYMENTS_API_BASE; const API_KEY = process.env.PAYMENTS_API_KEY; const RESERVED = ["REQUESTED", "INITIATED", "PENDING", "COMPLETED"]; async function refundPayment(paymentId, amountPence, requestId, reason) { if (!Number.isSafeInteger(amountPence) || amountPence < 100) { throw new Error("Refund amount must be whole pence, at least 100"); } const reservation = await db.transaction(async function (tx) { const payment = await tx.payments.lockAndGet(paymentId); const existing = await tx.refunds.getByRequestId(requestId); if (existing) { if (existing.paymentId !== paymentId || existing.amountPence !== amountPence) { throw new Error("Request ID already used for another refund"); } return { created: false, record: existing }; } if (payment.status !== "COMPLETED") { throw new Error("Only completed payments can be refunded"); } const refunds = await tx.refunds.forPayment(paymentId); const reserved = refunds .filter(function (r) { return RESERVED.includes(r.status); }) .reduce(function (sum, r) { return sum + r.amountPence; }, 0); if (reserved + amountPence > payment.amountPence) { throw new Error("Refund would exceed the amount paid"); } const record = await tx.refunds.insert({ requestId: requestId, paymentId: paymentId, amountPence: amountPence, status: "REQUESTED", providerRefundId: null }); return { created: true, record: record }; }); if (!reservation.created) return reservation.record; // The reservation transaction has committed before this HTTP call. const res = await fetch(API_BASE + "/api/refund", { method: "POST", headers: { "Authorization": "Bearer " + API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ paymentRequestId: paymentId, amount: amountPence / 100, currency: "GBP", refundNotes: reason.slice(0, 200), metadata: { refundRequestId: requestId } }) }); if (res.status === 405) { throw new Error("Refunds are not enabled. Ask the provider."); } if (!res.ok) { throw new Error("Investigate refund response: HTTP " + res.status); } const result = decodeInitiateReply(await res.json()); await db.refunds.attachProviderId(requestId, result.providerRefundId); await applyRefundStatus(requestId, result.status, result.errorDescription); return db.refunds.getByRequestId(requestId); } Set PAYMENTS_API_BASE to the provider's API base URL. Enforce a database uniqueness constraint on requestId; the payment lock alone doesn't protect the same ID across different payments.
decodeInitiateReply is an adapter you implement against the documented initiate response. Its output names are local application fields, not a claim about the provider's JSON structure.
If the request, response parsing or local update fails, the committed REQUESTED record remains available for investigation. Don't automatically repeat the POST or release its reserved amount.
Set metadata correctly at creation because it cannot be changed afterwards. Keep refund notes within the documented character limit.
4. Update the Status From the Webhook
A webhook is an HTTP request the provider sends to your server when something changes. Verify the signature using the provider's documented scheme before trusting the contents.
The refund webhook payload isn't published in the docs. Names such as event.refundId and event.errorMessage are therefore assumptions, not verified fields; the payment payload uses errorDescription.
Build decodeVerifiedRefundEvent from a real test event before enabling this handler. It should return the local field names below only after validating the identifier and status.
const STATUS_RANK = { REQUESTED: 0, INITIATED: 1, PENDING: 2, COMPLETED: 3, FAILED: 3, CANCELLED: 3 }; async function applyRefundStatus(requestId, status, errorDescription) { if (!Object.hasOwn(STATUS_RANK, status)) { throw new Error("Unrecognised refund status"); } return db.transaction(async function (tx) { const refund = await tx.refunds.lockByRequestId(requestId); if (!refund) throw new Error("Unknown local refund"); if (STATUS_RANK[status] <= STATUS_RANK[refund.status]) return; await tx.refunds.update(requestId, { status: status }); if (status === "COMPLETED" || status === "FAILED") { await tx.outbox.insertUnique({ key: requestId + ":" + status, requestId: requestId, kind: status === "COMPLETED" ? "refund-completed" : "refund-failed", errorDescription: errorDescription || null }); } }); } async function handleVerifiedRefundWebhook(req, res) { try { const event = decodeVerifiedRefundEvent(req.body); const refund = await db.refunds.getByProviderId(event.providerRefundId); if (!refund) return res.status(503).end(); await applyRefundStatus( refund.requestId, event.status, event.errorDescription ); return res.status(200).end(); } catch (error) { return res.status(503).end(); } } INITIATED and PENDING sit below the terminal statuses COMPLETED, FAILED and CANCELLED. Equal or lower ranks are ignored, preventing late events from moving a completed refund backwards or replacing one terminal outcome with another.
The row lock makes concurrent updates follow the same rule. A conflicting terminal event still needs investigation during reconciliation.
An unknown refund receives a non-2xx response because only non-2xx responses are retried. This covers an event arriving before the create reply's provider ID has been attached locally.
The initiate reply also passes through applyRefundStatus. An immediate FAILED therefore follows the same failure path as a webhook; don't wait for a later event to report it.
The outbox is a database table of work awaiting delivery. A worker sends completion messages or opens failure tasks, using trusted customer records and retrying delivery without repeating the refund.
5. Show Support What Each Status Means
Use the documented status names internally and clear descriptions in the support screen. REQUESTED is your own local state, indicating that the request is reserved but its provider outcome may still need checking.
| Status | Meaning | Action |
|---|---|---|
| INITIATED | The refund request has been raised | Show that it has started |
| PENDING | The refund is being prepared to be processed | Keep tracking it |
| COMPLETED | The refund has completed | Confirm completion to the customer |
| FAILED | The refund payment has failed | Investigate before retrying |
| CANCELLED | The refund was stopped while still pending | Record the cancellation and release the reservation |
Don't label INITIATED or PENDING as "refunded". Show the amount alongside the status, especially when only part of the original payment is being returned.
6. Reconcile Provider and Local Records
Run a daily comparison of provider refund records against your database. Reconciliation means checking that both sides agree about the amount and status.
Include the refund type, FULL or PARTIAL, and flag unresolved requests for support. Keep the internal request reference and provider refund reference together so colleagues can investigate lost responses without immediately issuing another refund.
Why Refunds Without Bank Details Matter
There were 351 million UK open banking payments in 2025, up 57% on 2024 (Open Banking Limited, 2026). If your checkout accepts these payments, give support a refund route alongside the payment route.
For distance sales covered by the cancellation rules, reimbursement must happen without undue delay and within 14 days of the relevant date, using the same means of payment unless the consumer expressly agrees otherwise (Consumer Contracts Regulations, 2013, regulation 34; revised text checked 2026). The trigger depends on the contract, so track the applicable deadline in the support case rather than counting from the purchase.
Edge Cases to Plan For
The payment hasn't completed. Keep the refund action unavailable until the original payment is completed.
The balance is insufficient. The documented timing depends on sufficient balance. Investigate the provider's response before making a timing promise.
The request times out. Keep it unresolved locally. Check existing refunds for that payment before permitting another submission.
A refund fails. FAILED doesn't establish a particular bank rejection reason. Investigate the available details before explaining the failure to the customer.
Someone needs to cancel. Only pending refunds that haven't been processed can be cancelled. Cancellations cannot be simulated in the sandbox, so account for that limitation in release checks.
You need to test failure handling. In the documented sandbox, passing FAILURE TEST as the refund note produces FAILED. Check that an immediate failure opens a support task without waiting for a webhook or sending a completion message.
Mistakes to Avoid
Requesting bank details by email as the default. Source-account refunds remove that collection step. Use an established customer verification process for alternative arrangements.
Authorised push payment fraud, where someone is tricked into sending money, caused £576.4 million in losses in 2025; 66% of cases originated online (UK Finance, Annual Fraud Report, 2026). Use that risk to review how support verifies changes to payment instructions.
Treating a timeout as a failure. No response doesn't prove that no refund was created. Keep the amount reserved until you establish the outcome.
Assuming a header prevents duplicates. Keep your own unique request record and check existing refunds before retrying.
Promising instant refunds. Make customer messages reflect the confirmed status and keep balance conditions visible to staff.
Checklist
- [ ] Refunds enabled in sandbox and production.
- [ ] Only completed payments accepted for refund.
- [ ] Whole-pence amounts and remaining balance checked.
- [ ] REQUESTED record committed before the HTTP call.
- [ ] No database lock held across that call.
- [ ] Existing refunds checked before any retry.
- [ ] Immediate FAILED handled from the initiate reply.
- [ ] Webhook mapping checked against a real test event.
- [ ] Unknown events receive non-2xx responses.
- [ ] Status updates move forwards under a row lock.
- [ ] Notifications recoverable after delivery failures.
- [ ] Records reconciled daily.
Conclusion
A Pay by Bank refund API lets support return money to the source account without collecting bank details, but accepted requests still need tracking through to completion. Start by confirming refunds are enabled, then build the request record and status handling that let support resolve each refund confidently.